ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
ietl_jacobi_davidson.h File Reference
#include "dmrg/utils/BaseParameters.h"
#include "ietl_lanczos_solver.h"
#include "ietl/jacobi.h"
#include "ietl/jd.h"

Go to the source code of this file.

Functions

template<class Matrix , class SymmGroup >
std::pair< double, MPSTensor
< Matrix, SymmGroup > > 
solve_ietl_jcd (SiteProblem< Matrix, SymmGroup > &sp, MPSTensor< Matrix, SymmGroup > const &initial, BaseParameters &params, std::vector< MPSTensor< Matrix, SymmGroup > > ortho_vecs=std::vector< MPSTensor< Matrix, SymmGroup > >())
 

Function Documentation

template<class Matrix , class SymmGroup >
std::pair<double, MPSTensor<Matrix, SymmGroup> > solve_ietl_jcd ( SiteProblem< Matrix, SymmGroup > &  sp,
MPSTensor< Matrix, SymmGroup > const &  initial,
BaseParameters params,
std::vector< MPSTensor< Matrix, SymmGroup > >  ortho_vecs = std::vector<MPSTensor<Matrix, SymmGroup> >() 
)

Definition at line 39 of file ietl_jacobi_davidson.h.

43 {
44  if (initial.num_elements() <= ortho_vecs.size())
45  ortho_vecs.resize(initial.num_elements()-1);
46  // Gram-Schmidt the ortho_vecs
47  for (int n = 1; n < ortho_vecs.size(); ++n)
48  for (int n0 = 0; n0 < n; ++n0)
49  ortho_vecs[n] -= ietl::dot(ortho_vecs[n0], ortho_vecs[n])/ietl::dot(ortho_vecs[n0],ortho_vecs[n0])*ortho_vecs[n0];
50 
51  typedef MPSTensor<Matrix, SymmGroup> Vector;
52  SingleSiteVS<Matrix, SymmGroup> vs(initial, ortho_vecs);
53 
54  ietl::jcd_gmres_solver<SiteProblem<Matrix, SymmGroup>, SingleSiteVS<Matrix, SymmGroup> >
55  jcd_gmres(sp, vs, params["ietl_jcd_gmres"]);
56 
57  ietl::jacobi_davidson<SiteProblem<Matrix, SymmGroup>, SingleSiteVS<Matrix, SymmGroup> >
58  jd(sp, vs, ietl::Smallest);
59 
60  double tol = params["ietl_jcd_tol"];
61  ietl::basic_iteration<double> iter(params["ietl_jcd_maxiter"], tol, tol);
62 
63 // maquis::cout << "Ortho vecs " << ortho_vecs.size() << std::endl;
64  for (int n = 0; n < ortho_vecs.size(); ++n) {
65 // maquis::cout << "Ortho norm " << n << ": " << ietl::two_norm(ortho_vecs[n]) << std::endl;
66  maquis::cout << "Input <MPS|O[" << n << "]> : " << ietl::dot(initial, ortho_vecs[n]) << std::endl;
67  }
68 
69  std::pair<double, Vector> r0 = jd.calculate_eigenvalue(initial, jcd_gmres, iter);
70 
71  for (int n = 0; n < ortho_vecs.size(); ++n)
72  maquis::cout << "Output <MPS|O[" << n << "]> : " << ietl::dot(r0.second, ortho_vecs[n]) << std::endl;
73 
74  maquis::cout << "JCD used " << iter.iterations() << " iterations." << std::endl;
75 
76  return r0;
77 }
MPSTensor< Matrix, SymmGroup >::scalar_type dot(MPSTensor< Matrix, SymmGroup > const &x, MPSTensor< Matrix, SymmGroup > const &y)
std::size_t num_elements() const
Definition: mpstensor.hpp:639