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
11 changes: 5 additions & 6 deletions src/clebschgordan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -357,26 +357,25 @@ function cref!(
)
nr, nc = size(A)
i = j = 1
# rows with entries below `ɛ` are not used as pivots, but are kept: as only column operations
# are applied to all rows, the columns of `A` keep spanning the same space
@inbounds while i <= nr && j <= nc
(m, mj) = findabsmax(view(A, i, j:nc))
mj = mj + j - 1
if m <= ɛ
if ɛ > 0
A[i, j:nc] .= zero(eltype(A))
end
i += 1
else
@simd for k in i:nr
@simd for k in 1:nr
A[k, j], A[k, mj] = A[k, mj], A[k, j]
end
d = A[i, j]
@simd for k in i:nr
@simd for k in 1:nr
A[k, j] /= d
end
for k in 1:nc
if k != j
d = A[i, k]
@simd for l in i:nr
@simd for l in 1:nr
A[l, k] -= d * A[l, j]
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/clebschgordan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ using SUNRepresentations: annihilation
using SparseArrayKit: nonzero_values

# for SU(2), the CGCs are known exactly: compare with those of SU2Irrep, which has the opposite
# basis order, up to an overall sign
# basis order, up to an overall sign (the largest spins have highest-weight CGCs below `TOL_GAUGE`)
@testset "SU(2) CGCs for large spins" begin
for (n1, n2, n3) in ((40, 40, 20), (80, 80, 80), (80, 41, 61))
for (n1, n2, n3) in ((40, 40, 20), (80, 80, 80), (80, 41, 61), (200, 200, 200), (250, 120, 200))
s1, s2, s3 = SUNIrrep{2}(n1, 0), SUNIrrep{2}(n2, 0), SUNIrrep{2}(n3, 0)
C = Array(CGC(Float64, s1, s2, s3))
ref = fusiontensor(SU2Irrep(n1 // 2), SU2Irrep(n2 // 2), SU2Irrep(n3 // 2))
Expand Down
Loading