Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fusiontrees/braiding_manipulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ braid, but a general braid can be obtained by combining such operations.
braid(f::FusionTree{I, N}, p::IndexTuple{N}, levels::IndexTuple{N}) where {I, N} =
braid(f, (p, ()), (levels, ()))
function braid(f::FusionTree{I, N}, (p, _)::Index2Tuple{N, 0}, (levels, _)::Index2Tuple{N, 0}) where {I, N}
TupleTools.isperm(p) || throw(ArgumentError("not a valid permutation: $p"))
TupleTools.isperm(p) || throw(ArgumentError(lazy"not a valid permutation: $p"))
@assert FusionStyle(I) isa UniqueFusion
if BraidingStyle(I) isa SymmetricBraiding # this assumes Fsymbols are 1!
coeff = one(sectorscalartype(I))
Expand Down
2 changes: 1 addition & 1 deletion src/spaces/cartesianspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ unitspace(::Type{CartesianSpace}) = CartesianSpace(1)
zerospace(::Type{CartesianSpace}) = CartesianSpace(0)
⊕(V₁::CartesianSpace, V₂::CartesianSpace) = CartesianSpace(V₁.d + V₂.d)
function ⊖(V::CartesianSpace, W::CartesianSpace)
V ≿ W || throw(ArgumentError("$(W) is not a subspace of $(V)"))
V ≿ W || throw(ArgumentError(lazy"$(W) is not a subspace of $(V)"))
return CartesianSpace(dim(V) - dim(W))
end

Expand Down
2 changes: 1 addition & 1 deletion src/spaces/complexspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function ⊕(V₁::ComplexSpace, V₂::ComplexSpace)
end
function ⊖(V::ComplexSpace, W::ComplexSpace)
(V ≿ W && isdual(V) == isdual(W)) ||
throw(ArgumentError("$(W) is not a subspace of $(V)"))
throw(ArgumentError(lazy"$(W) is not a subspace of $(V)"))
return ComplexSpace(dim(V) - dim(W), isdual(V))
end

