SyTen

◆ expansion() [1/2]

template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > syten::expansion ( DenseTensor< rank, Scalar > const &  a,
DenseTensor< rank, Scalar > const &  b,
std::array< Index, rank > const &  w 
)
inline

Tensor-sums a and b together along the dimensions which have non-zero entries in which.

That is,

r_{i_1 i_2 i_3...} = [ a_{i_1 i_2 i_3...} if for all x in [1...rank] with w[x] != 0, i_x <= a.dim(x) b_{i_1-a.dim(1), i_2-a.dim(2), i_3 - a.dim(3)...} if for all x in [1...rank] with w[x] != 0, i_x > a.dim(x) 0 otherwise ]

if w[x] != 0, then r.dim(x) = a.dim(x) + b.dim(x)

if w[x] == 0, then r.dim(x) = a.dim(x) = b.dim(x)

e.g.:

a = [ 1 2 3 ] b = [ 7 8 9 ] expansion(a,b,{0,1}) = [ 1 2 3 7 8 9 ] [ 4 5 6 ] [ x y z ] [ 4 5 6 x y z ]

expansion(a,b,{1,0}) = [ 1 2 3 ] expansion(a,b,{1,1}) = [ 1 2 3 0 0 0 ] [ 4 5 6 ] [ 4 5 6 0 0 0 ] [ 7 8 9 ] [ 0 0 0 7 8 9 ] [ x y z ] [ 0 0 0 x y z ]

References syten::DenseTensor< rank, Scalar >::dim(), syten::DenseTensor< rank, Scalar >::getDims(), rank(), and SYTEN_ASSERT_DEBUG.

Referenced by syten::MPS::addScaled(), dense(), syten::MPS::DMRG::Worker::expand_to_left(), syten::MPS::expand_to_left(), syten::MPS::DMRG::Worker::expand_to_right(), syten::MPS::expand_to_right(), expansion(), syten::MPS::ChemHelper::genMPO(), syten::T3N::ChemHelper::genMPO(), syten::MPS::DMRG::Worker::gse_create_expanded(), syten::MPS::TDVP::Worker::gse_create_expanded(), and syten::MPS::TDVP::Worker::locally_expand_bond().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: