From 65dd582f77b1b25ff2b021dd8c54728b35460b90 Mon Sep 17 00:00:00 2001 From: sunwen Date: Thu, 20 Apr 2023 17:27:44 +0800 Subject: [PATCH] Add Matrix constructor with default value type,and isComplex function. --- src/Matrix.cpp | 7 +++++-- src/Matrix.h | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Matrix.cpp b/src/Matrix.cpp index bf7b8d2..0228ebf 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -115,8 +115,11 @@ namespace Aurora{ namespace Aurora { - Matrix::Matrix(std::shared_ptr aData, std::vector aInfo) - : mData(aData), mInfo(aInfo) { + Matrix::Matrix(std::shared_ptr aData, std::vector aInfo, ValueType aValueType) + : mData(aData) + , mInfo(aInfo) + , mValueType(aValueType) + { } Matrix::Matrix(const Matrix::MatrixSlice& slice) { diff --git a/src/Matrix.h b/src/Matrix.h index b2a61d9..c876949 100644 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -37,7 +37,8 @@ namespace Aurora { friend class Matrix; }; explicit Matrix(std::shared_ptr aData = std::shared_ptr(), - std::vector aInfo = std::vector()); + std::vector aInfo = std::vector(), + ValueType aValueType = Normal); explicit Matrix(const Matrix::MatrixSlice& slice); @@ -195,6 +196,18 @@ namespace Aurora { mValueType = aValueType; } + /** + * return true if the valueType is complex, + * @return + */ + bool isComplex() const { + if(mValueType == Complex) + { + return true; + } + return false; + } + private: ValueType mValueType = Normal; std::shared_ptr mData;