Skip to content

Commit

Permalink
Fix spaces in truncated svd to non-dual
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Jul 1, 2024
1 parent 6f18e40 commit 39f39ff
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/tensors/factorizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,21 +428,13 @@ function _tsvd!(t, alg::Union{SVD,SDD}, trunc::TruncationScheme, p::Real=2)

S = spacetype(t)
Udata, Σdata, Vdata, dims = _compute_svddata!(t, alg)
if !isa(trunc, NoTruncation)
if trunc isa NoTruncation
truncerr = abs(zero(scalartype(t)))
else
Σdata, truncerr = _truncate!(Σdata, trunc, p)
Udata, Σdata, Vdata, dims = _implement_svdtruncation!(t, Udata, Σdata, Vdata, dims)
W = S(dims)
else
truncerr = abs(zero(scalartype(t)))
W = S(dims)
# TODO: do we really want this behaviour? this changes the arrows of the S legs, but
# only sometimes?
if length(domain(t)) == 1 && domain(t)[1] W
W = domain(t)[1]
elseif length(codomain(t)) == 1 && codomain(t)[1] W
W = codomain(t)[1]
end
end
W = S(dims)
return _create_svdtensors(t, Udata, Σdata, Vdata, W)..., truncerr
end

Expand Down

0 comments on commit 39f39ff

Please sign in to comment.