Aurora not function

This commit is contained in:
kradchen
2023-05-15 16:18:29 +08:00
parent ff534dfd63
commit 9c09e349d3
2 changed files with 17 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
#include <Eigen/SVD>
#include <mkl_lapack.h>
#include <sys/types.h>
#include <utility>
using namespace Aurora;
@@ -199,6 +200,19 @@ Aurora::Matrix Aurora::round(const Aurora::Matrix &&matrix) {
return matrix;
}
Matrix Aurora::auroraNot(const Matrix& aMatrix){
return auroraNot(std::forward<Matrix&&>(aMatrix.deepCopy()));
}
Matrix Aurora::auroraNot(Matrix&& aMatrix){
Eigen::Map<Eigen::VectorXd> v2(aMatrix.getData(), aMatrix.getDataSize());
v2 = (v2.array()>0).select(1,v2);
v2 = (v2.array()<0).select(0,v2);
v2 = v2.array()+1.0;
v2 = (v2.array() == 2.0).select(0.0, v2);
return aMatrix;
}
Aurora::Matrix Aurora::sqrt(const Aurora::Matrix& matrix) {
if (matrix.getValueType() != Complex) {

View File

@@ -113,6 +113,9 @@ namespace Aurora {
*/
void padding(Matrix& aMatrix, int aIndex, double aValue);
Matrix auroraNot(const Matrix& aMatrix);
Matrix auroraNot(Matrix&& aMatrix);
Matrix convertfp16tofloat(short* aData, int aRows, int aColumns);
};