Example #1
0
  /** 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;
  }
Example #2
0
 /** 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;
 }
Example #3
0
 /** 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;
 }
Example #4
0
 /** 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);
 }
Example #5
0
  /** 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;
  }
Example #6
0
 /** 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;
 }
Example #7
0
 /** 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;
 }
Example #8
0
 /** 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);
 }