Add Matrix constructor with default value type,and isComplex function.
This commit is contained in:
@@ -115,8 +115,11 @@ namespace Aurora{
|
|||||||
|
|
||||||
|
|
||||||
namespace Aurora {
|
namespace Aurora {
|
||||||
Matrix::Matrix(std::shared_ptr<double> aData, std::vector<int> aInfo)
|
Matrix::Matrix(std::shared_ptr<double> aData, std::vector<int> aInfo, ValueType aValueType)
|
||||||
: mData(aData), mInfo(aInfo) {
|
: mData(aData)
|
||||||
|
, mInfo(aInfo)
|
||||||
|
, mValueType(aValueType)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix::Matrix(const Matrix::MatrixSlice& slice) {
|
Matrix::Matrix(const Matrix::MatrixSlice& slice) {
|
||||||
|
|||||||
15
src/Matrix.h
15
src/Matrix.h
@@ -37,7 +37,8 @@ namespace Aurora {
|
|||||||
friend class Matrix;
|
friend class Matrix;
|
||||||
};
|
};
|
||||||
explicit Matrix(std::shared_ptr<double> aData = std::shared_ptr<double>(),
|
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);
|
explicit Matrix(const Matrix::MatrixSlice& slice);
|
||||||
|
|
||||||
@@ -195,6 +196,18 @@ namespace Aurora {
|
|||||||
mValueType = aValueType;
|
mValueType = aValueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if the valueType is complex,
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool isComplex() const {
|
||||||
|
if(mValueType == Complex)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ValueType mValueType = Normal;
|
ValueType mValueType = Normal;
|
||||||
std::shared_ptr<double> mData;
|
std::shared_ptr<double> mData;
|
||||||
|
|||||||
Reference in New Issue
Block a user