Add reshape and reshape's unittest.

This commit is contained in:
sunwen
2023-04-26 17:57:34 +08:00
parent abe69eb26d
commit 4f9b2ce392
3 changed files with 28 additions and 1 deletions

View File

@@ -614,7 +614,6 @@ Matrix Aurora::intersect(const Matrix& aMatrix1, const Matrix& aMatrix2, Matrix&
iaResult[i] = j + 1;
break;
}
}
}
@@ -622,3 +621,12 @@ Matrix Aurora::intersect(const Matrix& aMatrix1, const Matrix& aMatrix2, Matrix&
return result;
}
Matrix Aurora::reshape(const Matrix& aMatrix, int aRows, int aColumns, int aSlices)
{
if(aMatrix.isNull() || (aMatrix.getDataSize() != aRows * aColumns * aSlices))
{
return Matrix();
}
return Matrix::copyFromRawData(aMatrix.getData(),aRows,aColumns,aSlices);
}

View File

@@ -77,6 +77,8 @@ namespace Aurora {
Matrix auroraUnion(const Matrix& aMatrix1, const Matrix& aMatrix2);
Matrix intersect(const Matrix& aMatrix1, const Matrix& aMatrix2);
Matrix reshape(const Matrix& aMatrix, int aRows, int aColumns, int aSlices);
/**
* 并集
* @param aIa, [C,ia,~] = intersect(A,B)用法中ia的返回值