Skip to content
Snippets Groups Projects
Commit cc7b3671 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[MaL] don't use std::size_t in EigenVector and EigenMatrix interface

parent 5d8ca6b6
No related branches found
No related tags found
No related merge requests found
...@@ -39,23 +39,23 @@ public: ...@@ -39,23 +39,23 @@ public:
* @param n the number of rows (that is equal to the number of columns) * @param n the number of rows (that is equal to the number of columns)
* @param n_nonzero_columns the number of non-zero columns used for preallocation * @param n_nonzero_columns the number of non-zero columns used for preallocation
*/ */
explicit EigenMatrix(std::size_t n, std::size_t n_nonzero_columns = 0) :_mat(n, n) explicit EigenMatrix(IndexType n, IndexType n_nonzero_columns = 0) :_mat(n, n)
{ {
if (n_nonzero_columns > 0) if (n_nonzero_columns > 0)
_mat.reserve(Eigen::VectorXi::Constant(n, n_nonzero_columns)); _mat.reserve(Eigen::VectorXi::Constant(n, n_nonzero_columns));
} }
/// return the number of rows /// return the number of rows
std::size_t getNumberOfRows() const { return _mat.rows(); } IndexType getNumberOfRows() const { return _mat.rows(); }
/// return the number of columns /// return the number of columns
std::size_t getNumberOfColumns() const { return _mat.cols(); } IndexType getNumberOfColumns() const { return _mat.cols(); }
/// return a start index of the active data range /// return a start index of the active data range
std::size_t getRangeBegin() const { return 0; } IndexType getRangeBegin() const { return 0; }
/// return an end index of the active data range /// return an end index of the active data range
std::size_t getRangeEnd() const { return getNumberOfRows(); } IndexType getRangeEnd() const { return getNumberOfRows(); }
/// reset data entries to zero. /// reset data entries to zero.
void setZero() void setZero()
......
...@@ -37,19 +37,19 @@ public: ...@@ -37,19 +37,19 @@ public:
/// Constructor for initialization of the number of rows /// Constructor for initialization of the number of rows
/// @param length number of rows /// @param length number of rows
explicit EigenVector(std::size_t length) : _vec(length) {} explicit EigenVector(IndexType length) : _vec(length) {}
/// copy constructor /// copy constructor
EigenVector(EigenVector const& src) = default; EigenVector(EigenVector const& src) = default;
/// return a vector length /// return a vector length
std::size_t size() const { return _vec.size(); } IndexType size() const { return _vec.size(); }
/// return a start index of the active data range /// return a start index of the active data range
std::size_t getRangeBegin() const { return 0;} IndexType getRangeBegin() const { return 0;}
/// return an end index of the active data range /// return an end index of the active data range
std::size_t getRangeEnd() const { return size(); } IndexType getRangeEnd() const { return size(); }
// TODO preliminary // TODO preliminary
void setZero() { _vec.setZero(); } void setZero() { _vec.setZero(); }
......
...@@ -133,8 +133,8 @@ void setMatrix(EigenMatrix& m, ...@@ -133,8 +133,8 @@ void setMatrix(EigenMatrix& m,
Eigen::MatrixXd tmp(rows, cols); Eigen::MatrixXd tmp(rows, cols);
auto it = values.begin(); auto it = values.begin();
for (std::size_t r=0; r<rows; ++r) { for (GlobalIndexType r=0; r<rows; ++r) {
for (std::size_t c=0; c<cols; ++c) { for (GlobalIndexType c=0; c<cols; ++c) {
tmp(r, c) = *(it++); tmp(r, c) = *(it++);
} }
} }
...@@ -157,8 +157,8 @@ void addToMatrix(EigenMatrix& m, ...@@ -157,8 +157,8 @@ void addToMatrix(EigenMatrix& m,
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> tmp(rows, cols); Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> tmp(rows, cols);
auto it = values.begin(); auto it = values.begin();
for (std::size_t r=0; r<rows; ++r) { for (GlobalIndexType r=0; r<rows; ++r) {
for (std::size_t c=0; c<cols; ++c) { for (GlobalIndexType c=0; c<cols; ++c) {
tmp(r, c) = *(it++); tmp(r, c) = *(it++);
} }
} }
......
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