libROM  v1.0
Data-driven physical simulation library
Public Types | Public Member Functions | List of all members
CAROM::NNLSSolver Class Reference

#include <NNLS.h>

Public Types

enum class  QRresidualMode { off , on , hybrid }
 

Public Member Functions

 NNLSSolver (double const_tol=1.0e-14, int min_nnz=0, int max_nnz=0, int verbosity=0, double res_change_termination_tol=1.0e-4, double zero_tol=1.0e-14, int n_outer=100000, int n_inner=100000, const NNLS_termination criterion=NNLS_termination::LINF)
 
 ~NNLSSolver ()
 
void set_verbosity (const int verbosity_in)
 
void set_qrresidual_mode (const QRresidualMode qr_residual_mode)
 
void solve_parallel_with_scalapack (const Matrix &matTrans, const Vector &rhs_lb, const Vector &rhs_ub, Vector &soln)
 
void normalize_constraints (Matrix &matTrans, Vector &rhs_lb, Vector &rhs_ub)
 
int getNumProcs () const
 

Detailed Description

Class for solving non-negative least-squares problems, cf. T. Chapman et al, "Accelerated mesh sampling for the hyper reduction of nonlinear computational models," Int. J. Numer. Meth. Engng., 109: 1623-1654.

Definition at line 38 of file NNLS.h.

Member Enumeration Documentation

◆ QRresidualMode

Enumerated types of QRresidual mode. Options are 'off': the residual is calculated normally, 'on': the residual is calculated using the QR method, 'hybrid': the residual is calculated normally until we experience rounding errors, then the QR method is used. The default is 'hybrid', which should see the best performance. Recommend using 'hybrid' or 'off' only, since 'on' is computationally expensive.

Definition at line 69 of file NNLS.h.

Constructor & Destructor Documentation

◆ NNLSSolver()

CAROM::NNLSSolver::NNLSSolver ( double  const_tol = 1.0e-14,
int  min_nnz = 0,
int  max_nnz = 0,
int  verbosity = 0,
double  res_change_termination_tol = 1.0e-4,
double  zero_tol = 1.0e-14,
int  n_outer = 100000,
int  n_inner = 100000,
const NNLS_termination  criterion = NNLS_termination::LINF 
)

Constructor

Definition at line 58 of file NNLS.cpp.

◆ ~NNLSSolver()

CAROM::NNLSSolver::~NNLSSolver ( )

Destructor

Definition at line 79 of file NNLS.cpp.

Member Function Documentation

◆ getNumProcs()

int CAROM::NNLSSolver::getNumProcs ( ) const
inline

Return the number of processors.

Definition at line 110 of file NNLS.h.

◆ normalize_constraints()

void CAROM::NNLSSolver::normalize_constraints ( Matrix matTrans,
Vector rhs_lb,
Vector rhs_ub 
)

Normalize the constraints such that the tolerances for each constraint (ie (UB - LB)/2 ) are equal. This seems to help the performance in most cases.

Definition at line 95 of file NNLS.cpp.

◆ set_qrresidual_mode()

void CAROM::NNLSSolver::set_qrresidual_mode ( const QRresidualMode  qr_residual_mode)

Set the residual calculation mode for the NNLS solver. See QRresidualMode enum above for details.

Definition at line 87 of file NNLS.cpp.

◆ set_verbosity()

void CAROM::NNLSSolver::set_verbosity ( const int  verbosity_in)

Set verbosity. If set to 0: print nothing; if 1: just print results; if 2: print short update on every iteration; if 3: print longer update each iteration.

Definition at line 82 of file NNLS.cpp.

◆ solve_parallel_with_scalapack()

void CAROM::NNLSSolver::solve_parallel_with_scalapack ( const Matrix matTrans,
const Vector rhs_lb,
const Vector rhs_ub,
Vector soln 
)

Solve the NNLS problem. Specifically, we find a vector soln, such that rhs_lb < mat*soln < rhs_ub is satisfied. The matrix should hold a column distributed matrix (each process has all rows, but a subset of cols). Since libROM only supports row distributed matrices, the transpose is input. rhs_ub and rhs_lb are the true bounds divided by the number of processors, such that when the rhs_lb and rhs_ub are summed across all processes we get the true bounds. soln is a vector containing the solution. rhs_lb, rhs_ub and soln are all identical across all processes. The method by which we find the solution is the active-set method developed by Lawson and Hanson (1974) using scalapack functions to effect the multi-processor matrix operations. To decrease rounding errors in the case of very tight tolerances, we have the option to compute the residual using the QR factorization of A, by res = b - Q*Q^T*b. This residual calculation results in less rounding error, but is more computationally expensive. To select whether to use the QR residual method or not, see set_qrresidual_mode above.

Definition at line 130 of file NNLS.cpp.


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