/** Compute y <- alpha * x + y (elementwise addition) */ public static DoubleMatrix axpy(double da, DoubleMatrix dx, DoubleMatrix dy) { // NativeBlas.daxpy(dx.length, da, dx.data, 0, 1, dy.data, 0, 1); JavaBlas.raxpy(dx.length, da, dx.data, 0, 1, dy.data, 0, 1); return dy; }
/** Compute x <-> y (swap two matrices) */ public static DoubleMatrix swap(DoubleMatrix x, DoubleMatrix y) { // NativeBlas.dswap(x.length, x.data, 0, 1, y.data, 0, 1); JavaBlas.rswap(x.length, x.data, 0, 1, y.data, 0, 1); return y; }
/** Compute y <- x (copy a matrix) */ public static DoubleMatrix copy(DoubleMatrix x, DoubleMatrix y) { // NativeBlas.dcopy(x.length, x.data, 0, 1, y.data, 0, 1); JavaBlas.rcopy(x.length, x.data, 0, 1, y.data, 0, 1); return y; }
/** Compute x^T * y (dot product) */ public static float dot(FloatMatrix x, FloatMatrix y) { // return NativeBlas.sdot(x.length, x.data, 0, 1, y.data, 0, 1); return JavaBlas.rdot(x.length, x.data, 0, 1, y.data, 0, 1); }
/** Compute y <- alpha * x + y (elementwise addition) */ public static FloatMatrix axpy(float da, FloatMatrix dx, FloatMatrix dy) { // NativeBlas.saxpy(dx.length, da, dx.data, 0, 1, dy.data, 0, 1); JavaBlas.raxpy(dx.length, da, dx.data, 0, 1, dy.data, 0, 1); return dy; }
/** Compute y <- x (copy a matrix) */ public static FloatMatrix copy(FloatMatrix x, FloatMatrix y) { // NativeBlas.scopy(x.length, x.data, 0, 1, y.data, 0, 1); JavaBlas.rcopy(x.length, x.data, 0, 1, y.data, 0, 1); return y; }
/** Compute x <-> y (swap two matrices) */ public static FloatMatrix swap(FloatMatrix x, FloatMatrix y) { // NativeBlas.sswap(x.length, x.data, 0, 1, y.data, 0, 1); JavaBlas.rswap(x.length, x.data, 0, 1, y.data, 0, 1); return y; }
/** Compute x^T * y (dot product) */ public static double dot(DoubleMatrix x, DoubleMatrix y) { // return NativeBlas.ddot(x.length, x.data, 0, 1, y.data, 0, 1); return JavaBlas.rdot(x.length, x.data, 0, 1, y.data, 0, 1); }