MADNESS 0.10.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
madness::RandomizedMatrixDecomposition< T > Class Template Reference

#include <RandomizedMatrixDecomposition.h>

Classes

struct  Y_former
 functor for forming Y = matrix * randomvector More...
 

Public Types

typedef TensorTypeData< T >::scalar_type scalar_type
 

Public Member Functions

 RandomizedMatrixDecomposition ()=default
 
 RandomizedMatrixDecomposition (const RandomizedMatrixDecomposition &other)=default
 
 RandomizedMatrixDecomposition (const RMDFactory &factory)
 
 RandomizedMatrixDecomposition (const Tensor< T > &matrix, const double thresh)
 
Tensor< Tcompute_range (const Tensor< T > &columnspace, const Tensor< T > &rowspace, const double &eps)
 compute the range of the matrix given in decomposed form
 
Tensor< Tcompute_range (const Tensor< T > &tensor, const double &eps, std::array< long, 2 > matrixdim={0, 0})
 compute the range of the matrix
 
bool exceeds_maxrank () const
 check if the computed rank is too large
 
Tensor< Tget_range () const
 
void set_maxrank (const long max_rank)
 

Static Public Member Functions

static scalar_type check_range (const Tensor< T > &matrix, const Tensor< T > &range)
 return the error of the range Q
 
static Tensor< Tmake_SVD_decaying_matrix (const Tensor< T > &matrix, const int n=1)
 helper function
 
static Tensor< Tresize_to_matrix (const Tensor< T > &matrix, std::array< long, 2 > vectordim={0, 0})
 resize Tensor to a matrix
 

Private Member Functions

Tensor< Tdo_compute_range (const Y_former &Y, const double &eps) const
 perform the actual computation of the range
 

Private Attributes

long maxrank =LONG_MAX
 maximum rank to abort the decomposition
 
long oversampling =10
 oversampling parameter
 
Tensor< Trange =Tensor<T>(0l,0l)
 the range that spans the input matrix
 

Member Typedef Documentation

◆ scalar_type

template<typename T >
typedef TensorTypeData<T>::scalar_type madness::RandomizedMatrixDecomposition< T >::scalar_type

Constructor & Destructor Documentation

◆ RandomizedMatrixDecomposition() [1/4]

template<typename T >
madness::RandomizedMatrixDecomposition< T >::RandomizedMatrixDecomposition ( )
default

◆ RandomizedMatrixDecomposition() [2/4]

template<typename T >
madness::RandomizedMatrixDecomposition< T >::RandomizedMatrixDecomposition ( const RandomizedMatrixDecomposition< T > &  other)
default

◆ RandomizedMatrixDecomposition() [3/4]

template<typename T >
madness::RandomizedMatrixDecomposition< T >::RandomizedMatrixDecomposition ( const RMDFactory factory)
inline

◆ RandomizedMatrixDecomposition() [4/4]

template<typename T >
madness::RandomizedMatrixDecomposition< T >::RandomizedMatrixDecomposition ( const Tensor< T > &  matrix,
const double  thresh 
)
inline

Member Function Documentation

◆ check_range()

template<typename T >
static scalar_type madness::RandomizedMatrixDecomposition< T >::check_range ( const Tensor< T > &  matrix,
const Tensor< T > &  range 
)
inlinestatic

return the error of the range Q

explicitly compute the error measure || A - Q Q^T A ||

References madness::conj(), madness::inner(), madness::RandomizedMatrixDecomposition< T >::range, and residual().

Referenced by test_stuff().

◆ compute_range() [1/2]

template<typename T >
Tensor< T > madness::RandomizedMatrixDecomposition< T >::compute_range ( const Tensor< T > &  columnspace,
const Tensor< T > &  rowspace,
const double &  eps 
)

compute the range of the matrix given in decomposed form

see above; Matrix is given by A(i,j)=columnspace(r,i) * rowspace(r,j)

Parameters
[in]columnspacecolumnspace of the input tensor/matrix A
[in]rowspacerowspace of the input tensor/matrix A
[in]epsthe accuracy of the representation
Returns
range the range of the input tensor

References madness::BaseTensor::dim(), MADNESS_ASSERT, madness::BaseTensor::ndim(), Q(), and madness::BaseTensor::size().

◆ compute_range() [2/2]

template<typename T >
Tensor< T > madness::RandomizedMatrixDecomposition< T >::compute_range ( const Tensor< T > &  tensor,
const double &  eps,
std::array< long, 2 >  matrixdim = {0,0} 
)

compute the range of the matrix

compute the range of the matrix, following Alg 4.2 of Halko, Martinsson, Tropp, 2011

follows Halko, Martinsson, Tropp (2011), Alg. 4.2 the final range will satisfy for the input tensor A: || A - Q Q^T A || < eps method will change member variables "range" and "maxrank"

Parameters
[in]tensorthe input tensor/matrix A (see matrixdim if not a matrix)
[in]epsthe accuracy of the representation
[in]matrixdimhow to reshape the tensor if it is not a matrix
Returns
range the range of the input tensor

References madness::Tensor< T >::normf().

Referenced by madness::RandomizedMatrixDecomposition< T >::RandomizedMatrixDecomposition(), madness::SVDTensor< T >::compute_randomized_svd(), madness::SVDTensor< T >::orthonormalize_random(), and test_stuff().

◆ do_compute_range()

template<typename T >
Tensor< T > madness::RandomizedMatrixDecomposition< T >::do_compute_range ( const Y_former Y,
const double &  eps 
) const
private

◆ exceeds_maxrank()

template<typename T >
bool madness::RandomizedMatrixDecomposition< T >::exceeds_maxrank ( ) const
inline

◆ get_range()

template<typename T >
Tensor< T > madness::RandomizedMatrixDecomposition< T >::get_range ( ) const
inline

◆ make_SVD_decaying_matrix()

template<typename T >
static Tensor< T > madness::RandomizedMatrixDecomposition< T >::make_SVD_decaying_matrix ( const Tensor< T > &  matrix,
const int  n = 1 
)
inlinestatic

helper function

References madness::_(), madness::inner(), and madness::svd().

Referenced by test_stuff().

◆ resize_to_matrix()

template<typename T >
static Tensor< T > madness::RandomizedMatrixDecomposition< T >::resize_to_matrix ( const Tensor< T > &  matrix,
std::array< long, 2 >  vectordim = {0,0} 
)
inlinestatic

◆ set_maxrank()

template<typename T >
void madness::RandomizedMatrixDecomposition< T >::set_maxrank ( const long  max_rank)
inline

Member Data Documentation

◆ maxrank

template<typename T >
long madness::RandomizedMatrixDecomposition< T >::maxrank =LONG_MAX
private

◆ oversampling

template<typename T >
long madness::RandomizedMatrixDecomposition< T >::oversampling =10
private

oversampling parameter

◆ range

template<typename T >
Tensor<T> madness::RandomizedMatrixDecomposition< T >::range =Tensor<T>(0l,0l)
private

The documentation for this class was generated from the following files: