1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-26 09:00:28 +01:00

in reconstruct: accumulate to a single matrix

This commit is contained in:
Marek Kaluba 2024-02-19 18:39:01 +01:00
parent c7491f37f9
commit 3b9c75604c
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -12,10 +12,9 @@ function reconstruct(
wbdec::SW.WedderburnDecomposition, wbdec::SW.WedderburnDecomposition,
) )
n = __outer_dim(wbdec) n = __outer_dim(wbdec)
res = sum(zip(Ms, SW.direct_summands(wbdec))) do (M, ds) res = zeros(eltype(first(Ms)), n, n)
res = similar(M, n, n) for (M, ds) in zip(Ms, SW.direct_summands(wbdec))
res = _reconstruct!(res, M, ds) res = _reconstruct!(res, M, ds)
return res
end end
res = average!(zero(res), res, __group_of(wbdec), wbdec.hom) res = average!(zero(res), res, __group_of(wbdec), wbdec.hom)
return res return res
@ -26,11 +25,10 @@ function _reconstruct!(
M::AbstractMatrix, M::AbstractMatrix,
ds::SW.DirectSummand, ds::SW.DirectSummand,
) )
res .= zero(eltype(res))
if !iszero(M) if !iszero(M)
U = SW.image_basis(ds) U = SW.image_basis(ds)
d = SW.degree(ds) d = SW.degree(ds)
res = (U' * M * U) .* d res .+= (U' * M * U) .* d
end end
return res return res
end end