Skip to content

Commit cfaa073

Browse files
authored
Mark more error strings lazy (#478)
1 parent f3c3102 commit cfaa073

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/spaces/homspace.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ according to the permutation `p₁` and `p₂` respectively.
211211
function permute(W::HomSpace, (p₁, p₂)::Index2Tuple)
212212
p = (p₁..., p₂...)
213213
TupleTools.isperm(p) && length(p) == numind(W) ||
214-
throw(ArgumentError("$((p₁, p₂)) is not a valid permutation for $(W)"))
214+
throw(ArgumentError(lazy"$((p₁, p₂)) is not a valid permutation for $(W)"))
215215
return select(W, (p₁, p₂))
216216
end
217217

@@ -226,7 +226,7 @@ end
226226
function braid(W::HomSpace, (p₁, p₂)::Index2Tuple, levels::IndexTuple)
227227
p = (p₁..., p₂...)
228228
TupleTools.isperm(p) && length(p) == numind(W) == length(levels) ||
229-
throw(ArgumentError("$((p₁, p₂)), $levels is not a valid braiding for $(W)"))
229+
throw(ArgumentError(lazy"$((p₁, p₂)), $levels is not a valid braiding for $(W)"))
230230
return select(W, (p₁, p₂))
231231
end
232232

@@ -265,7 +265,7 @@ Obtain the HomSpace that is obtained from composing the morphisms in `W` and `V`
265265
to be possible, the domain of `W` must match the codomain of `V`.
266266
"""
267267
function compose(W::HomSpace{S}, V::HomSpace{S}) where {S}
268-
domain(W) == codomain(V) || throw(SpaceMismatch("$(domain(W))$(codomain(V))"))
268+
domain(W) == codomain(V) || throw(SpaceMismatch(lazy"$(domain(W)) ≠ $(codomain(V))"))
269269
return HomSpace(codomain(W), domain(V))
270270
end
271271

src/tensors/treetransformers.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function AbelianTreeTransformer(transform, p, Vdst, Vsrc)
3636

3737
Δt = Base.time() - t₀
3838

39-
@debug("Treetransformer for $Vsrc to $Vdst via $p", nblocks = L, Δt)
39+
@debug(lazy"Treetransformer for $Vsrc to $Vdst via $p", nblocks = L, Δt)
4040

4141
return transformer
4242
end
@@ -81,7 +81,7 @@ function GenericTreeTransformer(transform, p, Vdst, Vsrc)
8181
data[local_counter] = U, (sz_dst, newstructs_dst), (sz_src, newstructs_src)
8282

8383
@debug(
84-
"Created recoupling block for uncoupled: $(fs_src.uncoupled)",
84+
lazy"Created recoupling block for uncoupled: $(fs_src.uncoupled)",
8585
sz = size(U), sparsity = count(!iszero, U) / length(U)
8686
)
8787
end
@@ -96,7 +96,7 @@ function GenericTreeTransformer(transform, p, Vdst, Vsrc)
9696
data[i] = U, (sz_dst, newstructs_dst), (sz_src, newstructs_src)
9797

9898
@debug(
99-
"Created recoupling block for uncoupled: $(fs_src.uncoupled)",
99+
lazy"Created recoupling block for uncoupled: $(fs_src.uncoupled)",
100100
sz = size(U), sparsity = count(!iszero, U) / length(U)
101101
)
102102
end
@@ -109,7 +109,7 @@ function GenericTreeTransformer(transform, p, Vdst, Vsrc)
109109
Δt = Base.time() - t₀
110110

111111
@debug(
112-
"TreeTransformer for $Vsrc to $Vdst via $p",
112+
lazy"TreeTransformer for $Vsrc to $Vdst via $p",
113113
nblocks = length(transformer.data),
114114
sz_median = size(transformer.data[cld(end, 2)][1], 1),
115115
sz_max = size(transformer.data[1][1], 1),

src/tensors/vectorinterface.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ function VectorInterface.scale!!(t::AbstractTensorMap, α::Number)
4141
return T <: scalartype(t) ? scale!(t, α) : scale(t, α)
4242
end
4343
function VectorInterface.scale!(ty::AbstractTensorMap, tx::AbstractTensorMap, α::Number)
44-
space(ty) == space(tx) || throw(SpaceMismatch("$(space(ty))$(space(tx))"))
44+
space(ty) == space(tx) || throw(SpaceMismatch(lazy"$(space(ty)) ≠ $(space(tx))"))
4545
for ((cy, by), (cx, bx)) in zip(blocks(ty), blocks(tx))
4646
scale!(by, bx, α)
4747
end
4848
return ty
4949
end
5050
function VectorInterface.scale!(ty::TensorMap, tx::TensorMap, α::Number)
51-
space(ty) == space(tx) || throw(SpaceMismatch("$(space(ty))$(space(tx))"))
51+
space(ty) == space(tx) || throw(SpaceMismatch(lazy"$(space(ty)) ≠ $(space(tx))"))
5252
scale!(ty.data, tx.data, α)
5353
return ty
5454
end
@@ -66,7 +66,7 @@ end
6666
# TODO: remove VectorInterface from calls to `add!` when `TensorKit.add!` is renamed
6767
function VectorInterface.add(ty::AbstractTensorMap, tx::AbstractTensorMap, α::Number, β::Number)
6868
S = check_spacetype(ty, tx)
69-
space(ty) == space(tx) || throw(SpaceMismatch("$(space(ty))$(space(tx))"))
69+
space(ty) == space(tx) || throw(SpaceMismatch(lazy"$(space(ty)) ≠ $(space(tx))"))
7070

7171
# result type defaults to TensorMap if the types don't match to avoid assymmetric
7272
# implementation via zerovector(ty, T) vs zerovector(tx, T)
@@ -84,7 +84,7 @@ end
8484
function VectorInterface.add!(
8585
ty::AbstractTensorMap, tx::AbstractTensorMap, α::Number, β::Number
8686
)
87-
space(ty) == space(tx) || throw(SpaceMismatch("$(space(ty))$(space(tx))"))
87+
space(ty) == space(tx) || throw(SpaceMismatch(lazy"$(space(ty)) ≠ $(space(tx))"))
8888
for ((cy, by), (cx, bx)) in zip(blocks(ty), blocks(tx))
8989
add!(by, bx, α, β)
9090
end
@@ -93,7 +93,7 @@ end
9393
function VectorInterface.add!(
9494
ty::TensorMap, tx::TensorMap, α::Number, β::Number
9595
)
96-
space(ty) == space(tx) || throw(SpaceMismatch("$(space(ty))$(space(tx))"))
96+
space(ty) == space(tx) || throw(SpaceMismatch(lazy"$(space(ty)) ≠ $(space(tx))"))
9797
add!(ty.data, tx.data, α, β)
9898
return ty
9999
end
@@ -112,7 +112,7 @@ end
112112
# inner
113113
#-------
114114
function VectorInterface.inner(tx::AbstractTensorMap, ty::AbstractTensorMap)
115-
space(tx) == space(ty) || throw(SpaceMismatch("$(space(tx))$(space(ty))"))
115+
space(tx) == space(ty) || throw(SpaceMismatch(lazy"$(space(tx)) ≠ $(space(ty))"))
116116
InnerProductStyle(tx) === EuclideanInnerProduct() || throw_invalid_innerproduct(:inner)
117117
T = VectorInterface.promote_inner(tx, ty)
118118
s = zero(T)
@@ -122,7 +122,7 @@ function VectorInterface.inner(tx::AbstractTensorMap, ty::AbstractTensorMap)
122122
return s
123123
end
124124
function VectorInterface.inner(tx::TensorMap, ty::TensorMap)
125-
space(tx) == space(ty) || throw(SpaceMismatch("$(space(tx))$(space(ty))"))
125+
space(tx) == space(ty) || throw(SpaceMismatch(lazy"$(space(tx)) ≠ $(space(ty))"))
126126
InnerProductStyle(tx) === EuclideanInnerProduct() || throw_invalid_innerproduct(:inner)
127127
if FusionStyle(sectortype(tx)) isa UniqueFusion # all quantum dimensions are one
128128
return inner(tx.data, ty.data)

0 commit comments

Comments
 (0)