ergo
|
Purification_sp2acc is a class which provides an interface for SP2 recursive expansion. More...
#include <purification_sp2.h>
Public Types | |
typedef PurificationGeneral< MatrixType >::real | real |
typedef PurificationGeneral< MatrixType >::IntervalType | IntervalType |
typedef PurificationGeneral< MatrixType >::NormType | NormType |
typedef PurificationGeneral< MatrixType >::VectorTypeInt | VectorTypeInt |
typedef PurificationGeneral< MatrixType >::VectorTypeReal | VectorTypeReal |
typedef generalVector | VectorType |
![]() | |
typedef ergo_real | real |
typedef intervalType | IntervalType |
typedef mat::normType | NormType |
typedef std::vector< int > | VectorTypeInt |
typedef std::vector< real > | VectorTypeReal |
typedef generalVector | VectorType |
typedef MatrixType | MatrixTypeWrapper |
Public Member Functions | |
Purification_sp2 () | |
void | set_init_params () |
void | get_poly (const int it, int &poly) |
void | set_poly (const int it) |
void | truncate_matrix (real &threshold, int it) |
void | estimate_number_of_iterations (int &numit) |
void | purify_X (const int it) |
void | purify_bounds (const int it) |
void | save_other_iter_info (IterationInfo &iter_info, int it) |
void | apply_inverse_poly_vector (const int it, VectorTypeReal &bounds_from_it) |
void | return_constant_C (const int it, real &Cval) |
real | apply_poly (const int it, real x) |
void | apply_poly_to_eigs (const int it, real &homo, real &lumo) |
real | compute_derivative (const int it, real x, real &DDf) |
![]() | |
PurificationGeneral () | |
virtual void | initialize (const MatrixType &F_, const IntervalType &lumo_bounds_, const IntervalType &homo_bounds_, int maxit_, real error_sub_, real error_eig_, int use_new_stopping_criterion_, NormType norm_truncation, NormType norm_stop_crit, int nocc_) |
Set imporatant parameters for the recursive expansion. More... | |
virtual bool | is_initialized () const |
Check is function initialize() is already called. More... | |
virtual bool | puri_is_prepared () const |
Check is function prepare_to_purification() is already called. More... | |
virtual void | PurificationStart () |
Start recursive expansion. More... | |
virtual void | prepare_to_purification () |
Prepare data for recursive expansion. More... | |
virtual void | purification_process () |
Run recursive expansion. More... | |
virtual void | eigenvalue_bounds_estimation () |
Estimate eigenvalues near homo-lumo gap. More... | |
virtual | ~PurificationGeneral () |
virtual void | clear () |
Clear all matrices in the class. More... | |
void | set_spectrum_bounds (real eigmin, real eigmax) |
Set spectrum bounds. More... | |
void | get_spectrum_bounds (real &eigmin, real &eigmax) |
Get spectrum bounds. More... | |
int | get_exact_number_of_puri_iterations () |
int | get_est_number_of_puri_iterations () |
virtual real | total_subspace_error (int it) |
void | gen_matlab_file_norm_diff (const char *filename) const |
Create MATLAB .m file which plots the idempotency error in each recursive expansion iteration. More... | |
void | gen_matlab_file_threshold (const char *filename) const |
Create MATLAB .m file which plots the actual introduced error after truncation of the matrix X_i in each recursive expansion iteration. More... | |
void | gen_matlab_file_nnz (const char *filename) const |
Create MATLAB .m file which plots the number of non-zero elements in matrices X_i and X_i^2 in each recursive expansion iteration. More... | |
void | gen_matlab_file_eigs (const char *filename) const |
Create MATLAB .m file which plots the homo and lumo bounds in each recursive expansion iteration. More... | |
void | gen_matlab_file_time (const char *filename) const |
Create MATLAB .m file which creates a bar plot presenting time spent on various parts of the iteration (such as matrix square and computation of eigenvectors) in each recursive expansion iteration. More... | |
void | gen_matlab_file_cond_num (const char *filename) const |
Create MATLAB .m file which plots a condition number of a problem of computing the density matrix in each recursive expansion iteration. More... | |
void | gen_python_file_nnz (const char *filename) const |
Create PYTHON .py file which plots number of non-zero elements in matrices X_i and X_i^2 in each recursive expansion iteration. More... | |
void | set_eigenvectors_params (string eigenvectors_method_, string eigenvectors_iterative_method_, real eigensolver_accuracy_, int eigensolver_maxiter_, int scf_step_, int use_prev_vector_as_initial_guess_, int try_eigv_on_next_iteration_if_fail_, VectorType *eigVecLUMO_, VectorType *eigVecHOMO_) |
Set parameters for computing eigenvectors. More... | |
void | set_compute_eigenvectors_in_each_iteration () |
void | unset_compute_eigenvectors_in_each_iteration () |
void | compute_eigenvectors_without_diagonalization_on_F (const MatrixType &F, int eigensolver_maxiter_for_F) |
Additional Inherited Members | |
![]() | |
static real | get_epsilon () |
Get machine epsilon. More... | |
static real | get_max_double () |
Get largest number. More... | |
static real | get_min_double () |
Get smallest number. More... | |
![]() | |
PuriInfo | info |
Fill in during purification with useful information. More... | |
MatrixType | X |
Matrix X. More... | |
MatrixType | Xsq |
Matrix X^2. More... | |
![]() | |
void | save_matrix_now (string str) |
void | compute_spectrum_bounds () |
Compute spectrum bounds. More... | |
void | compute_X () |
Get matrix X0 by mapping spectrum of F into [0,1] in reverse order. More... | |
void | map_bounds_to_0_1 () |
Get eigenvalue bounds for X0. More... | |
virtual void | check_standard_stopping_criterion (const real XmX2_norm, int &stop) |
Check stopping criterion (obsolete). More... | |
virtual void | check_new_stopping_criterion (const int it, const real XmX2_norm_it, const real XmX2_norm_itm2, const real XmX2_trace, int &stop, real &estim_order) |
Check stopping criterion. More... | |
virtual void | stopping_criterion (IterationInfo &iter_info, int &stop, real &estim_order) |
Choose stopping criterion and check it. More... | |
int | get_int_eig_iter_method (string eigenvectors_iterative_method) |
int | get_int_eig_method (string eigenvectors_method) |
void | compute_eigenvectors_without_diagonalization (int it, IterationInfo &iter_info) |
Compute HOMO and LUMO eigenvalues and eigenvectors of the matrix F. More... | |
void | compute_eigenvectors_without_diagonalization_last_iter_proj () |
void | compute_eigenvector (MatrixType const &M, VectorType *eigVecHOMOorLUMO, int it, bool is_homo) |
double | get_nnz_X (size_t &nnzX) |
Get nnz of X in %. More... | |
double | get_nnz_X () |
Get nnz of X in %. More... | |
double | get_nnz_Xsq (size_t &nnzXsq) |
Get nnz of X^2 in %. More... | |
double | get_nnz_Xsq () |
Get nnz of X^2 in %. More... | |
void | estimate_homo_lumo (const VectorTypeReal &XmX2_norm_mixed, const VectorTypeReal &XmX2_norm_frob, const VectorTypeReal &XmX2_trace) |
Get homo and lumo bounds from traces and norms of Xi-Xi^2. More... | |
void | get_frob_norm_est (const VectorTypeReal &XmX2_norm_frob, const std::vector< real > &h_in, const std::vector< real > &l_in, VectorTypeReal &YmY2_norm_frob_est) |
void | get_eigenvalue_estimates (const VectorTypeReal &XmX2_norm_mixed, const VectorTypeReal &XmX2_norm_frob, const VectorTypeReal &XmX2_trace) |
void | propagate_values_in_each_iter (real value_unocc, real value_occ, VectorTypeReal &out_unocc, VectorTypeReal &out_occ, int nmax) |
void | determine_iteration_for_eigenvectors () |
void | get_iterations_for_lumo_and_homo (int &chosen_iter_lumo, int &chosen_iter_homo) |
Find the best iterations for computing eigenvectors. More... | |
void | check_eigenvectors_at_the_end () |
void | discard_homo_eigenvector () |
void | discard_lumo_eigenvector () |
void | output_norms_and_traces (IterationInfo &iter_info) const |
void | get_interval_with_lambda (real &eigVal, VectorType &eigVec, bool &is_homo, bool &is_lumo, const int iter) |
void | get_eigenvalue_of_F_from_eigv_of_Xi (real &eigVal, const VectorType &eigVec) |
void | save_eigenvectors_to_file (bool is_homo, bool is_lumo, int it) |
void | set_truncation_parameters () |
void | find_truncation_thresh_every_iter () |
void | find_shifts_every_iter () |
/brief Find shifts sigma which will be used for construction of the filtering polynomial for computing eigenvectors. More... | |
void | find_eig_gaps_every_iter () |
void | writeToTmpFile (MatrixType &A) const |
void | readFromTmpFile (MatrixType &A) const |
![]() | |
MatrixType | F |
Matrix F. More... | |
MatrixType | X_homo |
MatrixType | X_lumo |
Save matrix Xi in certain iterations for computing eigenvectors (projection method). More... | |
bool | initialized_flag |
bool | puri_is_prepared_flag |
int | use_new_stopping_criterion |
True for new stopping criterion. More... | |
int | additional_iterations |
Do a few more iterations after convergence. More... | |
int | maxit |
Maximum number of iterations. More... | |
int | check_stopping_criterion_iter |
Iteration when to start to check stopping criterion. More... | |
int | nocc |
Number of occupied orbitals. More... | |
NormType | normPuriTrunc |
Norm used for the truncation of matrices. More... | |
NormType | normPuriStopCrit |
Norm used in the stopping criterion Can be mat::frobNorm, mat::mixedNorm, or mat::euclNorm. More... | |
real | error_sub |
Allowed error in invariant subspaces. More... | |
real | error_eig |
Error in eigenvalues (used just in old stopping criterion). More... | |
real | error_per_it |
Error allowed in each iteration due to truncation. More... | |
real | constant_C |
Asymptotic constant C needed for the new stopping criterion. More... | |
real | gammaStopEstim |
Used on the stopping criterion for estimation of eigenvalues from purification. More... | |
VectorTypeInt | VecPoly |
Polynomials computed in the function estimated_number_of_iterations() VecPoly[i] = 1 if we use X=X^2 VecPoly[i] = 0 if we use X=2X-X^2 (or their accelerated versions) More... | |
VectorTypeReal | VecGap |
Gap computed using inner homo and lumo bounds on each iteration. More... | |
VectorTypeReal | ITER_ERROR_VEC |
(Eigenvectors) Maximum error introduced in each iteration. More... | |
VectorTypeReal | SIGMA_HOMO_VEC |
VectorTypeReal | SIGMA_LUMO_VEC |
(Eigenvectors) Approximation of shifts in each iteration. More... | |
VectorTypeReal | EIG_ABS_GAP_LUMO_VEC |
VectorTypeReal | EIG_ABS_GAP_HOMO_VEC |
(Eigenvectors) Absolute and relative gap in filter for lumo eigenvalue. More... | |
VectorTypeReal | EIG_REL_GAP_LUMO_VEC |
VectorTypeReal | EIG_REL_GAP_HOMO_VEC |
(Eigenvectors) Absolute and relative gap in filter for homo eigenvalue. More... | |
int | number_of_eigenvalues |
IntervalType | homo_bounds |
(1-homo) bounds for Xi in iteration i More... | |
IntervalType | lumo_bounds |
Lumo bounds for Xi in iteration i. More... | |
IntervalType | homo_bounds_X0 |
Initial lumo bounds for X. More... | |
IntervalType | lumo_bounds_X0 |
Initial lumo bounds for X. More... | |
IntervalType | homo_bounds_F |
Initial lumo bounds for F. More... | |
IntervalType | lumo_bounds_F |
Initial homo bounds for F. More... | |
IntervalType | homo_bounds_F_new |
IntervalType | lumo_bounds_F_new |
IntervalType | spectrum_bounds |
Outer bounds for the whole spectrum of F/Xi. More... | |
bool | computed_spectrum_bounds |
int | eigenvectors_method |
Chosen method for computing eigenvectors. More... | |
int | eigenvectors_iterative_method |
Chosen eigensolver. More... | |
real | eigensolver_accuracy |
int | eigensolver_maxiter |
string | eigenvectors_method_str |
string | eigenvectors_iterative_method_str |
int | use_prev_vector_as_initial_guess |
bool | compute_eigenvectors_in_this_SCF_cycle |
bool | try_eigv_on_next_iteration_if_fail |
VectorType * | eigVecLUMO |
VectorType * | eigVecHOMO |
VectorType | eigVecLUMORef |
VectorType | eigVecHOMORef |
real | eigValLUMO |
real | eigValHOMO |
int | iter_for_homo |
int | iter_for_lumo |
VectorTypeInt | good_iterations_homo |
Iterations where homo eigenvector can be computed. More... | |
VectorTypeInt | good_iterations_lumo |
Iterations where homo eigenvector can be computed. More... | |
VectorTypeInt | really_good_iterations_homo |
Iterations where homo eigenvector is actually computed. More... | |
VectorTypeInt | really_good_iterations_lumo |
Iterations where lumo eigenvector is actually computed. More... | |
int | scf_step |
bool | compute_eigenvectors_in_each_iteration |
Compute homo and lumo eigenpairs in every iteration and save eigenvectors in txt files. More... | |
Purification_sp2acc is a class which provides an interface for SP2 recursive expansion.
MatrixType | Type of a matrix (ex. symmMatrix). |
typedef PurificationGeneral<MatrixType>::IntervalType Purification_sp2< MatrixType >::IntervalType |
typedef PurificationGeneral<MatrixType>::NormType Purification_sp2< MatrixType >::NormType |
typedef PurificationGeneral<MatrixType>::real Purification_sp2< MatrixType >::real |
typedef generalVector Purification_sp2< MatrixType >::VectorType |
typedef PurificationGeneral<MatrixType>::VectorTypeInt Purification_sp2< MatrixType >::VectorTypeInt |
typedef PurificationGeneral<MatrixType>::VectorTypeReal Purification_sp2< MatrixType >::VectorTypeReal |
|
inline |
|
virtual |
Implements PurificationGeneral< MatrixType >.
References Purification_sp2< MatrixType >::get_poly(), and template_blas_sqrt().
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References Purification_sp2< MatrixType >::get_poly().
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References Purification_sp2< MatrixType >::get_poly().
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References Purification_sp2< MatrixType >::get_poly().
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References PurificationGeneral< MatrixType >::additional_iterations, PurificationGeneral< MatrixType >::check_stopping_criterion_iter, do_output(), mat::frobNorm, PurificationGeneral< MatrixType >::get_epsilon(), PurificationGeneral< MatrixType >::homo_bounds, LOG_AREA_DENSFROMF, LOG_CAT_INFO, mat::Interval< Treal >::low(), PurificationGeneral< MatrixType >::lumo_bounds, PurificationGeneral< MatrixType >::maxit, PurificationGeneral< MatrixType >::normPuriStopCrit, mat::Interval< Treal >::upp(), PurificationGeneral< MatrixType >::VecGap, and PurificationGeneral< MatrixType >::VecPoly.
Referenced by Purification_sp2< MatrixType >::set_init_params().
void Purification_sp2< MatrixType >::get_poly | ( | const int | it, |
int & | poly | ||
) |
References PurificationGeneral< MatrixType >::VecPoly.
Referenced by Purification_sp2< MatrixType >::apply_inverse_poly_vector(), Purification_sp2< MatrixType >::apply_poly(), Purification_sp2< MatrixType >::apply_poly_to_eigs(), Purification_sp2< MatrixType >::compute_derivative(), Purification_sp2< MatrixType >::purify_bounds(), Purification_sp2< MatrixType >::purify_X(), and Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References do_output(), mat::Interval< Treal >::empty(), Purification_sp2< MatrixType >::get_poly(), PurificationGeneral< MatrixType >::homo_bounds, mat::Interval< Treal >::intersect(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, mat::Interval< Treal >::low(), PurificationGeneral< MatrixType >::lumo_bounds, mat::Interval< Treal >::upp(), and PurificationGeneral< MatrixType >::VecPoly.
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References do_output(), Purification_sp2< MatrixType >::get_poly(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, Purification_sp2< MatrixType >::set_poly(), PurificationGeneral< MatrixType >::X, and PurificationGeneral< MatrixType >::Xsq.
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References C_SP2.
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References IterationInfo::gap, IterationInfo::poly, PurificationGeneral< MatrixType >::VecGap, and PurificationGeneral< MatrixType >::VecPoly.
Referenced by Purification_sp2< MatrixType >::set_init_params().
|
inlinevirtual |
Implements PurificationGeneral< MatrixType >.
References Purification_sp2< MatrixType >::apply_inverse_poly_vector(), Purification_sp2< MatrixType >::apply_poly(), Purification_sp2< MatrixType >::apply_poly_to_eigs(), Purification_sp2< MatrixType >::compute_derivative(), do_output(), Purification_sp2< MatrixType >::estimate_number_of_iterations(), PurificationGeneral< MatrixType >::gammaStopEstim, Purification_sp2< MatrixType >::get_poly(), PurificationGeneral< MatrixType >::info, LOG_AREA_DENSFROMF, LOG_CAT_INFO, PuriInfo::method, Purification_sp2< MatrixType >::purify_bounds(), Purification_sp2< MatrixType >::purify_X(), Purification_sp2< MatrixType >::return_constant_C(), Purification_sp2< MatrixType >::save_other_iter_info(), Purification_sp2< MatrixType >::set_poly(), template_blas_sqrt(), and Purification_sp2< MatrixType >::truncate_matrix().
void Purification_sp2< MatrixType >::set_poly | ( | const int | it | ) |
References PurificationGeneral< MatrixType >::nocc, template_blas_fabs(), PurificationGeneral< MatrixType >::VecPoly, PurificationGeneral< MatrixType >::X, and PurificationGeneral< MatrixType >::Xsq.
Referenced by Purification_sp2< MatrixType >::purify_X(), and Purification_sp2< MatrixType >::set_init_params().
|
virtual |
Implements PurificationGeneral< MatrixType >.
References do_output(), PurificationGeneral< MatrixType >::error_per_it, LOG_AREA_DENSFROMF, LOG_CAT_INFO, PurificationGeneral< MatrixType >::normPuriTrunc, PurificationGeneral< MatrixType >::VecGap, and PurificationGeneral< MatrixType >::X.
Referenced by Purification_sp2< MatrixType >::set_init_params().