SBasisId const& root,
SBasisId const& p1,
Truncation const& trunc) {
auto [fused, fp] =
merge(t1t2,
root,
p1);
auto fused_norm =
snorm(fused);
auto [err, u, s, v, us_basis, sv_basis] =
svd(
std::move(fused),
fp,
Truncation(1.e-14).scaled(fused_norm));
return trace(s)/initial_costs;
}
GenericDenseTensor< srank-1, Scalar > merge(IdentityDenseTensor< 3, Scalar > const &a, DenseTensor< srank, Scalar > const &b, std::array< int, 3 > const &c_a, std::array< int, srank > const &c_b)
Product which merges two tensor legs together.
Definition: identity_prod.h:36
SRDef snorm(STensor const &t, SourceLocation const &loc)
Returns the norm of a tensor as a standard scalar.
Definition: stensor_prod.cpp:22
std::tuple< SRDef, STensor, STensor, STensor, SBasis, SBasis > svd(STensor const &in, SBasisId const &uncombined, Truncation const &trunc, DecompRescaleCGC const rescaleCGC, GaugeFixSVD gf, SourceLocation const &loc)
SVD decomposition for STensor.
Definition: stensor_decomps.cpp:153
Scalar trace(DenseTensor< 2, Scalar > const &a)
Definition: dense_convenience.h:24
SYTEN_SRDEF_TYPE SRDef
Real base of the scalar type used in generic tensors, useful for norms etc, see also Scalar types.
Definition: scalars.h:50
STensorImpl::STensor STensor
‘Smart’ tensor class.
Definition: stensor_base.h:556