Esempio n. 1
0
 public static Array <Real> Div(this Array <Real> a, Array <Real> b, Array <Real> result = null)
 {
     return(Array_.ElementwiseOp(a, b, result,
                                 (n, x, offsetx, incx, y, offsety, incy, z, offsetz, incz) =>
     {
         if (incx == 1 && incy == 1 && incz == 1)
         {
             Blas.vdiv(n, x, offsetx, y, offsety, z, offsetz);
         }
         // TODO: else if (incx == 0) dgemv 1/x
         // TODO: else if (incy == 0) dgemv 1/y
         else
         {
             for (int i = 0; i < n; i++)
             {
                 z[offsetz] = x[offsetx] / y[offsety];
                 offsetx += incx;
                 offsety += incy;
                 offsetz += incz;
             }
         }
     }));
 }