Fix Matrix mInfo to column and slice with default value 1.

This commit is contained in:
sunwen
2023-04-21 13:46:35 +08:00
parent 7eac11272c
commit 16b48e0a6d

View File

@@ -212,10 +212,15 @@ namespace Aurora{
namespace Aurora {
Matrix::Matrix(std::shared_ptr<double> aData, std::vector<int> aInfo, ValueType aValueType)
: mData(aData)
: mValueType(aValueType)
, mData(aData)
, mInfo(aInfo)
, mValueType(aValueType)
{
size_t infoSize = aInfo.size();
for(;infoSize<3;++infoSize)
{
aInfo.push_back(1);
}
}
Matrix::Matrix(const Matrix::MatrixSlice& slice) {
@@ -230,7 +235,15 @@ namespace Aurora {
}
int Matrix::getDims() const {
return mInfo.size();
if(mInfo[2] > 1)
{
return 3;
}
if(mInfo[1] > 1)
{
return 2;
}
return 1;
}
double *Matrix::getData() const {
@@ -405,8 +418,8 @@ namespace Aurora {
void Matrix::printf() {
int k_count = getDimSize(2)==0?1:getDimSize(2);
int j_count = getDimSize(1)==0?1:getDimSize(1);
int k_count = getDimSize(2);
int j_count = getDimSize(1);
int complexstep = 1;
const char* mark = "+";
if(mValueType == Complex)