xerus
a general purpose tensor library
tensor.h File Reference

Header file for the Tensor class. More...

#include <map>
#include <limits>
#include <memory>
#include <random>
#include <functional>
#include "basic.h"
#include "misc/containerSupport.h"
#include "misc/fileIO.h"
#include "misc/random.h"
#include "indexedTensor.h"

Go to the source code of this file.

Classes

class  xerus::Tensor
 Class that handles simple (non-decomposed) tensors in a dense or sparse representation. More...
 

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...
 
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)
 
XERUS_force_inline void xerus::contract (Tensor &_result, const Tensor &_lhs, const Tensor &_rhs, const size_t _numModes)
 Low-level contraction between Tensors. More...
 
XERUS_force_inline Tensor xerus::contract (const Tensor &_lhs, const Tensor &_rhs, const size_t _numModes)
 
Tensor xerus::entrywise_product (const Tensor &_A, const Tensor &_B)
 calculates the entrywise product of two Tensors More...
 
static XERUS_force_inline value_t xerus::frob_norm (const Tensor &_tensor)
 Calculates the frobenius norm of the given tensor. More...
 
static XERUS_force_inline value_t xerus::one_norm (const Tensor &_tensor)
 Calculates the 1-norm of the given tensor. More...
 
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...
 
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)
 
void xerus::reshuffle (Tensor &_out, const Tensor &_base, const std::vector< size_t > &_shuffle)
 : Performs a simple reshuffle. Much less powerfull then a full evaluate, but more efficient. More...
 
Tensor xerus::reshuffle (const Tensor &_base, const std::vector< size_t > &_shuffle)
 
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

Header file for the Tensor class.

Definition in file tensor.h.