iterative-solver 0.0
 
Loading...
Searching...
No Matches
IXSpace.h
1#ifndef LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_SUBSPACE_IXSPACE_H
2#define LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_SUBSPACE_IXSPACE_H
3#include <molpro/linalg/array/ArrayHandler.h>
4#include <molpro/linalg/array/Span.h>
5#include <molpro/linalg/itsolv/Metric.h>
6#include <molpro/linalg/itsolv/subspace/Dimensions.h>
7#include <molpro/linalg/itsolv/subspace/SubspaceData.h>
8#include <molpro/linalg/itsolv/wrap.h>
9
10#include <memory>
11#include <vector>
12
13namespace molpro::linalg::itsolv {
14
15class Logger;
16
17namespace subspace {
18
20template <class RT, class QT, class PT>
21class IXSpace {
22public:
23 using R = RT;
24 using Q = QT;
25 using P = PT;
28 IXSpace() = default;
29 virtual ~IXSpace() = default;
31
33 size_t size() const { return dimensions().nX(); }
34
36 virtual void erase(size_t i) = 0;
38 virtual void eraseq(size_t i) = 0;
40 virtual void erasep(size_t i) = 0;
42 virtual void erased(size_t i) = 0;
43
50 virtual void update_pspace(const CVecRef<P>& params, const array::Span<value_type>& pp_action_matrix,
51 const array::Span<value_type>& pp_metric_matrix = {}) = 0;
52
61 virtual MetricKind metric_kind() const = 0;
63 virtual MetricStorage metric_storage() const = 0;
68
75 virtual void update_qspace(const CVecRef<R>& params, const CVecRef<R>& actions,
76 const CVecRef<R>& metric_actions = {}) = 0;
77
88 virtual void update_dspace(VecRef<Q>& params, VecRef<Q>& actions, const VecRef<Q>& metric_actions = {},
89 const std::vector<size_t>& q_delete = {}, const Matrix<value_type>& coefficients = {}) = 0;
90
91 virtual VecRef<P> paramsp() = 0;
92 virtual VecRef<Q> paramsq() = 0;
93 virtual VecRef<Q> actionsq() = 0;
94 virtual VecRef<Q> paramsd() = 0;
95 virtual VecRef<Q> actionsd() = 0;
96
97 virtual CVecRef<P> paramsp() const = 0;
98 virtual CVecRef<Q> paramsq() const = 0;
99 virtual CVecRef<Q> actionsq() const = 0;
100 virtual CVecRef<Q> paramsd() const = 0;
101 virtual CVecRef<Q> actionsd() const = 0;
102
103 virtual CVecRef<P> cparamsp() const = 0;
104 virtual CVecRef<Q> cparamsq() const = 0;
105 virtual CVecRef<Q> cactionsq() const = 0;
106 virtual CVecRef<Q> cparamsd() const = 0;
107 virtual CVecRef<Q> cactionsd() const = 0;
108
110 virtual CVecRef<Q> cmetric_actionsq() const = 0;
112 virtual CVecRef<Q> cmetric_actionsd() const = 0;
113
114 virtual const Dimensions& dimensions() const = 0;
115
116 virtual void set_logger(std::shared_ptr<Logger> logger) = 0;
117};
118
119} // namespace subspace
120} // namespace molpro::linalg::itsolv
121
122#endif // LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_SUBSPACE_IXSPACE_H
decltype(value_type_L{} *value_type_R{}) value_type
Definition ArrayHandler.h:182
decltype(check_abs< value_type >()) value_type_abs
Definition ArrayHandler.h:183
Non-owning container taking a pointer to the data buffer and its size and exposing routines for itera...
Definition Span.h:31
Full subspace.
Definition IXSpace.h:21
SubspaceData< value_type > data
Equation data in the subspace.
Definition IXSpace.h:30
virtual void update_pspace(const CVecRef< P > &params, const array::Span< value_type > &pp_action_matrix, const array::Span< value_type > &pp_metric_matrix={})=0
Adds parameters to the P space.
virtual CVecRef< Q > cparamsq() const =0
virtual CVecRef< P > paramsp() const =0
virtual void set_logger(std::shared_ptr< Logger > logger)=0
virtual CVecRef< P > cparamsp() const =0
virtual void erased(size_t i)=0
Removes parameter i from D subspace.
virtual MetricKind metric_kind() const =0
The kind of metric declared with set_metric()
virtual CVecRef< Q > paramsq() const =0
size_t size() const
Number of vectors forming the subspace.
Definition IXSpace.h:33
virtual CVecRef< Q > cactionsd() const =0
virtual void erasep(size_t i)=0
Removes parameter i from P subspace.
virtual void eraseq(size_t i)=0
Removes parameter i from Q subspace.
virtual void update_qspace(const CVecRef< R > &params, const CVecRef< R > &actions, const CVecRef< R > &metric_actions={})=0
Adds parameters to the Q space.
typename array::ArrayHandler< R, R >::value_type_abs value_type_abs
Definition IXSpace.h:27
virtual CVecRef< Q > paramsd() const =0
virtual void update_dspace(VecRef< Q > &params, VecRef< Q > &actions, const VecRef< Q > &metric_actions={}, const std::vector< size_t > &q_delete={}, const Matrix< value_type > &coefficients={})=0
Replaces the old D space and the Q vectors q_delete by new D vectors, which are linear combinations o...
virtual CVecRef< Q > cactionsq() const =0
virtual void set_metric(MetricKind kind, MetricStorage storage=MetricStorage::Stored)=0
Declares the metric of the subspace. Anything other than MetricKind::Identity creates the metric matr...
virtual CVecRef< Q > cparamsd() const =0
virtual CVecRef< Q > cmetric_actionsd() const =0
Actions of the metric on the D space parameters, empty unless there is a metric.
typename array::ArrayHandler< R, R >::value_type value_type
Definition IXSpace.h:26
bool stores_metric_actions() const
Whether the actions of the metric on the Q and D vectors are kept.
Definition IXSpace.h:65
virtual CVecRef< Q > actionsd() const =0
virtual const Dimensions & dimensions() const =0
virtual CVecRef< Q > actionsq() const =0
virtual MetricStorage metric_storage() const =0
How the actions of the metric declared with set_metric() are obtained.
virtual void erase(size_t i)=0
Removes parameter i from the full subspace.
virtual CVecRef< Q > cmetric_actionsq() const =0
Actions of the metric on the Q space parameters, empty unless there is a metric.
std::map< EqnData, Matrix< T > > SubspaceData
Equation data blocks of the subspace, in the scalar type of the problem.
Definition SubspaceData.h:18
4-parameter interpolation of a 1-dimensional function given two points for which function values and ...
Definition helper.h:14
std::unique_ptr< LinearEigensystem< R, Q, P > > create_LinearEigensystem(const LinearEigensystemOptions &options, const std::shared_ptr< ArrayHandlers< R, Q, P > > &handlers=std::make_shared< molpro::linalg::itsolv::ArrayHandlers< R, Q, P > >())
Definition SolverFactory.h:111
std::vector< std::reference_wrapper< const A > > CVecRef
Definition wrap.h:14
MetricStorage
How a solver obtains the actions of a metric on its subspace vectors, see IterativeSolver::set_metric...
Definition Metric.h:21
@ Stored
the actions of the metric on all subspace vectors are kept
std::vector< std::reference_wrapper< A > > VecRef
Definition wrap.h:11
MetricKind
The kind of metric M of a generalised problem, such as the eigenproblem A v = lambda M v.
Definition Metric.h:13
@ Identity
M = 1, i.e. no metric.
size_t nX() const
total size of the X space
Definition Dimensions.h:16