diff --git a/src/fusiontrees/braiding_manipulations.jl b/src/fusiontrees/braiding_manipulations.jl index 7b4cdae4d..12926269c 100644 --- a/src/fusiontrees/braiding_manipulations.jl +++ b/src/fusiontrees/braiding_manipulations.jl @@ -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)) diff --git a/src/spaces/cartesianspace.jl b/src/spaces/cartesianspace.jl index 6f60e9802..46729b979 100644 --- a/src/spaces/cartesianspace.jl +++ b/src/spaces/cartesianspace.jl @@ -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 diff --git a/src/spaces/complexspace.jl b/src/spaces/complexspace.jl index 4b648432f..cb58279e9 100644 --- a/src/spaces/complexspace.jl +++ b/src/spaces/complexspace.jl @@ -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 diff --git a/src/spaces/deligne.jl b/src/spaces/deligne.jl index 5a5a2d71a..5417eb649 100644 --- a/src/spaces/deligne.jl +++ b/src/spaces/deligne.jl @@ -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 diff --git a/src/spaces/generalspace.jl b/src/spaces/generalspace.jl index 1ddfbc2d2..f35d6d6b0 100644 --- a/src/spaces/generalspace.jl +++ b/src/spaces/generalspace.jl @@ -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 diff --git a/src/spaces/gradedspace.jl b/src/spaces/gradedspace.jl index 8bde2fa04..ed70bf884 100644 --- a/src/spaces/gradedspace.jl +++ b/src/spaces/gradedspace.jl @@ -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 @@ -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) diff --git a/src/spaces/vectorspaces.jl b/src/spaces/vectorspaces.jl index 18bdad69c..01dc00390 100644 --- a/src/spaces/vectorspaces.jl +++ b/src/spaces/vectorspaces.jl @@ -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) @@ -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) diff --git a/src/tensors/abstracttensor.jl b/src/tensors/abstracttensor.jl index edbcfe662..f3b6fa18a 100644 --- a/src/tensors/abstracttensor.jl +++ b/src/tensors/abstracttensor.jl @@ -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)) @@ -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 #----------------------------------------------------- @@ -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)) diff --git a/src/tensors/braidingtensor.jl b/src/tensors/braidingtensor.jl index a1b7dbd02..add0df48d 100644 --- a/src/tensors/braidingtensor.jl +++ b/src/tensors/braidingtensor.jl @@ -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 diff --git a/src/tensors/indexmanipulations.jl b/src/tensors/indexmanipulations.jl index 7155bb4be..69f738a24 100644 --- a/src/tensors/indexmanipulations.jl +++ b/src/tensors/indexmanipulations.jl @@ -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