![]() |
Rosetta Utilities
2014.35
|
#include <SVD_Solver.hh>
Public Member Functions | |
SVD_Solver () | |
~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_Solver & | operator= (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 (FArray1D< double > const &b) |
set the vector b of Ax=b (FArray1D version) More... | |
void | set_matrix_A (FArray2D< double > const &A) |
set the matrix A of Ax=b (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 (FArray2D< double > const &A) const |
return the score given the matrix A (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 () |
Private Attributes | |
utility::vector1< double > | cstyle_b_ |
utility::vector1 < utility::vector1< double > > | cstyle_A_decomp_ |
utility::vector1 < utility::vector1< double > > | cstyle_v_ |
utility::vector1< double > | cstyle_x_ |
utility::vector1< double > | cstyle_w_ |
utility::vector1< double > | cstyle_tmp_ |
platform::Size | M_ |
platform::Size | N_ |
bool | b_is_set_ |
bool | A_is_set_ |
bool | A_is_decomp_ |
bool | x_is_solved_ |
basic::svd::SVD_Solver::SVD_Solver | ( | ) |
References utility_exit_with_message.
basic::svd::SVD_Solver::~SVD_Solver | ( | ) |
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 A_is_decomp_, A_is_set_, b_is_set_, cstyle_A_decomp_, cstyle_b_, cstyle_tmp_, cstyle_v_, cstyle_w_, cstyle_x_, M_, N_, utility_exit_with_message, and x_is_solved_.
basic::svd::SVD_Solver::SVD_Solver | ( | SVD_Solver const & | other | ) |
References A_is_decomp_, A_is_set_, b_is_set_, cstyle_A_decomp_, cstyle_b_, cstyle_tmp_, cstyle_v_, cstyle_w_, cstyle_x_, M_, N_, and x_is_solved_.
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 cstyle_x_, utility_exit_with_message, and x_is_solved_.
SVD_Solver & basic::svd::SVD_Solver::operator= | ( | SVD_Solver const & | other | ) |
References A_is_decomp_, A_is_set_, b_is_set_, cstyle_A_decomp_, cstyle_b_, cstyle_tmp_, cstyle_v_, cstyle_w_, cstyle_x_, M_, N_, utility_exit_with_message, and x_is_solved_.
Referenced by svdcmp().
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 A_is_decomp_, A_is_set_, 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 cstyle_b_, cstyle_x_, M_, N_, basic::options::OptionKeys::AnchoredDesign::filters::score, utility_exit_with_message, and x_is_solved_.
return the score given the matrix A (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 cstyle_b_, cstyle_x_, M_, N_, basic::options::OptionKeys::AnchoredDesign::filters::score, utility_exit_with_message, and x_is_solved_.
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 A_is_decomp_, b_is_set_, cstyle_A_decomp_, cstyle_b_, cstyle_tmp_, M_, N_, basic::options::OptionKeys::AnchoredDesign::filters::score, 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 A_is_decomp_, b_is_set_, svbksb(), utility_exit_with_message, and x_is_solved_.
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 A_is_decomp_, A_is_set_, cstyle_A_decomp_, M_, N_, utility_exit_with_message, and x_is_solved_.
void basic::svd::SVD_Solver::set_matrix_A | ( | FArray2D< double > const & | A | ) |
set the matrix A of Ax=b (FArray2D version)
To minimize ||Ax - b||^2, you need to set the matrix A.
References A_is_decomp_, A_is_set_, cstyle_A_decomp_, M_, N_, utility_exit_with_message, and x_is_solved_.
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 b_is_set_, cstyle_b_, M_, utility_exit_with_message, and x_is_solved_.
void basic::svd::SVD_Solver::set_vector_b | ( | FArray1D< double > const & | b | ) |
set the vector b of Ax=b (FArray1D version)
To minimize ||Ax - b||^2, you need to set the vector b.
References b_is_set_, cstyle_b_, M_, utility_exit_with_message, and x_is_solved_.
|
private |
References cstyle_A_decomp_, cstyle_b_, cstyle_tmp_, cstyle_v_, cstyle_w_, cstyle_x_, M_, N_, and basic::options::OptionKeys::in::file::s.
Referenced by run_solve_svd().
|
private |
References cstyle_A_decomp_, cstyle_tmp_, cstyle_v_, cstyle_w_, basic::options::OptionKeys::in::file::l, M_, max(), min(), N_, pythag(), basic::options::OptionKeys::in::file::s, numeric::sign(), and utility_exit_with_message.
Referenced by run_decomp_svd().
|
private |
Referenced by operator=(), run_decomp_svd(), run_score_svd_without_solving(), run_solve_svd(), set_matrix_A(), and SVD_Solver().
|
private |
Referenced by operator=(), run_decomp_svd(), set_matrix_A(), and SVD_Solver().
|
private |
Referenced by operator=(), run_score_svd_without_solving(), run_solve_svd(), set_vector_b(), and SVD_Solver().
|
private |
Referenced by operator=(), run_score_svd_without_solving(), set_matrix_A(), svbksb(), SVD_Solver(), and svdcmp().
|
private |
Referenced by operator=(), run_score_svd_on_matrix(), run_score_svd_without_solving(), set_vector_b(), svbksb(), and SVD_Solver().
|
private |
Referenced by operator=(), run_score_svd_without_solving(), svbksb(), SVD_Solver(), and svdcmp().
|
private |
Referenced by operator=(), svbksb(), SVD_Solver(), and svdcmp().
|
private |
Referenced by operator=(), svbksb(), SVD_Solver(), and svdcmp().
|
private |
Referenced by get_svd_solution(), operator=(), run_score_svd_on_matrix(), svbksb(), and SVD_Solver().
|
private |
Referenced by operator=(), run_score_svd_on_matrix(), run_score_svd_without_solving(), set_matrix_A(), set_vector_b(), svbksb(), SVD_Solver(), and svdcmp().
|
private |
Referenced by operator=(), run_score_svd_on_matrix(), run_score_svd_without_solving(), set_matrix_A(), svbksb(), SVD_Solver(), and svdcmp().
|
private |
Referenced by get_svd_solution(), operator=(), run_score_svd_on_matrix(), run_solve_svd(), set_matrix_A(), set_vector_b(), and SVD_Solver().