xerus
a general purpose tensor library
tensor.cpp File Reference

Implementation of the Tensor class. More...

#include <xerus/tensor.h>
#include <xerus/misc/check.h>
#include <xerus/misc/containerSupport.h>
#include <xerus/misc/basicArraySupport.h>
#include <xerus/misc/math.h>
#include <xerus/misc/internal.h>
#include <xerus/blasLapackWrapper.h>
#include <xerus/cholmod_wrapper.h>
#include <xerus/sparseTimesFullContraction.h>
#include <xerus/index.h>
#include <xerus/tensorNetwork.h>
#include <fstream>
#include <iomanip>

Go to the source code of this file.

Namespaces

 xerus
 The main namespace of xerus.
 
 xerus::misc
 Collection of classes and functions that provide elementary functionality that is not special to xerus as a tensor library.
 

Functions

bool xerus::approx_entrywise_equal (const xerus::Tensor &_a, const xerus::Tensor &_b, const xerus::value_t _eps=EPSILON)
 Checks whether two Tensors are approximately entrywise equal. More...
 
bool xerus::approx_entrywise_equal (const xerus::Tensor &_tensor, const std::vector< value_t > &_values, const xerus::value_t _eps=EPSILON)
 Compares the given Tensor entriewise to the given data. More...
 
bool xerus::approx_equal (const xerus::Tensor &_a, const xerus::Tensor &_b, const xerus::value_t _eps=EPSILON)
 Checks whether two tensors are approximately equal. More...
 
void xerus::calculate_cq (Tensor &_C, Tensor &_Q, Tensor _input, const size_t _splitPos)
 Low-Level CQ calculation of a given Tensor _input = _C _Q. More...
 
XERUS_force_inline std::tuple< size_t, size_t, size_t > xerus::calculate_factorization_sizes (const Tensor &_input, const size_t _splitPos)
 
void xerus::calculate_qc (Tensor &_Q, Tensor &_C, Tensor _input, const size_t _splitPos)
 Low-Level QC calculation of a given Tensor _input = _Q _C. More...
 
void xerus::calculate_qr (Tensor &_Q, Tensor &_R, Tensor _input, const size_t _splitPos)
 Low-Level QR calculation of a given Tensor _input = _Q _R. More...
 
void xerus::calculate_rq (Tensor &_R, Tensor &_Q, Tensor _input, const size_t _splitPos)
 Low-Level RQ calculation of a given Tensor _input = _R _Q. More...
 
void xerus::calculate_svd (Tensor &_U, Tensor &_S, Tensor &_Vt, Tensor _input, const size_t _splitPos, const size_t _maxRank, const value_t _eps)
 Low-Level SVD calculation of a given Tensor _input = _U _S _Vt. More...
 
void xerus::contract (Tensor &_result, const Tensor &_lhs, const bool _lhsTrans, const Tensor &_rhs, const bool _rhsTrans, const size_t _numModes)
 Low-level contraction between Tensors. More...
 
Tensor xerus::contract (const Tensor &_lhs, const bool _lhsTrans, const Tensor &_rhs, const bool _rhsTrans, const size_t _numModes)
 
Tensor xerus::entrywise_product (const Tensor &_A, const Tensor &_B)
 calculates the entrywise product of two Tensors More...
 
std::vector< size_t > xerus::get_step_sizes (const Tensor::DimensionTuple &_dimensions)
 
Tensor xerus::operator* (const value_t _factor, Tensor _tensor)
 Calculates the entrywise multiplication of the Tensor _tensor with the constant _factor. More...
 
Tensor xerus::operator* (Tensor _tensor, const value_t _factor)
 Calculates the entrywise multiplication of the Tensor _tensor with the constant _factor. More...
 
Tensor xerus::operator+ (Tensor _lhs, const Tensor &_rhs)
 Calculates the entrywise sum of _lhs and _rhs. More...
 
Tensor xerus::operator- (Tensor _lhs, const Tensor &_rhs)
 Calculates the entrywise difference between _lhs and _rhs. More...
 
Tensor xerus::operator/ (Tensor _tensor, const value_t _divisor)
 Calculates the entrywise divison of the Tensor _tensor with the constant _divisor. More...
 
std::ostream & xerus::operator<< (std::ostream &_out, const Tensor &_tensor)
 Prints the Tensor to the given outStream. More...
 
XERUS_force_inline void xerus::prepare_factorization_output (Tensor &_lhs, Tensor &_rhs, const Tensor &_input, const size_t _splitPos, const size_t _rank, Tensor::Representation _rep)
 
void xerus::pseudo_inverse (Tensor &_inverse, const Tensor &_input, const size_t _splitPos)
 Low-Level calculation of the pseudo inverse of a given Tensor. More...
 
Tensor xerus::pseudo_inverse (const Tensor &_input, const size_t _splitPos)
 
XERUS_force_inline void xerus::set_factorization_output (Tensor &_lhs, std::unique_ptr< value_t[]> &&_lhsData, Tensor &_rhs, std::unique_ptr< value_t[]> &&_rhsData, const Tensor &_input, const size_t _splitPos, const size_t _rank)
 
XERUS_force_inline void xerus::set_factorization_output (Tensor &_lhs, std::map< size_t, value_t > &&_lhsData, Tensor &_rhs, std::map< size_t, value_t > &&_rhsData, const Tensor &_input, const size_t _splitPos, const size_t _rank)
 
void xerus::solve (Tensor &_X, const Tensor &_A, const Tensor &_B, size_t _extraDegree=0)
 Solves the equation Ax = b for x. If the solution is not unique, the output need not be the minimal norm solution. More...
 
void xerus::solve_least_squares (Tensor &_X, const Tensor &_A, const Tensor &_B, const size_t _extraDegree=0)
 Solves the least squares problem ||_A _X - _B||_F. More...
 
void xerus::misc::stream_reader (std::istream &_stream, Tensor &_obj, const FileFormat _format)
 tries to restore the tensor from a stream of data. More...
 
void xerus::misc::stream_writer (std::ostream &_stream, const Tensor &_obj, const FileFormat _format)
 pipes all information necessary to restore the current tensor into _stream. More...
 

Detailed Description

Implementation of the Tensor class.

Definition in file tensor.cpp.