Add Matrix constructor with default value type,and isComplex function.

This commit is contained in:
sunwen
2023-04-20 17:27:44 +08:00
parent 16edf26a58
commit 65dd582f77
2 changed files with 19 additions and 3 deletions

View File

@@ -115,8 +115,11 @@ namespace Aurora{
namespace Aurora {
Matrix::Matrix(std::shared_ptr<double> aData, std::vector<int> aInfo)
: mData(aData), mInfo(aInfo) {
Matrix::Matrix(std::shared_ptr<double> aData, std::vector<int> aInfo, ValueType aValueType)
: mData(aData)
, mInfo(aInfo)
, mValueType(aValueType)
{
}
Matrix::Matrix(const Matrix::MatrixSlice& slice) {

View File

@@ -37,7 +37,8 @@ namespace Aurora {
friend class Matrix;
};
explicit Matrix(std::shared_ptr<double> aData = std::shared_ptr<double>(),
std::vector<int> aInfo = std::vector<int>());
std::vector<int> aInfo = std::vector<int>(),
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<double> mData;