From 0b1325e3b11bd3e760e82c74de3dd84ff797ce81 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Mon, 27 Nov 2023 17:21:50 +0000 Subject: [PATCH] MatrixTile: use std::size_t consistently Signed-off-by: Joseph Schuchart --- examples/matrixtile.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/matrixtile.h b/examples/matrixtile.h index 21bfa5aa6..51f384226 100644 --- a/examples/matrixtile.h +++ b/examples/matrixtile.h @@ -12,14 +12,14 @@ template > class MatrixTile : public ttg::TTValue> { public: - using metadata_t = typename std::tuple; + using metadata_t = typename std::tuple; using buffer_t = typename ttg::buffer; using ttvalue_type = ttg::TTValue>; private: buffer_t _buffer; - int _rows = 0, _cols = 0, _lda = 0; + std::size_t _rows = 0, _cols = 0, _lda = 0; #ifdef DEBUG_TILES_VALUES mutable std::optional _norm; #endif // DEBUG_TILES_VALUES @@ -36,7 +36,7 @@ class MatrixTile : public ttg::TTValue> { public: MatrixTile() {} - MatrixTile(int rows, int cols, int lda) + MatrixTile(std::size_t rows, std::size_t cols, std::size_t lda) : ttvalue_type() , _buffer(lda*cols) , _rows(rows) @@ -54,7 +54,7 @@ class MatrixTile : public ttg::TTValue> { * Constructor with outside memory. The tile will *not* delete this memory * upon destruction. */ - MatrixTile(int rows, int cols, T* data, int lda) + MatrixTile(std::size_t rows, std::size_t cols, T* data, std::size_t lda) : ttvalue_type() , _buffer(data, lda*cols) , _rows(rows) @@ -108,11 +108,11 @@ class MatrixTile : public ttg::TTValue> { size_t size() const { return _cols * _lda; } - int rows() const { return _rows; } + std::size_t rows() const { return _rows; } - int cols() const { return _cols; } + std::size_t cols() const { return _cols; } - int lda() const { return _lda; } + std::size_t lda() const { return _lda; } buffer_t& buffer() { return _buffer; @@ -145,10 +145,10 @@ class MatrixTile : public ttg::TTValue> { auto ptr = tt.data(); o << std::endl << " "; o << "MatrixTile<" << typeid(T).name() << ">{ rows=" << tt.rows() << " cols=" << tt.cols() << " ld=" << tt.lda(); -#if DEBUG_TILES_VALUES +#if DEBUG_TILES_VALUES && 0 o << " data=[ "; - for (int i = 0; i < tt.rows(); i++) { - for (int j = 0; j < tt.cols(); j++) { + for (std::size_t i = 0; i < tt.rows(); i++) { + for (std::size_t j = 0; j < tt.cols(); j++) { o << ptr[i + j * tt.lda()] << " "; } o << std::endl << " "; @@ -187,7 +187,7 @@ namespace madness { template struct ArchiveLoadImpl> { static inline void load(const Archive& ar, MatrixTile& tile) { - int rows, cols, lda; + std::size_t rows, cols, lda; ar >> rows >> cols >> lda; tile = MatrixTile(rows, cols, lda); ar >> wrap(tile.data(), tile.rows() * tile.cols()); // MatrixTile(bm.rows(), bm.cols());