Function2D fix for horn vector.
This commit is contained in:
@@ -126,8 +126,9 @@ Matrix Aurora::std(const Matrix &aMatrix) {
|
||||
|
||||
Matrix src = aMatrix.isComplex() ? Aurora::abs(aMatrix) : aMatrix;
|
||||
int calc_size = src.getDimSize(0) == 1 ? src.getDimSize(1) : src.getDimSize(0);
|
||||
auto std = Aurora::malloc(aMatrix.getDimSize(1));
|
||||
for (int i = 0; i < src.getDimSize(1); ++i) {
|
||||
int col = src.getDimSize(0) == 1?1:src.getDimSize(1) ;
|
||||
auto std = Aurora::malloc(col);
|
||||
for (int i = 0; i < col; ++i) {
|
||||
double *p = src.getData() + i * calc_size;
|
||||
double mean = cblas_dasum(calc_size, p, 1) / calc_size;
|
||||
vdSubI(calc_size, p, 1, &mean, 0, p, 1);
|
||||
@@ -135,7 +136,7 @@ Matrix Aurora::std(const Matrix &aMatrix) {
|
||||
std[i] = cblas_dasum(calc_size, p, 1) / (calc_size - 1);
|
||||
}
|
||||
vdSqrt(src.getDimSize(1), std, std);
|
||||
return Matrix::New(std, 1, aMatrix.getDimSize(1), aMatrix.getDimSize(2));
|
||||
return Matrix::New(std, 1, col, aMatrix.getDimSize(2));
|
||||
|
||||
}
|
||||
|
||||
@@ -407,7 +408,7 @@ Matrix Aurora::mean(const Matrix &aMatrix, FunctionDirection direction, bool aIn
|
||||
{
|
||||
Eigen::Map<Eigen::MatrixXd> srcM(aMatrix.getData(),aMatrix.getDimSize(0),aMatrix.getDimSize(1));
|
||||
double * ret = malloc(aMatrix.getDimSize(1));
|
||||
Eigen::Map<Eigen::VectorXd> retV(ret,aMatrix.getDimSize(0));
|
||||
Eigen::Map<Eigen::VectorXd> retV(ret,aMatrix.getDimSize(1));
|
||||
retV = srcM.colwise().mean();
|
||||
return Matrix::New(ret,1,aMatrix.getDimSize(1));
|
||||
}
|
||||
@@ -497,6 +498,10 @@ Matrix Aurora::sort(Matrix &&aMatrix) {
|
||||
<< std::endl;
|
||||
return Matrix();
|
||||
}
|
||||
//针对向量行等于列
|
||||
if (aMatrix.getDimSize(0)==1){
|
||||
return sortrows(aMatrix);
|
||||
}
|
||||
if (aMatrix.getDimSize(0)>=100000){
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < aMatrix.getDimSize(1); ++i) {
|
||||
@@ -562,7 +567,7 @@ Matrix Aurora::median(const Matrix &aMatrix) {
|
||||
int rows = horVector?sorted.getDimSize(1):sorted.getDimSize(0);
|
||||
int cols = horVector?sorted.getDimSize(0):sorted.getDimSize(1);
|
||||
Eigen::Map<Eigen::MatrixXd> srcM(sorted.getData(),rows,cols);
|
||||
bool flag = aMatrix.getDimSize(0) % 2 == 1;
|
||||
bool flag = rows % 2 == 1;
|
||||
double* ret = malloc(cols);
|
||||
Eigen::Map<Eigen::VectorXd> retV(ret,cols);
|
||||
if (flag) {
|
||||
|
||||
Reference in New Issue
Block a user