Add floor to Function1D.
This commit is contained in:
@@ -201,6 +201,27 @@ Aurora::Matrix Aurora::round(const Aurora::Matrix &&matrix) {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
Aurora::Matrix Aurora::floor(const Aurora::Matrix &matrix) {
|
||||
auto output = malloc(matrix.getDataSize());
|
||||
//for real part
|
||||
vdRoundI(matrix.getDataSize(), matrix.getData(), SAME_STRIDE, output, SAME_STRIDE);
|
||||
if (matrix.getValueType() == Complex) {
|
||||
//for imag part
|
||||
vdFloorI(matrix.getDataSize(), matrix.getData() + 1, SAME_STRIDE, output + 1, SAME_STRIDE);
|
||||
}
|
||||
return Aurora::Matrix::New(output, matrix);
|
||||
}
|
||||
|
||||
Aurora::Matrix Aurora::floor(const Aurora::Matrix &&matrix) {
|
||||
//for real part
|
||||
vdRoundI(matrix.getDataSize(), matrix.getData(), SAME_STRIDE, matrix.getData(), SAME_STRIDE);
|
||||
if (matrix.getValueType() == Complex) {
|
||||
//for imag part
|
||||
vdFloorI(matrix.getDataSize(), matrix.getData() + 1, SAME_STRIDE, matrix.getData() + 1, SAME_STRIDE);
|
||||
}
|
||||
return matrix;
|
||||
}
|
||||
|
||||
Matrix Aurora::auroraNot(const Matrix& aMatrix){
|
||||
return auroraNot(std::forward<Matrix&&>(aMatrix.deepCopy()));
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@ namespace Aurora {
|
||||
|
||||
Matrix round(const Matrix&& matrix);
|
||||
|
||||
Matrix floor(const Matrix& matrix);
|
||||
|
||||
Matrix floor(const Matrix&& matrix);
|
||||
|
||||
/**
|
||||
* 开根号,暂时只支持正整数
|
||||
* @param matrix
|
||||
|
||||
Reference in New Issue
Block a user