From c44545bb18ef410d18b932a2870e95bccb0c993d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 26 Feb 2019 12:43:04 +0100 Subject: [PATCH] Dynare++: add some comments --- dynare++/sylv/cc/GeneralMatrix.hh | 6 +++++- dynare++/tl/cc/twod_matrix.hh | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dynare++/sylv/cc/GeneralMatrix.hh b/dynare++/sylv/cc/GeneralMatrix.hh index 37947dded..85d0bb26c 100644 --- a/dynare++/sylv/cc/GeneralMatrix.hh +++ b/dynare++/sylv/cc/GeneralMatrix.hh @@ -34,9 +34,11 @@ public: } ConstGeneralMatrix(const ConstGeneralMatrix &m) = default; ConstGeneralMatrix(ConstGeneralMatrix &&m) = default; - // Implicit conversion from ConstGeneralMatrix is ok, since it's cheap + // Implicit conversion from GeneralMatrix is ok, since it's cheap ConstGeneralMatrix(const GeneralMatrix &m); + // Create submatrix (with data sharing) ConstGeneralMatrix(const GeneralMatrix &m, int i, int j, int nrows, int ncols); + // Create submatrix (with data sharing) ConstGeneralMatrix(const ConstGeneralMatrix &m, int i, int j, int nrows, int ncols); virtual ~ConstGeneralMatrix() = default; @@ -155,7 +157,9 @@ public: GeneralMatrix(GeneralMatrix &&m) = default; GeneralMatrix(const GeneralMatrix &m, const std::string &dummy); // transpose GeneralMatrix(const ConstGeneralMatrix &m, const std::string &dummy); // transpose + // Create submatrix (with data copy) GeneralMatrix(const GeneralMatrix &m, int i, int j, int nrows, int ncols); + // Create submatrix (with data sharing) GeneralMatrix(GeneralMatrix &m, int i, int j, int nrows, int ncols); /* this = a*b */ GeneralMatrix(const ConstGeneralMatrix &a, const ConstGeneralMatrix &b); diff --git a/dynare++/tl/cc/twod_matrix.hh b/dynare++/tl/cc/twod_matrix.hh index f7af7d093..dbe948b06 100644 --- a/dynare++/tl/cc/twod_matrix.hh +++ b/dynare++/tl/cc/twod_matrix.hh @@ -97,26 +97,32 @@ public: : GeneralMatrix(m, dummy) { } + // Select only some columns (with data copy) TwoDMatrix(const TwoDMatrix &m, int first_col, int num) : GeneralMatrix(m, 0, first_col, m.numRows(), num) { } + // Select only some columns (with data sharing) TwoDMatrix(TwoDMatrix &m, int first_col, int num) : GeneralMatrix(m, 0, first_col, m.numRows(), num) { } + // Select only some rows (with data copy) TwoDMatrix(int first_row, int num, const TwoDMatrix &m) : GeneralMatrix(m, first_row, 0, num, m.ncols()) { } + // Select only some rows (with data sharing) TwoDMatrix(int first_row, int num, TwoDMatrix &m) : GeneralMatrix(m, first_row, 0, num, m.ncols()) { } + // Select a submatrix (with data sharing) TwoDMatrix(TwoDMatrix &m, int first_row, int first_col, int rows, int cols) : GeneralMatrix(m, first_row, first_col, rows, cols) { } + // Select a submatrix (with data copy) TwoDMatrix(const TwoDMatrix &m, int first_row, int first_col, int rows, int cols) : GeneralMatrix(m, first_row, first_col, rows, cols) {