|
| | LowRankFunction ()=default |
| | LowRankFunction (const LowRankFunction &other) |
| | shallow copy ctor
|
| | LowRankFunction (std::vector< Function< T, LDIM > > g, std::vector< Function< T, LDIM > > h, double tol) |
| void | cloud_load (World &world, const Cloud &cloud, Recordlist< Cloud::keyT > &recordlist) |
| | customized function to load this from the cloud
|
| Recordlist< Cloud::keyT > | cloud_store (World &world, Cloud &cloud) const |
| | customized function to store this to the cloud
|
| std::vector< Function< T, LDIM > > | get_functions (const particle< LDIM > &p) const |
| std::vector< Function< T, LDIM > > | get_g () const |
| std::vector< Function< T, LDIM > > | get_h () const |
| double | l2error (const LRFunctorBase< T, NDIM > &lrfunctor1) const |
| | compute the l2 error |functor - \sum_i g_ih_i|_2
|
| double | l2error_pythagoras (double f_norm_sq) const |
| TensorTypeData< T >::scalar_type | norm2 () const |
| | l2 norm
|
| T | operator() (const Vector< double, NDIM > &r) const |
| | function evaluation
|
| template<typename Q> |
| LowRankFunction | operator* (const Q a) const |
| | scale by a scalar
|
| LowRankFunction | operator* (const T a) const |
| | out-of-place scale by a scalar (no type conversion)
|
| LowRankFunction & | operator*= (const T a) |
| | in-place scale by a scalar (no type conversion)
|
| LowRankFunction | operator+ (const LowRankFunction &b) const |
| | addition
|
| LowRankFunction & | operator+= (const LowRankFunction &b) |
| | in-place addition
|
| LowRankFunction | operator- (const LowRankFunction &b) const |
| | subtraction
|
| LowRankFunction & | operator-= (const LowRankFunction &b) |
| | in-place subtraction
|
| LowRankFunction & | operator= (const LowRankFunction &f) |
| void | optimize (const LRFunctorBase< T, NDIM > &lrfunctor1, const long nopt=1) |
| | optimize the lrf using the lrfunctor
|
| void | print_size (std::string msg="") const |
| Tensor< long > | rank () const |
| Function< T, NDIM > | reconstruct () const |
| | f(1,2) = \sum_i g_i(1) h_i(2)
|
| void | remove_linear_dependencies (double tol=-1.0) |
| void | reorthonormalize () |
| template<typename Archive> |
| void | serialize (const Archive &ar) |
| | serialize to an archive (e.g. cloud or file)
|
| double | size () const |
| | return the size in GByte
|
| World & | world () const |
template<typename T, std::size_t NDIM, std::size_t LDIM = NDIM/2>
class madness::LowRankFunction< T, NDIM, LDIM >
LowRankFunction represents a hi-dimensional (NDIM) function as a sum of products of low-dimensional (LDIM) functions.
a LowRankFunction can be created from a hi-dim function directly, or from a composite like f(1,2) phi(1) psi(2), where f(1,2) is a two-particle function (e.g. a Slater function) the representation is canonical: f(1,2) = \sum_i g_i(1) h_i(2) for the time being we don't require g or h to be orthogonal or normalized
template<typename T, std::size_t NDIM, std::size_t LDIM = NDIM/2>
compute the l2 error |functor - \sum_i g_ih_i|_2
\int (f(1,2) - gh(1,2))^2 = \int f(1,2)^2 - 2\int f(1,2) gh(1,2) + \int gh(1,2)^2 since we are subtracting large numbers the numerics are sensitive, and NaN may be returned..
References madness::arg(), do_print, madness::timer::do_print, madness::error(), g, h, inner(), madness::inner(), matrix_inner(), madness::LRFunctorBase< T, NDIM, LDIM >::norm2(), p1, p2, print(), rank(), madness::timer::tag(), and world().
template<typename T, std::size_t NDIM, std::size_t LDIM = NDIM/2>
Cheap relative L2 error via Pythagoras (canonical form only).
When h is orthonormal AND g is the reprojection of h (g_k = <f(r1,r2) | h_k(r2)>_{r2}), the following identity holds: ||f - sum_k g_k h_k||^2 = ||f||^2 - sum_k ||g_k||^2 (cross and self terms collapse to the same sum_k ||g_k||^2). No functor applications are needed — only norms of the stored g.
- Parameters
-
| [in] | f_norm_sq | precomputed ||f||^2 (typically lrfunctor.norm2()^2) |
- Precondition
- the LRF is in canonical form and g holds the reprojected factors.
References madness::arg(), g, MADNESS_CHECK_THROW, and madness::norm2s().
Referenced by madness::LowRankFunctionFactory< T, NDIM, LDIM >::project_stable().
template<typename T, std::size_t NDIM, std::size_t LDIM = NDIM/2>
optimize the lrf using the lrfunctor
- Parameters
-
| [in] | nopt | number of iterations (wrt to Alg. 4.3 in Halko) |
References do_print, madness::timer::do_print, g, h, inner(), orthonormalize(), p1, p2, madness::timer::tag(), truncate(), and world().
Referenced by madness::CCPairFunction< T, NDIM >::op_dec_to_dec().
template<typename T, std::size_t NDIM, std::size_t LDIM = NDIM/2>
template<typename T, std::size_t NDIM, std::size_t LDIM = NDIM/2>
perform RRCD on the overlap matrix of the functions, reorder the functions according to the pivoting, and return the upper triangular matrix from the Cholesky decomposition note: the rr_cholesky is more efficient than a full SVD for removing linear dependencies, but it does not give an orthonormal basis, so an additional orthonormalization step is needed if orthogonality is desired. To orthonormalize: auto [pv, X] = rr_cholesky_matrix_and_reorder(v,ovlp,tol); v_ortho=transform(world,pv,X); // v_ortho_i = sum_j v_j U_{ji}^(-1)
- Parameters
-
| [in] | v | the input functions |
| [in] | ovlp | the overlap matrix of the input functions, will be destroyed in-place by the rr_cholesky |
| [in] | tol | the tolerance for linear dependence in the rr_cholesky |
- Returns
- a tuple containing pv: reordered original, linearly-independent functions, X: the (r,r) transformation matrix from pv to orthonormalized functions: v_ortho_i = v_p X_pi = pv_j X_ji X_inv: its (r,p) "inverse" from original functions to orthonormalized functions: v_p = v_ortho_i X_inv_ip note that X is not the inverse of X_inv, that would be X_full but v_p(x) = pv_i(x) X_ij X_inv_jp is numerically the same
References madness::_(), copy(), madness::BaseTensor::dim(), madness::inverse(), rank(), madness::rr_cholesky(), and v.
Referenced by madness::LowRankFunctionFactory< T, NDIM, LDIM >::project_from_Y_stable(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::project_stable(), and remove_linear_dependencies().