irlba
A C++ library for IRLBA
Loading...
Searching...
No Matches
irlba::Options< EigenVector_ > Struct Template Reference

Options for running IRLBA in compute() and pca(). More...

#include <Options.hpp>

Public Attributes

std::optional< double > invariant_subspace_tolerance
 
double convergence_tolerance = 1e-5
 
std::optional< double > singular_value_ratio_tolerance
 
std::optional< Eigen::Index > extra_work
 
int max_iterations = 1000
 
bool exact_for_small_matrix = true
 
bool exact_for_large_number = true
 
bool cap_number = false
 
std::mt19937_64::result_type seed = std::mt19937_64::default_seed
 
std::optional< EigenVector_ > initial
 

Detailed Description

template<class EigenVector_ = Eigen::VectorXd>
struct irlba::Options< EigenVector_ >

Options for running IRLBA in compute() and pca().

Template Parameters
EigenVector_A floating-point Eigen::Vector class to store the initial values.

Member Data Documentation

◆ cap_number

template<class EigenVector_ = Eigen::VectorXd>
bool irlba::Options< EigenVector_ >::cap_number = false

Whether to automatically cap the requested number of singular values to the smaller dimension of the input matrix. If false, an error is thrown instead.

◆ convergence_tolerance

template<class EigenVector_ = Eigen::VectorXd>
double irlba::Options< EigenVector_ >::convergence_tolerance = 1e-5

Tolerance on the approximation error of the singular triplets. Lower values improve the accuracy of the decomposition. (See Equation 2.13 of Baglama and Reichel.)

Any user-provided value should be non-negative.

◆ exact_for_large_number

template<class EigenVector_ = Eigen::VectorXd>
bool irlba::Options< EigenVector_ >::exact_for_large_number = true

Whether to perform an exact SVD if the requested number of singular values is too large (greater than or equal to half the smaller matrix dimension). This is more efficient and avoids inaccuracies from an insufficient workspace.

◆ exact_for_small_matrix

template<class EigenVector_ = Eigen::VectorXd>
bool irlba::Options< EigenVector_ >::exact_for_small_matrix = true

Whether to perform an exact SVD if the matrix is too small (fewer than 6 elements in any dimension). This is more efficient and avoids inaccuracies from an insufficient workspace.

◆ extra_work

template<class EigenVector_ = Eigen::VectorXd>
std::optional<Eigen::Index> irlba::Options< EigenVector_ >::extra_work

Number of extra dimensions to define the working subspace. Larger values can speed up convergence at the cost of increased memory usage. If unset, it defaults to the larger of 7 (the original default from the R package) and the requested number of singular triplets (for compute()) or principal components (for pca()).

◆ initial

template<class EigenVector_ = Eigen::VectorXd>
std::optional<EigenVector_> irlba::Options< EigenVector_ >::initial

Pointer to the initial values of the first right singular vector. This should have length equal to the number of columns of the input matrix in compute() or pca().

◆ invariant_subspace_tolerance

template<class EigenVector_ = Eigen::VectorXd>
std::optional<double> irlba::Options< EigenVector_ >::invariant_subspace_tolerance

Tolerance for defining invariant subspaces. This is used as the lower bound for the L2 norm for the subspace vectors; below this bound, vectors are treated as all-zero and are instead filled with random draws from a normal distribution.

Any user-provided value should be non-negative. If unset, this defaults to the machine epsilon to the power of 0.8.

◆ max_iterations

template<class EigenVector_ = Eigen::VectorXd>
int irlba::Options< EigenVector_ >::max_iterations = 1000

Maximum number of restart iterations. Larger values improve the chance of convergence.

◆ seed

template<class EigenVector_ = Eigen::VectorXd>
std::mt19937_64::result_type irlba::Options< EigenVector_ >::seed = std::mt19937_64::default_seed

Seed for the creation of random vectors, primarily during initialization of the IRLBA algorithm.

◆ singular_value_ratio_tolerance

template<class EigenVector_ = Eigen::VectorXd>
std::optional<double> irlba::Options< EigenVector_ >::singular_value_ratio_tolerance

Tolerance on the relative differences between singular values across iterations. Lower values improve the accuracy of the decomposition.

Any user-provided value should be non-negative. If unset, the value in Options::convergence_tolerance is used.


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