Fix Matrix free bug(with mkl_malloc)

This commit is contained in:
Krad
2023-04-20 09:32:58 +08:00
parent fedf13d5d0
commit 044de7be5f
2 changed files with 36 additions and 26 deletions

View File

@@ -14,16 +14,6 @@ namespace Aurora {
class Matrix {
public:
explicit Matrix(std::shared_ptr<double> aData = std::shared_ptr<double>(),
std::vector<int> aInfo = std::vector<int>());
static Matrix New(double *data, int rows, int cols = 0, int slices = 0, ValueType type = Normal);
static Matrix New(double *data, const Matrix &shapeMatrix);
static Matrix New(const Matrix &shapeMatrix);
/**
* 内部类MatrixSlice用于切片操作
*/
@@ -32,16 +22,27 @@ namespace Aurora {
MatrixSlice(int aSize,int aStride, double* aData,ValueType aType = Normal,int SliceMode = 1,int aSize2 = 0, int aStride2 = 0);
MatrixSlice& operator=(const MatrixSlice& slice);
MatrixSlice& operator=(const Matrix& matrix);
Matrix toMatrix();
Matrix toMatrix() const;
private:
int mSliceMode = 0;//0 scalar, 1 vector, 2 Matrix
double* mData;
int mSize;
int mSize2;
int mStride;
int mStride2;
int mSize=0;
int mSize2=0;
int mStride=1;
int mStride2=0;
ValueType mType;
friend class Matrix;
};
explicit Matrix(std::shared_ptr<double> aData = std::shared_ptr<double>(),
std::vector<int> aInfo = std::vector<int>());
explicit Matrix(const Matrix::MatrixSlice& slice);
static Matrix New(double *data, int rows, int cols = 0, int slices = 0, ValueType type = Normal);
static Matrix New(double *data, const Matrix &shapeMatrix);
static Matrix New(const Matrix &shapeMatrix);
Matrix getDataFromDims2(int aColumn);