This commit is contained in:
sunwen
2023-06-02 10:49:34 +08:00
2 changed files with 41 additions and 4 deletions

View File

@@ -10,9 +10,9 @@ namespace Aurora
{ {
} }
Sparse::Sparse(Matrix Cols, Matrix Rows, Matrix Values,size_t M, size_t N) Sparse::Sparse(Matrix RowIdxs, Matrix ColIdxs , Matrix Values,size_t M, size_t N)
: mColIdxVector(Cols), : mColIdxVector(ColIdxs),
mRowIdxVector(Rows), mRowIdxVector(RowIdxs),
mValueVector(Values), mValueVector(Values),
mM(M), mM(M),
mN(N) mN(N)
@@ -26,4 +26,26 @@ namespace Aurora
&& mColIdxVector.getDataSize() == mRowIdxVector.getDataSize() && mColIdxVector.getDataSize() == mRowIdxVector.getDataSize()
&& mColIdxVector.getDataSize() == mValueVector.getDataSize(); && mColIdxVector.getDataSize() == mValueVector.getDataSize();
} }
Matrix& Sparse::getColVector()
{
return mColIdxVector;
}
Matrix& Sparse::getRowVector()
{
return mRowIdxVector;
}
Matrix& Sparse::getValVector()
{
return mValueVector;
}
size_t Sparse::getM() const{
return mM;
}
size_t Sparse::getN() const{
return mN;
}
} }

View File

@@ -7,9 +7,24 @@ namespace Aurora {
{ {
public: public:
Sparse(); 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(); ~Sparse();
bool isValid() const; bool isValid() const;
Matrix& getColVector() ;
Matrix& getRowVector() ;
Matrix& getValVector() ;
/**
* @brief Rows
*
* @return size_t
*/
size_t getM() const;
/**
* @brief Cols
*
* @return size_t
*/
size_t getN() const;
// TODO:add operators // TODO:add operators
private: private:
Matrix mColIdxVector; Matrix mColIdxVector;