From e9be863a6712cfa6283e90f810370a97b9a400c8 Mon Sep 17 00:00:00 2001 From: kradchen Date: Tue, 30 May 2023 14:48:51 +0800 Subject: [PATCH 1/3] Add Sparse functions. --- src/Sparse.cpp | 15 +++++++++++++++ src/Sparse.h | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/src/Sparse.cpp b/src/Sparse.cpp index 293685e..eef45b6 100644 --- a/src/Sparse.cpp +++ b/src/Sparse.cpp @@ -26,4 +26,19 @@ namespace Aurora && mColIdxVector.getDataSize() == mRowIdxVector.getDataSize() && mColIdxVector.getDataSize() == mValueVector.getDataSize(); } + + Matrix& Sparse::getColVector() + { + return mColIdxVector; + } + + Matrix& Sparse::getRowVector() + { + return mRowIdxVector; + } + + Matrix& Sparse::getValVector() + { + return mValueVector; + } } \ No newline at end of file diff --git a/src/Sparse.h b/src/Sparse.h index 67fc470..25a43c0 100644 --- a/src/Sparse.h +++ b/src/Sparse.h @@ -10,6 +10,10 @@ namespace Aurora { Sparse(Matrix Cols, Matrix Rows, Matrix Values,size_t M, size_t N); ~Sparse(); bool isValid() const; + Matrix& getColVector(); + Matrix& getRowVector(); + Matrix& getValVector(); + // TODO:add operators private: Matrix mColIdxVector; From b7e3970dcee8489490d2f7c3667f52d5e41a60a7 Mon Sep 17 00:00:00 2001 From: kradchen Date: Tue, 30 May 2023 17:53:21 +0800 Subject: [PATCH 2/3] Add function to Sparse --- src/Sparse.cpp | 13 ++++++++++--- src/Sparse.h | 9 +++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Sparse.cpp b/src/Sparse.cpp index eef45b6..4b6d8fe 100644 --- a/src/Sparse.cpp +++ b/src/Sparse.cpp @@ -27,18 +27,25 @@ namespace Aurora && mColIdxVector.getDataSize() == mValueVector.getDataSize(); } - Matrix& Sparse::getColVector() + Matrix& Sparse::getColVector() { return mColIdxVector; } - Matrix& Sparse::getRowVector() + Matrix& Sparse::getRowVector() { return mRowIdxVector; } - Matrix& Sparse::getValVector() + Matrix& Sparse::getValVector() { return mValueVector; } + size_t Sparse::getM() const{ + return mM; + } + + size_t Sparse::getN() const{ + return mN; + } } \ No newline at end of file diff --git a/src/Sparse.h b/src/Sparse.h index 25a43c0..3c0f27a 100644 --- a/src/Sparse.h +++ b/src/Sparse.h @@ -10,10 +10,11 @@ namespace Aurora { Sparse(Matrix Cols, Matrix Rows, Matrix Values,size_t M, size_t N); ~Sparse(); bool isValid() const; - Matrix& getColVector(); - Matrix& getRowVector(); - Matrix& getValVector(); - + Matrix& getColVector() ; + Matrix& getRowVector() ; + Matrix& getValVector() ; + size_t getM() const ; + size_t getN() const; // TODO:add operators private: Matrix mColIdxVector; From ac24876e53c7358616ab32f1658d6e4ce3997885 Mon Sep 17 00:00:00 2001 From: kradchen Date: Thu, 1 Jun 2023 11:40:30 +0800 Subject: [PATCH 3/3] Change Sparse --- src/Sparse.cpp | 6 +++--- src/Sparse.h | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Sparse.cpp b/src/Sparse.cpp index 4b6d8fe..11874ec 100644 --- a/src/Sparse.cpp +++ b/src/Sparse.cpp @@ -10,9 +10,9 @@ namespace Aurora { } - Sparse::Sparse(Matrix Cols, Matrix Rows, Matrix Values,size_t M, size_t N) - : mColIdxVector(Cols), - mRowIdxVector(Rows), + Sparse::Sparse(Matrix RowIdxs, Matrix ColIdxs , Matrix Values,size_t M, size_t N) + : mColIdxVector(ColIdxs), + mRowIdxVector(RowIdxs), mValueVector(Values), mM(M), mN(N) diff --git a/src/Sparse.h b/src/Sparse.h index 3c0f27a..e80b83e 100644 --- a/src/Sparse.h +++ b/src/Sparse.h @@ -7,13 +7,23 @@ namespace Aurora { { public: Sparse(); - Sparse(Matrix Cols, Matrix Rows, Matrix Values,size_t M, size_t N); + Sparse(Matrix RowIdxs, Matrix ColIdxs, Matrix Values,size_t M, size_t N); ~Sparse(); bool isValid() const; Matrix& getColVector() ; Matrix& getRowVector() ; Matrix& getValVector() ; - size_t getM() const ; + /** + * @brief Rows + * + * @return size_t + */ + size_t getM() const; + /** + * @brief Cols + * + * @return size_t + */ size_t getN() const; // TODO:add operators private: