NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
numerical::rank_cutoff Class Reference

The magnitude at or under which a singular value counts as zero, in a rank (matrix_rank), a pseudo-inverse (pinv) or a least-squares solution (lstsq): by default NumPy's, the largest singular value times the machine epsilon times the larger dimension; relative to the largest, as NumPy's rcond and rtol; or absolute, as matrix_rank's tol. More...

#include <decomposition.hpp>

Public Member Functions

constexpr rank_cutoff () noexcept=default
 NumPy's default: the largest singular value times the machine epsilon times the larger dimension.
 
double magnitude (double largest, std::size_t rows, std::size_t cols) const noexcept
 The cutoff for a rows × cols matrix whose largest singular value is largest.
 
rank_cutoff scaled (int exponent) const noexcept
 The same cutoff for the matrix divided by 2^exponent.
 

Static Public Member Functions

static rank_cutoff relative (double ratio)
 The largest singular value times ratio.
 
static rank_cutoff absolute (double magnitude)
 magnitude itself, whatever the largest singular value.
 

Private Member Functions

constexpr rank_cutoff (double value, bool absolute) noexcept
 

Static Private Member Functions

static double checked (double value)
 

Private Attributes

double value_ {-1.0}
 The ratio or the magnitude; negative for NumPy's default.
 
bool absolute_ {false}
 Whether value_ is a magnitude.
 

Detailed Description

The magnitude at or under which a singular value counts as zero, in a rank (matrix_rank), a pseudo-inverse (pinv) or a least-squares solution (lstsq): by default NumPy's, the largest singular value times the machine epsilon times the larger dimension; relative to the largest, as NumPy's rcond and rtol; or absolute, as matrix_rank's tol.

Definition at line 2473 of file decomposition.hpp.

Constructor & Destructor Documentation

◆ rank_cutoff() [1/2]

constexpr numerical::rank_cutoff::rank_cutoff ( )
constexprdefaultnoexcept

NumPy's default: the largest singular value times the machine epsilon times the larger dimension.

◆ rank_cutoff() [2/2]

constexpr numerical::rank_cutoff::rank_cutoff ( double  value,
bool  absolute 
)
inlineconstexprprivatenoexcept

Definition at line 2517 of file decomposition.hpp.

Member Function Documentation

◆ absolute()

static rank_cutoff numerical::rank_cutoff::absolute ( double  magnitude)
inlinestatic

magnitude itself, whatever the largest singular value.

Exceptions
std::invalid_argumentIf magnitude is negative or NaN.

Definition at line 2493 of file decomposition.hpp.

◆ checked()

static double numerical::rank_cutoff::checked ( double  value)
inlinestaticprivate

Definition at line 2522 of file decomposition.hpp.

◆ magnitude()

double numerical::rank_cutoff::magnitude ( double  largest,
std::size_t  rows,
std::size_t  cols 
) const
inlinenoexcept

The cutoff for a rows × cols matrix whose largest singular value is largest.

Definition at line 2499 of file decomposition.hpp.

◆ relative()

static rank_cutoff numerical::rank_cutoff::relative ( double  ratio)
inlinestatic

The largest singular value times ratio.

Exceptions
std::invalid_argumentIf ratio is negative or NaN.

Definition at line 2484 of file decomposition.hpp.

◆ scaled()

rank_cutoff numerical::rank_cutoff::scaled ( int  exponent) const
inlinenoexcept

The same cutoff for the matrix divided by 2^exponent.

Definition at line 2510 of file decomposition.hpp.

Member Data Documentation

◆ absolute_

bool numerical::rank_cutoff::absolute_ {false}
private

Whether value_ is a magnitude.

Definition at line 2531 of file decomposition.hpp.

◆ value_

double numerical::rank_cutoff::value_ {-1.0}
private

The ratio or the magnitude; negative for NumPy's default.

Definition at line 2530 of file decomposition.hpp.


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