13#ifndef SANDALS_SOLUTION_HH
14#define SANDALS_SOLUTION_HH
60 template <
typename Real, Integer N, Integer M = 0>
63 using Vector = Eigen::Vector<Real, Eigen::Dynamic>;
64 using MatrixN = Eigen::Matrix<Real, N, Eigen::Dynamic, Eigen::RowMajor>;
65 using MatrixM = Eigen::Matrix<Real, M, Eigen::Dynamic, Eigen::RowMajor>;
89 this->x.resize(Eigen::NoChange,
size);
90 this->h.resize(Eigen::NoChange,
size);
98 this->t.conservativeResize(
size);
99 this->x.conservativeResize(Eigen::NoChange,
size);
100 this->h.conservativeResize(Eigen::NoChange,
size);
109 this->x.resize(Eigen::NoChange, 0);
110 this->h.resize(Eigen::NoChange, 0);
119 return this->t.size() == 0 && this->x.cols()== 0 && this->h.cols() == 0;
134 return std::vector<Real>(this->t.data(), this->t.data() + this->t.size());
150 Vector tmp(this->x.row(i));
151 return std::vector<Real>(tmp.data(), tmp.data() + tmp.size());
158 std::map<Integer, std::vector<Real>>
std_x()
const
160 std::map<Integer, std::vector<Real>> x_map;
161 for (
Integer i{0}; i < N; ++i) {x_map[i] = this->
std_x(i);}
169 std::map<Integer, Vector>
eig_x()
const
171 std::map<Integer, Vector> x_map;
172 for (
Integer i{0}; i < N; ++i) {x_map[i] = this->x.row(i);}
181 std::map<std::string, std::vector<Real>>
std_x(std::vector<std::string>
const & names)
const
183 std::map<std::string, std::vector<Real>> x_map;
184 for (
Integer i{0}; i < N; ++i) {x_map[names[i]] = this->
std_x(i);}
193 std::map<std::string, Vector>
eig_x(std::vector<std::string>
const & names)
const
195 std::map<std::string, Vector> x_map;
196 for (
Integer i{0}; i < N; ++i) {x_map[names[i]] = this->x.row(i);}
207 Vector tmp(this->h.row(i));
208 return std::vector<Real>(tmp.data(), tmp.data() + tmp.size());
215 std::map<Integer, std::vector<Real>>
std_h()
const
217 std::map<Integer, std::vector<Real>> h_map;
218 for (
Integer i{0}; i < M; ++i) {h_map[i] = this->
std_h(i);}
226 std::map<Integer, Vector>
eig_h()
const
228 std::map<Integer, Vector> h_map;
229 for (
Integer i{0}; i < M; ++i) {h_map[i] = this->h.row(i);}
238 std::map<std::string, std::vector<Real>>
std_h(std::vector<std::string>
const & names)
const
240 std::map<std::string, std::vector<Real>> h_map;
241 for (
Integer i{0}; i < M; ++i) {h_map[names[i]] = this->
std_h(i);}
250 std::map<std::string, Vector>
eig_h(std::vector<std::string>
const & names)
const
252 std::map<std::string, Vector> h_map;
253 for (
Integer i{0}; i < M; ++i) {h_map[names[i]] = this->h.row(i);}
The namespace for the Sandals library.
Definition Sandals.hh:89
SANDALS_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Sandals.hh:97
MatrixN x
Definition Solution.hh:68
Solution()
Definition Solution.hh:74
Integer size() const
Definition Solution.hh:126
void resize(Integer const size)
Definition Solution.hh:87
bool is_empty() const
Definition Solution.hh:117
std::map< std::string, Vector > eig_x(std::vector< std::string > const &names) const
Definition Solution.hh:193
std::vector< Real > std_t() const
Definition Solution.hh:132
std::map< std::string, std::vector< Real > > std_h(std::vector< std::string > const &names) const
Definition Solution.hh:238
void conservative_resize(Integer const size)
Definition Solution.hh:97
Vector eig_t() const
Definition Solution.hh:141
Eigen::Matrix< Real, N, Eigen::Dynamic, Eigen::RowMajor > MatrixN
Definition Solution.hh:64
std::map< Integer, std::vector< Real > > std_h() const
Definition Solution.hh:215
std::map< Integer, std::vector< Real > > std_x() const
Definition Solution.hh:158
std::map< std::string, std::vector< Real > > std_x(std::vector< std::string > const &names) const
Definition Solution.hh:181
std::map< std::string, Vector > eig_h(std::vector< std::string > const &names) const
Definition Solution.hh:250
Eigen::Matrix< Real, M, Eigen::Dynamic, Eigen::RowMajor > MatrixM
Definition Solution.hh:65
Solution(Integer const size)
Definition Solution.hh:80
std::vector< Real > std_h(Integer const i) const
Definition Solution.hh:205
Vector t
Definition Solution.hh:67
void clear()
Definition Solution.hh:106
std::map< Integer, Vector > eig_x() const
Definition Solution.hh:169
MatrixM h
Definition Solution.hh:69
Eigen::Vector< Real, Eigen::Dynamic > Vector
Definition Solution.hh:63
std::map< Integer, Vector > eig_h() const
Definition Solution.hh:226
std::vector< Real > std_x(Integer i) const
Definition Solution.hh:148