◆ reduce()

template<Rank rank>
void syten::Tensor< rank >::reduce ( EliminateZeros const  ezeros = EliminateZeros::Yes,
bool const  add_cgc = false,
bool const  no_para = false,
bool const  no_zero_check_dense = false 

Reduce the number of blocks in the tensor by adding parallel blocks together.

Discards zero-blocks (i.e. blocks where norm(reduced) or norm(cgc) is smaller than SYTEN_ZNORM_THRESHOLD).

When building a tensor from many blocks, first push_back() all blocks and then call reduce() to minimise the overhead from comparisons.

ezerosif EliminateZeros::Yes, small tensors arising from large tensors will be removed
add_cgcif true, CGC spaces will be added together if the dense spaces are parallel
no_paraif true, tensor-level parallelisation will be disabled
no_zero_check_denseif true, assumes that dense tensors are never zero unless isZero is set on the block (true e.g. for products)

Finally, in every bin, check all blocks left over. If they are sufficiently large, move them into *this, otherwise drop them.

References std::begin(), syten::checkedAddParallel(), syten::clear(), syten::isZero(), syten::STensorImpl::log2(), std::move(), syten::pow(), syten::sqrt(), SYTEN_ASSERT, SYTEN_WARN_MSG, SYTEN_ZNORM_THRESHOLD_SQD, syten::tensorSortBuckets(), and syten::underThreshold().

Referenced by syten::addScaled(), syten::Deparallelise::cols(), syten::Delinearise::cols(), syten::exponentialTensorGen(), syten::exponentialTensorSym(), syten::MPS::Lat::U1U1::genFermiBoseLattice(), syten::MPS::Lat::SU2Fermion::genFermiHubbardSU2(), syten::MPS::ChemHelper::genMPO(), syten::T3N::ChemHelper::genMPO(), syten::MPS::Lat::genParity(), syten::MPS::Lat::genSU2Parity(), syten::MPS::left_complement(), syten::IPEPS::ATwoOp::operator+=(), syten::operator+=(), syten::operator-=(), syten::project(), syten::MPS::right_complement(), syten::Deparallelise::rows(), syten::SVD::svd(), syten::MPS::ChemHelper::tensorElem(), and syten::T3N::ChemHelper::tensorElem().

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