SyTen
dense_convenience.h File Reference

Convenience functions for dense tensors, to be included by dense.h. More...

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

Namespaces

 syten
 Syten namespace.
 

Functions

template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type syten::abs (DenseTensor< rank, Scalar > const &a)
 \( \sqrt{\sum_k A_k * \textrm{conj}(A_k)} = \sqrt{\textrm{absSqd(A)}} \), see absSqd() More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type syten::absSqd (DenseTensor< rank, Scalar > const &a)
 \( \sum_k A_k * \textrm{conj}(A_k) \) More...
 
template<Rank rank, typename Scalar >
void syten::addScaled (DenseTensor< rank, Scalar > &a, DenseTensor< rank, Scalar > const &b, typename IdentityType< Scalar >::type const factor, EliminateZeros const ezeros)
 \( A_i \leftarrow A_i + f B_i \), adds b scaled by factor to a, if ezeros = EliminateZeros::Yes, eliminates resulting near-zeros. More...
 
template<Rank rank, typename Scalar >
std::pair< std::size_t, typename ScalarBase< Scalar >::type > syten::avgAbs (DenseTensor< rank, Scalar > const &a)
 Returns the sum of the absolute values and the number of non-zero entries in the tensor. More...
 
template<typename NewScalar , Rank rank, typename OldScalar >
DenseTensor< rank, NewScalar > syten::change_type (DenseTensor< rank, OldScalar > const &in)
 Change scalar type of tensor. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > syten::clip (DenseTensor< rank, Scalar > in, typename ScalarBase< Scalar >::type t)
 Clips all elements of the dense tensor below the given threshold to zero. More...
 
template<typename Scalar >
Scalar syten::getEigenvalue (DenseTensor< 2, Scalar > const &o, DenseTensor< 1, Scalar > const &v)
 Returns the eigenvalue of the specified eigenvector relative to the specified matrix. More...
 
template<typename Scalar >
std::vector< DenseTensor< 1, Scalar > > syten::hsplit (DenseTensor< 2, Scalar > const &matrix)
 \( R[j]_i = in_{ij} \), horizontally splits a matrix into column vectors More...
 
template<typename Scalar >
DenseTensor< 2, Scalar > syten::hstack (std::vector< DenseTensor< 1, Scalar > > const &list)
 \( R_{ij} = v[j]_i \), horizontally stacks vectors into a matrix More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank+1, Scalar > syten::insertDummy (DenseTensor< rank, Scalar > const &in, Index which)
 Inserts an additional dummy leg as the one-indexed which dense tensor leg. More...
 
template<Rank rank, typename Scalar >
std::tuple< ParallelKind, typename ScalarBase< Scalar >::type, typename ScalarBase< Scalar >::type > syten::isParallel (DenseTensor< rank, Scalar > const &a, DenseTensor< rank, Scalar > const &b)
 Checks if two tensors are parallel, i.e. \( a_i = c \; b_i \quad \forall i \). More...
 
template<typename Scalar >
std::pair< ParallelKind, Scalar > syten::isParallel_highPrec (DenseTensor< 1, Scalar > const &a, DenseTensor< 1, Scalar > const &b)
 Checks if two vectors are parallel with very high sensitivity and requiring the factor to be of magnitude between 1e-3 and 1e3. More...
 
template<Rank rank, typename Scalar >
bool syten::isZero (DenseTensor< rank, Scalar > const &a)
 Returns true iff all elements of a are identically zero. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, std::complex< typename ScalarBase< Scalar >::type > > syten::make_complex (DenseTensor< rank, Scalar > const &in)
 Returns a tensor of the complexified real base type of in. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type syten::max (DenseTensor< rank, Scalar > const &a)
 Returns the element with the greatest magnitude in the dense tensor. More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type syten::norm (DenseTensor< rank, Scalar > const &a)
 \( |a| = \textrm{abs}(a) \), see abs() More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type syten::normSqd (DenseTensor< rank, Scalar > const &a)
 \( |a|^2 = \textrm{absSqd}(a) \), see absSqd() More...
 
template<Rank rank, typename Scalar >
ScalarBase< Scalar >::type syten::nz_abs (DenseTensor< rank, Scalar > const &a)
 Returns the sum of the absolutes of the non-zero elements. More...
 
template<typename Scalar >
DenseTensor< 1, Scalar > syten::orthogonalise (DenseTensor< 1, Scalar > const &a, DenseTensor< 1, Scalar > const &b)
 \( R_i = A_i - \langle A|B \rangle/\langle B|B\rangle \cdot B_i \) More...
 
template<typename Scalar >
void syten::orthogonalise_inplace (DenseTensor< 1, Scalar > &a, DenseTensor< 1, Scalar > const &b)
 \( A_i \gets A_i - \langle A|B \rangle/\langle B|B\rangle \cdot B_i \) (in-place) More...
 
template<typename Scalar >
DenseTensor< 1, Scalar > syten::orthonormalise (DenseTensor< 1, Scalar > const &a, DenseTensor< 1, Scalar > const &b)
 \( R_i = A_i - \langle A|B \rangle/\langle B|B\rangle \cdot B_i ; \quad R_i = R_i / |R| \) More...
 
template<Rank rank, typename Scalar >
std::pair< Index, typename ScalarBase< Scalar >::type > syten::partial_abs (DenseTensor< rank, Scalar > const &a, std::array< Index, rank > const &allowed_entries)
 Calculates the partial sum of absolute values of entries. More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, Scalar > syten::real (DenseTensor< rank, Scalar > const &in)
 Returns the real part of the real DynArray in More...
 
template<Rank rank, typename Scalar >
DenseTensor< rank, typename ScalarBase< Scalar >::type > syten::real (DenseTensor< rank, std::complex< Scalar > > const &in)
 Returns the real part of the complex dense tensor in More...
 
template<typename Scalar >
Scalar syten::trace (DenseTensor< 2, Scalar > const &a)
 \( \sum_k A_{kk} \) More...
 
template<typename Scalar >
std::vector< DenseTensor< 1, Scalar > > syten::vsplit (DenseTensor< 2, Scalar > const &matrix)
 \( R[i]_j = in_{ij} \), vertically splits a matrix into row vectors More...
 
template<typename Scalar >
DenseTensor< 2, Scalar > syten::vstack (std::vector< DenseTensor< 1, Scalar > > const &list)
 \( R_{ij} = v[i]_j \), vertically stacks vectors into a matrix More...
 

Detailed Description

Convenience functions for dense tensors, to be included by dense.h.