838838# no permute tests: NoBraiding()
839839
840840@timedtestset " Tensors with symmetry involving $Istr ($i , $j )" verbose = true for i in 1 : r, j in 1 : r
841- # TODO : refactor isdiag check
841+ isdiag = i == j
842842
843843 VC = (Vect[I]((i, i, label) => 1 for label in 1 : MTK. _numlabels (I, i, i)),
844844 Vect[I](one (I (i, i, 1 )) => 1 , rand_object (I, i, i) => 1 ), # avoids OOMs?
@@ -863,12 +863,12 @@ end
863863 Vect[I](one (I (j, j, 1 )) => 2 , rand_object (I, j, j) => 1 )
864864 )
865865
866- Vcol = i != j ? (VM1, VM2 ) : (VC,) # avoid duplicate runs
866+ Vcol = isdiag ? (VC, ) : (VM1, VM2) # avoid duplicate runs
867867
868868 for V in Vcol # TODO : add enumerate to keep track of potential erroring space
869869 V1, V2, V3, V4, V5 = V
870870 @timedtestset " Basic tensor properties" begin
871- W = i == j ? V1 ⊗ V2 ⊗ V3 ⊗ V4 ⊗ V5 : V3 ⊗ V4 ⊗ V5 # fusion matters
871+ W = isdiag ? V1 ⊗ V2 ⊗ V3 ⊗ V4 ⊗ V5 : V3 ⊗ V4 ⊗ V5 # fusion matters
872872 for T in (Int, Float32, Float64, ComplexF32, ComplexF64, BigFloat)
873873 t = @constinferred zeros (T, W) # empty for i != j b/c blocks are module-graded
874874 @test @constinferred (hash (t)) == hash (deepcopy (t))
@@ -1150,7 +1150,6 @@ end
11501150 @timedtestset " Tensor product: test via tensor contraction" begin
11511151 # W = V3 ⊗ V4 ⊗ V5 ← V1 ⊗ V2
11521152 W = V4 ← V1 ⊗ V2 # less costly
1153- isdiag = all (a. i == a. j for a in blocksectors (W))
11541153 for T in (Float32, ComplexF64)
11551154 if ! isdiag
11561155 t1 = rand (T, W)
@@ -1196,12 +1195,12 @@ end
11961195
11971196 @timedtestset " Factorization" for V in fact_Vs
11981197 V1, V2, V3, V4, V5 = V
1198+ # TODO : try ifelse/?: here
11991199 WL = V3 ⊗ V4 ⊗ V2 ← V1' ⊗ V5' # old left permute resulted in this space
12001200 WR = V3 ⊗ V4 ← V2' ⊗ V1' ⊗ V5' # old right permute
12011201 WmodR = V1 ⊗ V2 ← V3 ⊗ V4 ⊗ V5 # new fusion order for right
12021202 WmodL = V1 ⊗ V2 ⊗ V5' ← V3 ⊗ V4 # new fusion order for left
12031203
1204- isdiag = all (c. i == c. j for c in blocksectors (WmodR)) # this blocksectors call should always work #TODO : can't this just be i == j?
12051204 for T in (Float32, ComplexF64)
12061205 # Test both a normal tensor and an adjoint one.
12071206 # adjoint takes other space for shape of matrix in RQ(pos)
0 commit comments