Skip to content
Snippets Groups Projects
Commit fd8b1285 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Small documentation

parent 1e89b446
No related branches found
No related tags found
2 merge requests!358WIP: Resolve "Complete state vector new data structure?",!343WIP: Resolve "Complete state vector new data structure?"
Pipeline #5120 passed
...@@ -44,6 +44,7 @@ class MatrixComposite ...@@ -44,6 +44,7 @@ class MatrixComposite
const std::string &_col, const std::string &_col,
const Eigen::MatrixXd &_mat_blk); const Eigen::MatrixXd &_mat_blk);
// throw error if queried block is not present
bool at(const std::string &_row, bool at(const std::string &_row,
const std::string &_col, const std::string &_col,
Eigen::MatrixXd &_mat_blk) const; Eigen::MatrixXd &_mat_blk) const;
...@@ -52,6 +53,7 @@ class MatrixComposite ...@@ -52,6 +53,7 @@ class MatrixComposite
MatrixXd& at(const std::string &_row, MatrixXd& at(const std::string &_row,
const std::string &_col); const std::string &_col);
// return zero-size matrix if queried block is not present
MatrixXd& operator ()(const std::string &_row, MatrixXd& operator ()(const std::string &_row,
const std::string &_col); const std::string &_col);
const MatrixXd& operator ()(const std::string &_row, const MatrixXd& operator ()(const std::string &_row,
......
...@@ -176,6 +176,15 @@ TEST(MatrixComposite, productVector) ...@@ -176,6 +176,15 @@ TEST(MatrixComposite, productVector)
ASSERT_MATRIX_APPROX(y.at("P"), yp, 1e-20); ASSERT_MATRIX_APPROX(y.at("P"), yp, 1e-20);
ASSERT_MATRIX_APPROX(y.at("O"), yo, 1e-20); ASSERT_MATRIX_APPROX(y.at("O"), yo, 1e-20);
// throw if x has extra blocks
// x.emplace("V", Vector2d(3,3));
// ASSERT_DEATH(y = M * x , ""); // M * x --> does not die if x has extra blocks wrt M
// throw if x has missing blocks
// x.erase("O");
// cout << "x = " << x << endl;
// ASSERT_DEATH(y = M * x , ""); // M * x --> exception if x has missing blocks wrt M, not caught by ASSERT_DEATH
} }
TEST(MatrixComposite, productMatrix) TEST(MatrixComposite, productMatrix)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment