Fix sparse and function size

This commit is contained in:
kradchen
2023-05-29 16:18:27 +08:00
parent eb98e532b9
commit ea3496372f
3 changed files with 6 additions and 5 deletions

View File

@@ -97,9 +97,10 @@ Matrix Aurora::size(const Matrix &aMatrix)
return Matrix::New(output,1,1,1); return Matrix::New(output,1,1,1);
} }
else if (aMatrix.isVector()){ else if (aMatrix.isVector()){
double * output = Aurora::malloc(1); double * output = Aurora::malloc(2);
output[0]=aMatrix.getDataSize(); output[0]=aMatrix.getDimSize(0);
return Matrix::New(output,1,1,1); output[1]=aMatrix.getDimSize(0);
return Matrix::New(output,2,1,1);
} }
//3D //3D
else if (aMatrix.getDimSize(2)>1){ else if (aMatrix.getDimSize(2)>1){

View File

@@ -10,7 +10,7 @@ namespace Aurora
{ {
} }
Sparse::Sparse(Matrix& Cols, Matrix& Rows, Matrix& Values,size_t M, size_t N) Sparse::Sparse(Matrix Cols, Matrix Rows, Matrix Values,size_t M, size_t N)
: mColIdxVector(Cols), : mColIdxVector(Cols),
mRowIdxVector(Rows), mRowIdxVector(Rows),
mValueVector(Values), mValueVector(Values),

View File

@@ -7,7 +7,7 @@ namespace Aurora {
{ {
public: public:
Sparse(); Sparse();
Sparse(Matrix& Cols, Matrix& Rows, Matrix& Values,size_t M, size_t N); Sparse(Matrix Cols, Matrix Rows, Matrix Values,size_t M, size_t N);
~Sparse(); ~Sparse();
bool isValid() const; bool isValid() const;
// TODO:add operators // TODO:add operators