Files
Aurora/src/Sparse.cpp

51 lines
1002 B
C++
Raw Normal View History

2023-05-29 09:37:04 +08:00
#include "Sparse.h"
#include "Matrix.h"
namespace Aurora
{
Sparse::Sparse()
{
}
Sparse::~Sparse()
{
}
2023-06-01 11:40:30 +08:00
Sparse::Sparse(Matrix RowIdxs, Matrix ColIdxs , Matrix Values,size_t M, size_t N)
: mColIdxVector(ColIdxs),
mRowIdxVector(RowIdxs),
2023-05-29 09:37:04 +08:00
mValueVector(Values),
mM(M),
mN(N)
{
}
bool Sparse::isValid() const
{
return mColIdxVector.isVector() && mRowIdxVector.isVector() && mValueVector.isVector()
&& mColIdxVector.getDataSize() == mRowIdxVector.getDataSize()
&& mColIdxVector.getDataSize() == mValueVector.getDataSize();
}
2023-05-30 14:48:51 +08:00
2023-05-30 17:53:21 +08:00
Matrix& Sparse::getColVector()
2023-05-30 14:48:51 +08:00
{
return mColIdxVector;
}
2023-05-30 17:53:21 +08:00
Matrix& Sparse::getRowVector()
2023-05-30 14:48:51 +08:00
{
return mRowIdxVector;
}
2023-05-30 17:53:21 +08:00
Matrix& Sparse::getValVector()
2023-05-30 14:48:51 +08:00
{
return mValueVector;
}
2023-05-30 17:53:21 +08:00
size_t Sparse::getM() const{
return mM;
}
size_t Sparse::getN() const{
return mN;
}
2023-05-29 09:37:04 +08:00
}