irlba
A C++ library for IRLBA
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
irlba::MockMatrix Class Reference

Interface for a matrix to use in compute(). More...

#include <MockMatrix.hpp>

Classes

struct  AdjointWorkspace
 Workspace class for adjoint_multiply(). More...
 
struct  Workspace
 Workspace class for multiply(). More...
 

Public Member Functions

Eigen::Index rows () const
 
Eigen::Index cols () const
 
Workspace workspace () const
 
AdjointWorkspace adjoint_workspace () const
 
template<class Right_ , class EigenVector_ >
void multiply (const Right_ &rhs, Workspace &work, EigenVector_ &out) const
 
template<class Right_ , class EigenVector_ >
void adjoint_multiply (const Right_ &rhs, AdjointWorkspace &work, EigenVector_ &out) const
 
template<class EigenMatrix_ >
EigenMatrix_ realize () const
 

Detailed Description

Interface for a matrix to use in compute().

Defines a compile-time interface for a matrix input to IRLBA. This should mainly provide methods for multiplication with a vector. Developers can also define wrappers to perform the matrix-vector multiplication after some operation like centering or scaling. The idea is to compute the product without actually modifying the underlying matrix, which is important when the modification results in an unnecessary copy and/or loss of sparsity. We achieve this by deferring the modification into the subspace defined by vector.

Member Function Documentation

◆ adjoint_multiply()

void irlba::MockMatrix::adjoint_multiply ( const Right_ rhs,
AdjointWorkspace work,
EigenVector_ out 
) const
inline
Template Parameters
Right_A floating-point Eigen::Vector or equivalent expression.
EigenVector_A floating-point Eigen::Vector.
Parameters
[in]rhsThe right-hand side of the matrix product.
workThe return value of adjoint_workspace(). This can be reused across multiple adjoint_multiply() calls.
[out]outThe output vector to store the matrix product. This is filled with the product of the transpose of this matrix and rhs.

This method will be called without any explicit template arguments, so implementations do not need to use the same number/order of template parameters. EigenVector_ may also be a template parameter of the class rather than the method. depending on what is most convenient for defining the associated AdjointWorkspace.

◆ adjoint_workspace()

AdjointWorkspace irlba::MockMatrix::adjoint_workspace ( ) const
inline
Returns
Workspace for use in adjoint_multiply().

◆ cols()

Eigen::Index irlba::MockMatrix::cols ( ) const
inline
Returns
Number of columns in the matrix.

◆ multiply()

void irlba::MockMatrix::multiply ( const Right_ rhs,
Workspace work,
EigenVector_ out 
) const
inline
Template Parameters
Right_A floating-point Eigen::Vector or equivalent expression.
EigenVector_A floating-point Eigen::Vector.
Parameters
[in]rhsThe right-hand side of the matrix product.
workThe return value of workspace(). This can be reused across multiple multiply() calls.
[out]outThe output vector to store the matrix product. This is filled with the product of this matrix and rhs.

This method will be called without any explicit template arguments, so implementations do not need to use the same number/order of template parameters. EigenVector_ may also be a template parameter of the class rather than the method, depending on what is most convenient for defining the associated Workspace.

◆ realize()

template<class EigenMatrix_ >
EigenMatrix_ irlba::MockMatrix::realize ( ) const
inline
Template Parameters
EigenMatrix_A floating-point Eigen::Matrix.
Returns
A realized version of the centered matrix, where the centering has been explicitly applied.

◆ rows()

Eigen::Index irlba::MockMatrix::rows ( ) const
inline
Returns
Number of rows in the matrix.

◆ workspace()

Workspace irlba::MockMatrix::workspace ( ) const
inline
Returns
Workspace for use in multiply().

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