Rosetta  2020.46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
basic::svd::SVD_Solver Class Reference

#include <SVD_Solver.hh>

Public Member Functions

 ~SVD_Solver ()
 
 SVD_Solver (platform::Size const M, platform::Size const N)
 M is the size of vector b (experimental data); N is the size of the vector to optimize M >= N. More...
 
SVD_Solveroperator= (SVD_Solver const &other)
 
 SVD_Solver (SVD_Solver const &other)
 
void set_vector_b (utility::vector1< double > const &b)
 set the vector b of Ax=b More...
 
void set_matrix_A (utility::vector1< utility::vector1< double > > const &A)
 set the matrix A of Ax=b More...
 
void set_vector_b (ObjexxFCL::FArray1D< double > const &b)
 set the vector b of Ax=b (ObjexxFCL::FArray1D version) More...
 
void set_matrix_A (ObjexxFCL::FArray2D< double > const &A)
 set the matrix A of Ax=b (ObjexxFCL::FArray2D version) More...
 
void run_decomp_svd ()
 decompose the matrix A. Can be called after the matrix A and vector b are set (with set_matrix_A and set_vector_b) More...
 
void run_solve_svd ()
 minimize the cost sqrt( ||A x - b||^2 ) (but doesn't calculate it) Can be called after run_decomp_svd() More...
 
double run_score_svd_on_matrix (utility::vector1< utility::vector1< double > > const &cppstyle_A) const
 return the score given the matrix A Can be called after run_decomp_svd() More...
 
double run_score_svd_on_matrix (ObjexxFCL::FArray2D< double > const &A) const
 return the score given the matrix A (ObjexxFCL::FArray2D version) Can be called after run_decomp_svd() More...
 
double run_score_svd_without_solving ()
 return the minimzed score without the need to call run_solve_svd() Can be called after run_decomp_svd() More...
 
utility::vector1< double > const & get_svd_solution () const
 return the vector x that minimize ||Ax - b||^2 Can be called after run_solve_svd() More...
 

Private Member Functions

double pythag (double const &a, double const &b) const
 
void svdcmp ()
 
void svbksb ()
 
 SVD_Solver ()
 

Private Attributes

utility::vector1< doublecstyle_b_
 
utility::vector1
< utility::vector1< double > > 
cstyle_A_decomp_
 
utility::vector1
< utility::vector1< double > > 
cstyle_v_
 
utility::vector1< doublecstyle_x_
 
utility::vector1< doublecstyle_w_
 
utility::vector1< doublecstyle_tmp_
 
platform::Size M_
 
platform::Size N_
 
bool b_is_set_
 
bool A_is_set_
 
bool A_is_decomp_
 
bool x_is_solved_
 

Constructor & Destructor Documentation

basic::svd::SVD_Solver::~SVD_Solver ( )
default
basic::svd::SVD_Solver::SVD_Solver ( platform::Size const  M,
platform::Size const  N 
)

M is the size of vector b (experimental data); N is the size of the vector to optimize M >= N.

References pyrosetta.distributed.cluster.base::M, and utility_exit_with_message.

basic::svd::SVD_Solver::SVD_Solver ( SVD_Solver const &  other)
default
basic::svd::SVD_Solver::SVD_Solver ( )
private

Member Function Documentation

utility::vector1< double > const & basic::svd::SVD_Solver::get_svd_solution ( ) const

return the vector x that minimize ||Ax - b||^2 Can be called after run_solve_svd()

Return the optimized vector x. Can be called only when ||Ax-b||^2 has been minimized.

References utility_exit_with_message.

SVD_Solver & basic::svd::SVD_Solver::operator= ( SVD_Solver const &  other)
double basic::svd::SVD_Solver::pythag ( double const &  a,
double const &  b 
) const
private
void basic::svd::SVD_Solver::run_decomp_svd ( )

decompose the matrix A. Can be called after the matrix A and vector b are set (with set_matrix_A and set_vector_b)

Decomposition of the matrix A. Can be called only when A is set. You can't decompose twice in a row without reseting the matrix A.

References numeric::linear_algebra::svdcmp(), and utility_exit_with_message.

double basic::svd::SVD_Solver::run_score_svd_on_matrix ( utility::vector1< utility::vector1< double > > const &  cppstyle_A) const

return the score given the matrix A Can be called after run_decomp_svd()

Return the score SQRT(||Ax-b||^2). Can be called only when ||Ax-b||^2 has been minimized. You need the give the original A matrix as argument.

References basic::options::OptionKeys::frags::j, erraser_single_res_analysis::score, erraser_analysis::temp, and utility_exit_with_message.

double basic::svd::SVD_Solver::run_score_svd_on_matrix ( ObjexxFCL::FArray2D< double > const &  A) const

return the score given the matrix A (ObjexxFCL::FArray2D version) Can be called after run_decomp_svd()

Return the score SQRT(||Ax-b||^2). Can be called only when ||Ax-b||^2 has been minimized. You need the give the original A matrix as argument.

References ObjexxFCL::format::A(), basic::options::OptionKeys::frags::j, erraser_single_res_analysis::score, erraser_analysis::temp, and utility_exit_with_message.

double basic::svd::SVD_Solver::run_score_svd_without_solving ( )

return the minimzed score without the need to call run_solve_svd() Can be called after run_decomp_svd()

Attempt to speed up calculation of the cost without actually solving Ax = b The routine works, but is not faster (nor slower)

References basic::options::OptionKeys::frags::j, erraser_single_res_analysis::score, erraser_analysis::temp, and utility_exit_with_message.

void basic::svd::SVD_Solver::run_solve_svd ( )

minimize the cost sqrt( ||A x - b||^2 ) (but doesn't calculate it) Can be called after run_decomp_svd()

Minimize ||Ax - b||^2. Can be called only when b is set and A is decomposed. You are allowed to update the vector b and minimize again.

References utility_exit_with_message.

void basic::svd::SVD_Solver::set_matrix_A ( utility::vector1< utility::vector1< double > > const &  A)

set the matrix A of Ax=b

To minimize ||Ax - b||^2, you need to set the matrix A.

References basic::options::OptionKeys::frags::j, ObjexxFCL::size(), and utility_exit_with_message.

void basic::svd::SVD_Solver::set_matrix_A ( ObjexxFCL::FArray2D< double > const &  A)

set the matrix A of Ax=b (ObjexxFCL::FArray2D version)

To minimize ||Ax - b||^2, you need to set the matrix A.

References ObjexxFCL::format::A(), basic::options::OptionKeys::frags::j, ObjexxFCL::FArray< typename >::size(), and utility_exit_with_message.

void basic::svd::SVD_Solver::set_vector_b ( utility::vector1< double > const &  b)

set the vector b of Ax=b

To minimize ||Ax - b||^2, you need to set the vector b.

References utility_exit_with_message.

void basic::svd::SVD_Solver::set_vector_b ( ObjexxFCL::FArray1D< double > const &  b)

set the vector b of Ax=b (ObjexxFCL::FArray1D version)

To minimize ||Ax - b||^2, you need to set the vector b.

References basic::options::OptionKeys::score::fiber_diffraction::b, ObjexxFCL::FArray< typename >::size(), and utility_exit_with_message.

void basic::svd::SVD_Solver::svbksb ( )
private
void basic::svd::SVD_Solver::svdcmp ( )
private

Member Data Documentation

bool basic::svd::SVD_Solver::A_is_decomp_
private

Referenced by operator=().

bool basic::svd::SVD_Solver::A_is_set_
private

Referenced by operator=().

bool basic::svd::SVD_Solver::b_is_set_
private

Referenced by operator=().

utility::vector1< utility::vector1<double> > basic::svd::SVD_Solver::cstyle_A_decomp_
private

Referenced by operator=().

utility::vector1<double> basic::svd::SVD_Solver::cstyle_b_
private

Referenced by operator=().

utility::vector1<double> basic::svd::SVD_Solver::cstyle_tmp_
private

Referenced by operator=().

utility::vector1< utility::vector1<double> > basic::svd::SVD_Solver::cstyle_v_
private

Referenced by operator=().

utility::vector1<double> basic::svd::SVD_Solver::cstyle_w_
private

Referenced by operator=().

utility::vector1<double> basic::svd::SVD_Solver::cstyle_x_
private

Referenced by operator=().

platform::Size basic::svd::SVD_Solver::M_
private

Referenced by operator=().

platform::Size basic::svd::SVD_Solver::N_
private

Referenced by operator=().

bool basic::svd::SVD_Solver::x_is_solved_
private

Referenced by operator=().


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