SyTen
tensor_misc.h File Reference

Various functions acting on Tensor. More...

+ Include dependency graph for tensor_misc.h:
+ This graph shows which files directly or indirectly include this file:

Namespaces

namespace  syten
 Syten namespace.
 

Functions

template<Rank rank>
void syten::addScaled (Tensor< rank > &a, Tensor< rank > const &b, SDef const s)
 Adds the tensor b, scaled by the scalar prefactor s to the tensor a, essentially a fused-multiply-add for Tensor. More...
 
template<Rank rank>
SRDef syten::avgAbs (Tensor< rank > const &a)
 Returns the average of the absolute values of the non-zero entries in the tensor. More...
 
template<typename... Args>
void syten::clear (Args &&... args)
 Calls .clear() on all supplied arguments. More...
 
template<Rank rank>
Tensor< rank > syten::clip (Tensor< rank > in, SRDef t)
 Clips all elements of the dense tensor blocks below the given threshold to zero; useful for displaying purposes. More...
 
template<Rank rank>
bool syten::compat_exact_equal (Tensor< rank > const &a, Tensor< rank > const &b)
 Returns true if both tensors are compatible on every leg and their difference has norm zero. More...
 
template<Rank rank>
Tensor< rank > syten::conj (Tensor< rank > in)
 Complex-conjugates the tensor, inverting tensor directions and complex-conjugating all dense tensors. More...
 
Vec< SDef > syten::diagonal (Tensor< 2 > const &m, bool const order=true)
 Returns a vector of diagonal values, repeated according to the multiplicities of the tensor blocks. More...
 
template<>
Tensor< 0 > syten::dropDummy (Tensor< 1 > const &in, Index const which)
 Specialisation for a rank-1 tensor which asserts dummyness and then uses trace to obtain the value. More...
 
template<Rank rank>
Tensor< rank-1 > syten::dropDummy (Tensor< rank > const &in, Index const which)
 Removes (drops) a dummy leg from the tensor. More...
 
template<Rank rank>
Tensor< rank > syten::expansion (Tensor< rank > const &a, Tensor< rank > const &b, ConstSpan< Index > const &w)
 Combines the two tensors a and b into a new tensor. More...
 
void syten::herm (Tensor< 2 > &m)
 Transpose and complex conjugate a matrix in place. More...
 
template<Rank rank>
Tensor< rank+1 > syten::insertDummy (Tensor< rank > const &a, Basis const &vacuum, Index const which)
 Inserts an additional dummy leg transforming as vacuum as the which-th leg of the new tensor. More...
 
SRDef syten::invertDiagonal (Tensor< 2 > &m)
 Inverts a rank-two tensor in-place by inverting all reduced dense and CGC-space sparse blocks. More...
 
template<Rank rank>
SRDef syten::max (Tensor< rank > const &a)
 Returns the element with the greatest magnitude. More...
 
template<Rank rank>
Tensor< rank > syten::multi_transpose (Tensor< rank > m, ConstSpan< Index > const &perm, Conj conjugate=Conj::n())
 Returns a transposed copy of the input tensor. More...
 
template<Rank rank>
Tensor< rank > syten::project (Tensor< rank > const &in, Basis const &b, Index leg, bool nowarn=false)
 Returns the tensor with its leg'th index projected onto the specified basis, i.e. all blocks not in that basis removed and those in it shrunk to match the size specified in the basis. More...
 
Tensor< 2 > syten::sqrt (Tensor< 2 > inp)
 Returns the square root of the diagonal input matrix. More...
 
SDef syten::trace (Tensor< 1 > const &a)
 Calculates the trace of a rank-1 tensor. More...
 
SDef syten::trace (Tensor< 2 > const &a)
 Calculates the trace of a rank-2 tensor. More...
 
void syten::transpose (Tensor< 2 > &m)
 Transpose a matrix in place. More...
 
template<Rank rank>
void syten::transpose_exchange (Tensor< rank > &m, std::array< Index, 2 > const axes, bool const conjugate=false)
 Transposes the specified legs of the tensor. More...
 
template<typename Base >
void syten::validateTensorEdge (Base const &, Index const, Rank const, bool const =false)
 Validates that the supplied tensor is a valid edge tensor of a MPS or MPO. More...
 
SRDef syten::von_neumann_entropy (Tensor< 2 > const &s)
 Calculates the von Neumann entropy \( \sum_i s_{ii}^2 \mathrm{log}(s_{ii}^2) \). More...
 
template<Rank rank>
void syten::zeroExpand (Tensor< rank > &a, Index which, Basis const &basis, bool const relaxed=false)
 Zero-pads a tensor a along the specified leg which to contain the basis basis. More...
 

Detailed Description

Various functions acting on Tensor.