Matrix class update.

This commit is contained in:
Krad
2023-04-19 15:54:52 +08:00
parent 0d98d313a5
commit 3b7c918cf1
4 changed files with 296 additions and 50 deletions

View File

@@ -4,12 +4,13 @@
#include <memory>
#include <vector>
#define ALL_DIM -1
namespace Aurora {
enum ValueType{
Normal=1,
Complex
};
const int $ = -1;
class Matrix {
public:
@@ -28,14 +29,17 @@ namespace Aurora {
*/
class MatrixSlice{
public:
MatrixSlice(int aSize,int aStride, double* aData,ValueType aType = Normal);
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();
private:
int mSliceMode = 0;//0 scalar, 1 vector, 2 Matrix
double* mData;
int mSize;
int mSize2;
int mStride;
int mStride2;
ValueType mType;
};
@@ -50,7 +54,7 @@ namespace Aurora {
Matrix deepCopy() const;
//切片,暂时不支持三维
MatrixSlice operator()(int r, int c = ALL_DIM, int s = ALL_DIM) const;
MatrixSlice operator()(int r, int c = $, int aSliceIdx = $) const;
// add
Matrix operator+(double aScalar) const;