Arrange Test directory.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <iostream>
|
||||
#include "Function.h"
|
||||
#include "Function2D.h"
|
||||
#include "Function1D.h"
|
||||
#include "mkl.h"
|
||||
|
||||
using namespace Aurora;
|
||||
@@ -109,3 +110,18 @@ Matrix Aurora::interpn(const Matrix& aX, const Matrix& aY, const Matrix& aV, con
|
||||
{
|
||||
return Aurora::interp2(aY,aX,aV,aY1,aX1,aMethod);
|
||||
}
|
||||
|
||||
Matrix Aurora::std(const Matrix &aMatrix) {
|
||||
auto std = Aurora::malloc(aMatrix.getDimSize(1) * aMatrix.getDimSize(2));
|
||||
Matrix src = aMatrix.isComplex() ? Aurora::abs(aMatrix) : aMatrix;
|
||||
for (int i = 0; i < src.getDimSize(1); ++i) {
|
||||
double *p = src.getData() + i * src.getDimSize(0);
|
||||
double mean = cblas_dasum(src.getDimSize(0), p, 1) / src.getDimSize(0);
|
||||
vdSubI(src.getDimSize(0), p, 1, &mean, 0, p, 1);
|
||||
vdSqr(src.getDimSize(0), p, p);
|
||||
std[i] = cblas_dasum(src.getDimSize(0), p, 1) / (src.getDimSize(0) - 1);
|
||||
}
|
||||
vdSqrt(src.getDimSize(1), std, std);
|
||||
|
||||
return Matrix::New(std,1,aMatrix.getDimSize(1), aMatrix.getDimSize(2));
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Aurora {
|
||||
Matrix inv(Matrix&& aMatrix);
|
||||
Matrix interp2(const Matrix& aX, const Matrix& aY, const Matrix& aV, const Matrix& aX1, const Matrix& aY1, InterpnMethod aMethod);
|
||||
Matrix interpn(const Matrix& aX, const Matrix& aY, const Matrix& aV, const Matrix& aX1, const Matrix& aY1, InterpnMethod aMethod);
|
||||
|
||||
Matrix std(const Matrix& aMatrix);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user