Expand Down
2 changes: 1 addition & 1 deletion src/spaces/deligne.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ function ⊠(P₀::ProductSpace{<:ElementarySpace, 0}, P::ProductSpace{<:Element
end

@noinline function throw_incompatible_fields(P₁, P₂)
throw(ArgumentError("Deligne products require spaces over the same field: $(field(P₁)) ≠ $(field(P₂))"))
throw(ArgumentError(lazy"Deligne products require spaces over the same field: $(field(P₁)) ≠ $(field(P₂))"))
end
2 changes: 1 addition & 1 deletion src/spaces/generalspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct GeneralSpace{𝔽} <: ElementarySpace
return if 𝔽 isa Field
new{𝔽}(Int(d), dual, (𝔽 ⊆ ℝ) ? false : conj)
else
throw(ArgumentError("Unrecognised scalar field: $𝔽"))
throw(ArgumentError(lazy"Unrecognised scalar field: $𝔽"))
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions src/spaces/gradedspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function GradedSpace{I, NTuple{N, Int}}(dims; dual::Bool = false) where {I, N}
for (c, dc) in dims
k = convert(I, c)
i = findindex(values(I), k)
k = dc < 0 && throw(ArgumentError("Sector $k has negative dimension $dc"))
isset[i] && throw(ArgumentError("Sector $c appears multiple times"))
k = dc < 0 && throw(ArgumentError(lazy"Sector $k has negative dimension $dc"))
isset[i] && throw(ArgumentError(lazy"Sector $c appears multiple times"))
isset = TupleTools.setindex(isset, true, i)
d = TupleTools.setindex(d, dc, i)
end
Expand All @@ -50,8 +50,8 @@ function GradedSpace{I, SectorDict{I, Int}}(dims; dual::Bool = false) where {I <
d = SectorDict{I, Int}()
for (c, dc) in dims
k = convert(I, c)
haskey(d, k) && throw(ArgumentError("Sector $k appears multiple times"))
dc < 0 && throw(ArgumentError("Sector $k has negative dimension $dc"))
haskey(d, k) && throw(ArgumentError(lazy"Sector $k appears multiple times"))
dc < 0 && throw(ArgumentError(lazy"Sector $k has negative dimension $dc"))
!iszero(dc) && push!(d, k => dc)
end
return GradedSpace{I, SectorDict{I, Int}}(d, dual)
Expand Down
4 changes: 2 additions & 2 deletions src/spaces/vectorspaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function leftunitspace(V::ElementarySpace)
else
!isempty(sectors(V)) || throw(ArgumentError("Cannot determine the left unit of an empty space"))
_allequal(leftunit, sectors(V)) ||
throw(ArgumentError("sectors of $V do not have the same left unit"))
throw(ArgumentError(lazy"sectors of $V do not have the same left unit"))

sector = leftunit(first(sectors(V)))
return spacetype(V)(sector => 1)
Expand All @@ -194,7 +194,7 @@ function rightunitspace(V::ElementarySpace)
else
!isempty(sectors(V)) || throw(ArgumentError("Cannot determine the right unit of an empty space"))
_allequal(rightunit, sectors(V)) ||
throw(ArgumentError("sectors of $V do not have the same right unit"))
throw(ArgumentError(lazy"sectors of $V do not have the same right unit"))

sector = rightunit(first(sectors(V)))
return spacetype(V)(sector => 1)
Expand Down
10 changes: 5 additions & 5 deletions src/tensors/abstracttensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ similarstoragetype(t, ::Type{T}) where {T <: Number} = similarstoragetype(typeof

# avoid infinite recursion
similarstoragetype(X::Type) =
throw(ArgumentError("Cannot determine a storagetype for tensor / array type `$X`"))
throw(ArgumentError(lazy"Cannot determine a storagetype for tensor / array type `$X`"))
similarstoragetype(X::Type, ::Type{T}) where {T <: Number} =
throw(ArgumentError("Cannot determine a storagetype for tensor / array type `$X` and/or scalar type `$T`"))
throw(ArgumentError(lazy"Cannot determine a storagetype for tensor / array type `$X` and/or scalar type `$T`"))

# implement on tensors
similarstoragetype(::Type{TT}) where {TT <: AbstractTensorMap} = similarstoragetype(storagetype(TT))
Expand Down Expand Up @@ -184,11 +184,11 @@ promote_storage_rule(::Type{T}, ::Type{Base.Bottom}, slurp...) where {T} = T
promote_storage_result(::Type, ::Type, ::Type{T}, ::Type{S}) where {T, S} = (@inline; promote_storagetype(T, S))
# If no promote_storage_rule is defined, both directions give Bottom => error
promote_storage_result(T::Type, S::Type, ::Type{Base.Bottom}, ::Type{Base.Bottom}) =
throw(ArgumentError("No promotion rule defined for storagetype `$T` and `$S`"))
throw(ArgumentError(lazy"No promotion rule defined for storagetype `$T` and `$S`"))

# promotion rules for common vector types
promote_storage_rule(::Type{T}, ::Type{S}) where {T <: DenseVector, S <: DenseVector} =
T === S ? T : throw(ArgumentError("No promotion rule defined for storagetype `$T` and `$S`"))
T === S ? T : throw(ArgumentError(lazy"No promotion rule defined for storagetype `$T` and `$S`"))

# tensor characteristics: space and index information
#-----------------------------------------------------
Expand Down Expand Up @@ -440,7 +440,7 @@ Base.@propagate_inbounds function subblock(t::AbstractTensorMap, sectors::Tuple{
I === sectortype(t) || throw(SectorMismatch("Not a valid sectortype for this tensor."))
FusionStyle(I) isa UniqueFusion ||
throw(SectorMismatch("Indexing with sectors is only possible for unique fusion styles."))
length(sectors) == numind(t) || throw(ArgumentError("invalid number of sectors"))
length(sectors) == numind(t) || throw(ArgumentError(lazy"invalid number of sectors ($(length(sectors))) for number of indices ($(numind(t)))"))

# convert to fusiontrees
s₁ = TupleTools.getindices(sectors, codomainind(t))
Expand Down
2 changes: 1 addition & 1 deletion src/tensors/braidingtensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct BraidingTensor{T, S, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2
function BraidingTensor{T, S, A}(V1::S, V2::S, adjoint::Bool = false) where {T, S <: IndexSpace, A <: DenseVector{T}}
for a in sectors(V1), b in sectors(V2), c in (a ⊗ b)
Nsymbol(a, b, c) == Nsymbol(b, a, c) ||
throw(ArgumentError("Cannot define a braiding between $a and $b"))
throw(ArgumentError(lazy"Cannot define a braiding between $a and $b"))
end
return new{T, S, A}(V1, V2, adjoint)
# partial construction: only construct rowr and colr when needed
Expand Down
2 changes: 1 addition & 1 deletion src/tensors/indexmanipulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ See also [`repartition!`](@ref) for writing into an existing destination.
copy::Bool = false, backend = TO.DefaultBackend(), allocator = TO.DefaultAllocator()
)
N₁ + N₂ == numind(t) ||
throw(ArgumentError("Invalid repartition: $(numind(t)) to ($N₁, $N₂)"))
throw(ArgumentError(lazy"Invalid repartition: $(numind(t)) to ($N₁, $N₂)"))
p₁, p₂ = let all_inds = (codomainind(t)..., reverse(domainind(t))...)
ntuple(i -> all_inds[i], N₁), reverse(ntuple(i -> all_inds[i + N₁], N₂))
end
Expand Down
Loading