1#ifndef LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_SUBSPACE_SUBSPACESOLVEROPTSD_H
2#define LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_SUBSPACE_SUBSPACESOLVEROPTSD_H
3#include <molpro/linalg/itsolv/subspace/ISubspaceSolver.h>
4#include <molpro/linalg/itsolv/subspace/IXSpace.h>
5#include <molpro/linalg/itsolv/subspace/Matrix.h>
12template <
class RT,
class QT,
class PT>
27 assert(xspace.
size() == values.size());
37 auto kDim = kH.rows();
51 void set_error(
const std::vector<int>& roots,
const std::vector<value_type_abs>&
errors)
override {
52 for (
size_t i = 0; i < roots.size(); ++i)
58 throw std::logic_error(
"eigenvalues() not available in non-linear method");
60 const std::vector<value_type_abs>&
errors()
const override {
return m_errors; }
size_t size() const
Number of vectors forming the subspace.
Definition: IXSpace.h:25
SubspaceData data
Equation data in the subspace.
Definition: IXSpace.h:22
Slice slice(coord_type upper_left, coord_type bottom_right)
Access a rectangular slice of the matrix.
Definition: Matrix.h:97
void resize(const coord_type &dims)
Resize the matrix. The old data is preserved and any new rows/cols are zeroed.
Definition: Matrix.h:126
index_type rows() const
Definition: Matrix.h:165
Solves subspace problem for minimisation using the Steepest Descent algorithm.
Definition: SubspaceSolverOptSD.h:13
std::shared_ptr< Logger > m_logger
Definition: SubspaceSolverOptSD.h:68
void set_error(const std::vector< int > &roots, const std::vector< value_type_abs > &errors) override
Update errors for a group of roots.
Definition: SubspaceSolverOptSD.h:51
void set_error(int root, value_type_abs error) override
Set error value for solution root
Definition: SubspaceSolverOptSD.h:50
const std::vector< value_type_abs > & errors() const override
Access errors corresponding to each solution.
Definition: SubspaceSolverOptSD.h:60
value_type_abs m_svd_solver_threshold
threshold to select null space during SVD in eigenproblem
Definition: SubspaceSolverOptSD.h:71
typename ISubspaceSolver< RT, QT, PT >::value_type_abs value_type_abs
Definition: SubspaceSolverOptSD.h:16
void solve(IXSpace< R, Q, P > &xspace, const size_t nroots_max) override
Solve the subspace problem.
Definition: SubspaceSolverOptSD.h:23
SubspaceSolverOptSD(std::shared_ptr< Logger > logger)
Definition: SubspaceSolverOptSD.h:21
Matrix< value_type > m_solutions
solution matrix with row vectors
Definition: SubspaceSolverOptSD.h:66
size_t size() const override
Number of solutions.
Definition: SubspaceSolverOptSD.h:63
std::vector< value_type_abs > m_errors
errors in subspace solutions
Definition: SubspaceSolverOptSD.h:67
const Matrix< value_type > & solutions() const override
Access solutions from the last solve() call.
Definition: SubspaceSolverOptSD.h:56
const std::vector< value_type > & eigenvalues() const override
Access eigenvalues from the last solve() call.
Definition: SubspaceSolverOptSD.h:57
std::string as_string(const Mat &m, int precision=6)
Definition: Matrix.h:289
@ Info
Definition: Logger.h:49
@ Trace
Definition: Logger.h:49
Manages solution of the subspace problem and storage of those solutions.
Definition: ISubspaceSolver.h:15
typename array::ArrayHandler< R, R >::value_type value_type
Definition: ISubspaceSolver.h:19
typename array::ArrayHandler< R, R >::value_type_abs value_type_abs
Definition: ISubspaceSolver.h:20
PT P
Definition: ISubspaceSolver.h:18
QT Q
Definition: ISubspaceSolver.h:17
RT R
Definition: ISubspaceSolver.h:16