MADNESS 0.10.1
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< T > compute_range (const Tensor< T > &columnspace, const Tensor< T > &rowspace, const double &eps)
 compute the range of the matrix given in decomposed form
Tensor< T > compute_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< T > get_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< T > make_SVD_decaying_matrix (const Tensor< T > &matrix, const int n=1)
 helper function
static Tensor< T > resize_to_matrix (const Tensor< T > &matrix, std::array< long, 2 > vectordim={0, 0})
 resize Tensor to a matrix

Private Member Functions

Tensor< T > do_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< T > range =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

References maxrank, and oversampling.

◆ 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>
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(), 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(), do_compute_range(), MADNESS_ASSERT, maxrank, madness::BaseTensor::ndim(), Q(), range, 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 do_compute_range(), maxrank, madness::Tensor< T >::normf(), range, and resize_to_matrix().

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

◆ do_compute_range()

◆ exceeds_maxrank()

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

check if the computed rank is too large

References maxrank, and range.

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

◆ get_range()

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

References range.

Referenced by test_stuff().

◆ make_SVD_decaying_matrix()

template<typename T>
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>
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

References maxrank.

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

Referenced by RandomizedMatrixDecomposition(), and do_compute_range().

◆ range

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

the range that spans the input matrix

Referenced by RandomizedMatrixDecomposition(), check_range(), compute_range(), compute_range(), exceeds_maxrank(), and get_range().


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