mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-19 15:25:29 +01:00
in reconstruct: average the sum, not sum the averages!
This commit is contained in:
parent
f9f852439f
commit
1a43a1b1be
@ -12,9 +12,10 @@ function reconstruct(
|
|||||||
n = __outer_dim(wbdec)
|
n = __outer_dim(wbdec)
|
||||||
res = sum(zip(Ms, SymbolicWedderburn.direct_summands(wbdec))) do (M, ds)
|
res = sum(zip(Ms, SymbolicWedderburn.direct_summands(wbdec))) do (M, ds)
|
||||||
res = similar(M, n, n)
|
res = similar(M, n, n)
|
||||||
res = _reconstruct!(res, M, ds, __group_of(wbdec), wbdec.hom)
|
res = _reconstruct!(res, M, ds)
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
res = average!(zero(res), res, __group_of(wbdec), wbdec.hom)
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -22,16 +23,14 @@ function _reconstruct!(
|
|||||||
res::AbstractMatrix,
|
res::AbstractMatrix,
|
||||||
M::AbstractMatrix,
|
M::AbstractMatrix,
|
||||||
ds::SymbolicWedderburn.DirectSummand,
|
ds::SymbolicWedderburn.DirectSummand,
|
||||||
G,
|
|
||||||
hom,
|
|
||||||
)
|
)
|
||||||
|
res .= zero(eltype(res))
|
||||||
|
if !iszero(M)
|
||||||
U = SymbolicWedderburn.image_basis(ds)
|
U = SymbolicWedderburn.image_basis(ds)
|
||||||
d = SymbolicWedderburn.degree(ds)
|
d = SymbolicWedderburn.degree(ds)
|
||||||
Θπ = (U' * M * U) .* d
|
res = (U' * M * U) .* d
|
||||||
|
end
|
||||||
res .= zero(eltype(res))
|
return res
|
||||||
Θπ = average!(res, Θπ, G, hom)
|
|
||||||
return Θπ
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function __droptol!(M::AbstractMatrix, tol)
|
function __droptol!(M::AbstractMatrix, tol)
|
||||||
@ -52,18 +51,18 @@ function average!(
|
|||||||
<:SymbolicWedderburn.ByPermutations,
|
<:SymbolicWedderburn.ByPermutations,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
res .= zero(eltype(res))
|
||||||
@assert size(M) == size(res)
|
@assert size(M) == size(res)
|
||||||
|
o = Groups.order(Int, G)
|
||||||
for g in G
|
for g in G
|
||||||
p = SymbolicWedderburn.induce(hom, g)
|
p = SymbolicWedderburn.induce(hom, g)
|
||||||
Threads.@threads for c in axes(res, 2)
|
Threads.@threads for c in axes(res, 2)
|
||||||
# note: p is a permutation,
|
|
||||||
# so accesses below are guaranteed to be disjoint
|
|
||||||
for r in axes(res, 1)
|
for r in axes(res, 1)
|
||||||
res[r^p, c^p] += M[r, c]
|
if !iszero(M[r, c])
|
||||||
|
res[r^p, c^p] += M[r, c] / o
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
o = Groups.order(Int, G)
|
|
||||||
res ./= o
|
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user