QMCPACK
LinearMethod.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2022 QMCPACK developers.
6 //
7 // File developed by: Miguel Morales, moralessilva2@llnl.gov, Lawrence Livermore National Laboratory
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
10 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
11 //
12 // File created by: Miguel Morales, moralessilva2@llnl.gov, Lawrence Livermore National Laboratory
13 //////////////////////////////////////////////////////////////////////////////////////
14 
15 
16 /** @file LinearMethod.h
17  * @brief LinearMethod related functions.
18  */
19 #ifndef QMCPLUSPLUS_LINEARMETHOD_H
20 #define QMCPLUSPLUS_LINEARMETHOD_H
21 
22 #include <Configuration.h>
23 #include <NewTimer.h>
24 #include <OhmmsPETE/OhmmsMatrix.h>
25 
26 namespace qmcplusplus
27 {
28 ///forward declaration of a cost function
29 class QMCCostFunctionBase;
30 
32 {
34 
35  // obtain the range of non-linear parameters
36  void getNonLinearRange(int& first, int& last, const QMCCostFunctionBase& optTarget) const;
37 
38 public:
39  /** Select eigenvalue and return corresponding scaled eigenvector
40  * @param[in] eigenvals Eigenvalues
41  * @param[in] eigenvectors Eigenvectors
42  * @param[in] zerozero The H(0,0) element, used to guide eigenvalue selection
43  * @param[out] ev The eigenvector scaled by the reciprocal of the first element
44  * @return The selected eigenvalue
45  */
46  static Real selectEigenvalue(std::vector<Real>& eigenvals,
47  Matrix<Real>& eigenvectors,
48  Real zerozero,
49  std::vector<Real>& ev);
50 
51  /** Solve the generalized eigenvalue problem and return a scaled eigenvector corresponding to the selected eigenvalue
52  * @param[in] A Hamiltonian matrix
53  * @param[in] B Overlap matrix
54  * @param[out] ev Scaled eigenvector
55  *
56  * This uses a regular eigenvalue solver for B^-1 A (LAPACK geev).
57  * In theory using the generalized eigenvalue solver is more numerically stable, but
58  * in practice this solver is sufficiently stable, and is faster than the generalized solver.
59  */
60  static Real getLowestEigenvector_Inv(Matrix<Real>& A, Matrix<Real>& B, std::vector<Real>& ev);
61 
62  /** Solve the generalized eigenvalue problem and return a scaled eigenvector corresponding to the selected eigenvalue
63  * @param[in] A Hamiltonian matrix
64  * @param[in] B Overlap matrix
65  * @param[out] ev Scaled eigenvector
66  *
67  * This uses a generalized eigenvalue solver (LAPACK ggev).
68  */
69  static Real getLowestEigenvector_Gen(Matrix<Real>& A, Matrix<Real>& B, std::vector<Real>& ev);
70 
71  //asymmetric EV
72  Real getLowestEigenvector(Matrix<Real>& A, std::vector<Real>& ev) const;
73  // compute a rescale factor. Ye: Where is the method from?
74  Real getNonLinearRescale(std::vector<Real>& dP, Matrix<Real>& S, const QMCCostFunctionBase& optTarget) const;
75 };
76 } // namespace qmcplusplus
77 #endif
void getNonLinearRange(int &first, int &last, const QMCCostFunctionBase &optTarget) const
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
QTBase::RealType RealType
Definition: Configuration.h:58
QMCTraits::RealType Real
Definition: LinearMethod.h:33
static Real getLowestEigenvector_Inv(Matrix< Real > &A, Matrix< Real > &B, std::vector< Real > &ev)
Solve the generalized eigenvalue problem and return a scaled eigenvector corresponding to the selecte...
static Real getLowestEigenvector_Gen(Matrix< Real > &A, Matrix< Real > &B, std::vector< Real > &ev)
Solve the generalized eigenvalue problem and return a scaled eigenvector corresponding to the selecte...
Real getLowestEigenvector(Matrix< Real > &A, std::vector< Real > &ev) const
Implements wave-function optimization.
double B(double x, int k, int i, const std::vector< double > &t)
static Real selectEigenvalue(std::vector< Real > &eigenvals, Matrix< Real > &eigenvectors, Real zerozero, std::vector< Real > &ev)
Select eigenvalue and return corresponding scaled eigenvector.
NewTimer class various high-resolution timers.
Real getNonLinearRescale(std::vector< Real > &dP, Matrix< Real > &S, const QMCCostFunctionBase &optTarget) const