Add transpose and transpose's unittest.
This commit is contained in:
@@ -462,3 +462,29 @@ double Aurora::norm(const Matrix& aMatrix, NormMethod aNormMethod)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Matrix Aurora::transpose(const Matrix& aMatrix)
|
||||
{
|
||||
//not surpport for 3 dims.
|
||||
if(aMatrix.isNull() || aMatrix.getDimSize(2) > 1)
|
||||
{
|
||||
return Matrix();
|
||||
}
|
||||
size_t size = aMatrix.getDataSize();
|
||||
int row = aMatrix.getDimSize(0);
|
||||
int col = aMatrix.getDimSize(1);
|
||||
double* resultData;
|
||||
double* data = aMatrix.getData();
|
||||
if(aMatrix.isComplex())
|
||||
{
|
||||
resultData = Aurora::malloc(size, true);
|
||||
mkl_zomatcopy('C', 'T',row ,col, 1.0, (MKL_Complex16*)data, row, (MKL_Complex16*)resultData, col);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultData = Aurora::malloc(size);
|
||||
mkl_domatcopy('C', 'T',row ,col, 1.0, data, row, resultData, col);
|
||||
}
|
||||
|
||||
return Matrix::New(resultData,col,row,1,aMatrix.getValueType());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user