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());
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace Aurora {
|
||||
|
||||
double norm(const Matrix& aMatrix, NormMethod aNormMethod);
|
||||
|
||||
Matrix transpose(const Matrix& aMatrix);
|
||||
|
||||
/**
|
||||
* 多项式计算
|
||||
* @brief 例如p[1 0 1],x[3 2 5],代表对多项式 y = x^2 + 1 求(x=3, x=2, x=5)时所有的y
|
||||
|
||||
Reference in New Issue
Block a user