irlba
A C++ library for IRLBA
Loading...
Searching...
No Matches
irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ > Class Template Referencefinal

Deferred scaling of a matrix. More...

#include <scaled.hpp>

Inheritance diagram for irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >:
Collaboration diagram for irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >:

Public Member Functions

 ScaledMatrix (const MatrixPointer_ &matrix, const ScalePointer_ &scale, bool column, bool divide)
 
Eigen::Index rows () const
 
Eigen::Index cols () const
 
std::unique_ptr< Workspace< EigenVector_ > > new_workspace () const
 
std::unique_ptr< AdjointWorkspace< EigenVector_ > > new_adjoint_workspace () const
 
std::unique_ptr< RealizeWorkspace< EigenMatrix_ > > new_realize_workspace () const
 
std::unique_ptr< ScaledWorkspace< EigenVector_, I< decltype(*my_matrix)>, I< decltype(*my_scale)> > > new_known_workspace () const
 
std::unique_ptr< ScaledAdjointWorkspace< EigenVector_, I< decltype(*my_matrix)>, I< decltype(*my_scale)> > > new_known_adjoint_workspace () const
 
std::unique_ptr< ScaledRealizeWorkspace< EigenMatrix_, I< decltype(*my_matrix)>, I< decltype(*my_scale)> > > new_known_realize_workspace () const
 
- Public Member Functions inherited from irlba::Matrix< EigenVector_, EigenMatrix_ >
std::unique_ptr< Workspace< EigenVector_ > > new_known_workspace () const
 
std::unique_ptr< AdjointWorkspace< EigenVector_ > > new_known_adjoint_workspace () const
 
std::unique_ptr< RealizeWorkspace< EigenMatrix_ > > new_known_realize_workspace () const
 

Detailed Description

template<class EigenVector_, class EigenMatrix_, class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
class irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >

Deferred scaling of a matrix.

Template Parameters
EigenVector_A floating-point Eigen::Vector to be used as input/output of multiplication operations.
EigenMatrix_A dense floating-point Eigen::Matrix in which to store the realized matrix. Typically of the same scalar type as EigenVector_.
MatrixPointer_Pointer to an instance of a class satisfying the Matrix interface. This can be a smart or raw pointer.
ScalePointer_Pointer to an instance of an Eigen vector class to hold the scaling facrors. This can be a smart or raw pointer.

This class computes the matrix-vector product after scaling all rows or columns in the matrix, i.e., multiplying or dividing the values of each row/column by some arbitrary value. For example, we can use this to divide each column by the standard deviation to achieve unit variance in principal components analyses. Naively doing such an operation would involve a copy of the matrix, which we avoid by deferring the scaling into the subspace defined by rhs.

Constructor & Destructor Documentation

◆ ScaledMatrix()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::ScaledMatrix ( const MatrixPointer_ & matrix,
const ScalePointer_ & scale,
bool column,
bool divide )
inline
Parameters
matrixPointer to a matrix to be column-scaled (if column_ = true) or row-scaled (otherwise).
scalePointer to a vector of length equal to the number of columns (if column_ = true) or rows (otherwise) of matrix, containing the scaling factor to divide (if divide = true) or multiply (otherwise) to each column/row.
columnWhether to multiply/divide each column of matrix by the corresponding factor in scale. If false, each row of matrix is scaled instead.
divideWhether to divide by the supplied scaling factors. If false, multiplication is performed instead.

Member Function Documentation

◆ cols()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
Eigen::Index irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::cols ( ) const
inlinevirtual
Returns
Number of columns in the matrix.

Implements irlba::Matrix< EigenVector_, EigenMatrix_ >.

◆ new_adjoint_workspace()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
std::unique_ptr< AdjointWorkspace< EigenVector_ > > irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::new_adjoint_workspace ( ) const
inlinevirtual
Returns
Pointer to a new workspace for adjoint matrix multiplication. The lifetime of this object should not exceed that of its parent Matrix.

Implements irlba::Matrix< EigenVector_, EigenMatrix_ >.

◆ new_known_adjoint_workspace()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
std::unique_ptr< ScaledAdjointWorkspace< EigenVector_, I< decltype(*my_matrix)>, I< decltype(*my_scale)> > > irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::new_known_adjoint_workspace ( ) const
inline

Overrides Matrix::new_known_adjoint_workspace() to enable devirtualization.

◆ new_known_realize_workspace()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
std::unique_ptr< ScaledRealizeWorkspace< EigenMatrix_, I< decltype(*my_matrix)>, I< decltype(*my_scale)> > > irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::new_known_realize_workspace ( ) const
inline

Overrides Matrix::new_known_realize_workspace() to enable devirtualization.

◆ new_known_workspace()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
std::unique_ptr< ScaledWorkspace< EigenVector_, I< decltype(*my_matrix)>, I< decltype(*my_scale)> > > irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::new_known_workspace ( ) const
inline

Overrides Matrix::new_known_workspace() to enable devirtualization.

◆ new_realize_workspace()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
std::unique_ptr< RealizeWorkspace< EigenMatrix_ > > irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::new_realize_workspace ( ) const
inlinevirtual
Returns
Pointer to a new workspace for matrix realization. The lifetime of this object should not exceed that of its parent Matrix.

Implements irlba::Matrix< EigenVector_, EigenMatrix_ >.

◆ new_workspace()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
std::unique_ptr< Workspace< EigenVector_ > > irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::new_workspace ( ) const
inlinevirtual
Returns
Pointer to a new workspace for matrix multiplication. The lifetime of this object should not exceed that of its parent Matrix.

Implements irlba::Matrix< EigenVector_, EigenMatrix_ >.

◆ rows()

template<class EigenVector_ , class EigenMatrix_ , class MatrixPointer_ = const Matrix<EigenVector_, EigenMatrix_>*, class ScalePointer_ = const EigenVector_*>
Eigen::Index irlba::ScaledMatrix< EigenVector_, EigenMatrix_, MatrixPointer_, ScalePointer_ >::rows ( ) const
inlinevirtual
Returns
Number of rows in the matrix.

Implements irlba::Matrix< EigenVector_, EigenMatrix_ >.


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