1#ifndef LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_SUBSPACE_SUBSPACESOLVEROPTBFGS_H
2#define LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_SUBSPACE_SUBSPACESOLVEROPTBFGS_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();
50 void set_error(
const std::vector<int>& roots,
const std::vector<value_type_abs>&
errors)
override {
51 for (
size_t i = 0; i < roots.size(); ++i)
57 throw std::logic_error(
"eigenvalues() not available in non-linear method");
59 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: SubspaceSolverOptBFGS.h:13
std::shared_ptr< Logger > m_logger
Definition: SubspaceSolverOptBFGS.h:67
const std::vector< value_type > & eigenvalues() const override
Access eigenvalues from the last solve() call.
Definition: SubspaceSolverOptBFGS.h:56
void solve(IXSpace< R, Q, P > &xspace, const size_t nroots_max) override
Solve the subspace problem.
Definition: SubspaceSolverOptBFGS.h:23
std::vector< value_type_abs > m_errors
errors in subspace solutions
Definition: SubspaceSolverOptBFGS.h:66
void set_error(const std::vector< int > &roots, const std::vector< value_type_abs > &errors) override
Update errors for a group of roots.
Definition: SubspaceSolverOptBFGS.h:50
Matrix< value_type > m_solutions
solution matrix with row vectors
Definition: SubspaceSolverOptBFGS.h:65
SubspaceSolverOptBFGS(std::shared_ptr< Logger > logger)
Definition: SubspaceSolverOptBFGS.h:21
size_t size() const override
Number of solutions.
Definition: SubspaceSolverOptBFGS.h:62
void set_error(int root, value_type_abs error) override
Set error value for solution root
Definition: SubspaceSolverOptBFGS.h:49
const Matrix< value_type > & solutions() const override
Access solutions from the last solve() call.
Definition: SubspaceSolverOptBFGS.h:55
const std::vector< value_type_abs > & errors() const override
Access errors corresponding to each solution.
Definition: SubspaceSolverOptBFGS.h:59
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