Example #1
0
 public static NDArray matmul(NDArray x, NDArray y)
 => BackendFactory.GetEngine().MatMul(x, y);
Example #2
0

        
Example #3
0

        
Example #4
0
 /// <summary>
 /// Matrix or vector product between given NDArray and 2nd one.
 /// if both NDArrays are 1D, scalar product is returned independend of shape
 /// if both NDArrays are 2D matrix product is returned.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 public static NDArray dot(NDArray x, NDArray y)
 => BackendFactory.GetEngine().Dot(x, y);
Example #5
0

        
Example #6
0

        
Example #7
0
 /// <summary>
 /// Sum of array elements over a given axis.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="axis"></param>
 /// <returns></returns>
 public static NDArray sum(NDArray x, int?axis = null)
 => BackendFactory.GetEngine().Sum(x, axis: axis);
Example #8
0
 /// <summary>
 /// Test whether all array elements along a given axis evaluate to True.
 /// </summary>
 /// <param name="nd"></param>
 /// <param name="axis"></param>
 /// <returns>Returns an array of bools</returns>
 public static NDArray <bool> all(NDArray nd, int axis)
 => BackendFactory.GetEngine().All(nd, axis);
Example #9
0
 /// <summary>
 /// Constructor for init data type
 /// internal storage is 1D with 1 element
 /// </summary>
 /// <param name="dtype">Data type of elements</param>
 public NDArray(Type dtype)
 {
     TensorEngine = BackendFactory.GetEngine();
     Storage      = BackendFactory.GetStorage(dtype);
 }
Example #10
0
 public static NDArray divide(NDArray x, NDArray y)
 => BackendFactory.GetEngine().Divide(x, y);
 public static NDArray ndarray(Shape shape, Type dtype = null, Array buffer = null, char order = 'F')
 => BackendFactory.GetEngine().CreateNDArray(shape, dtype: dtype, buffer: buffer, order: order);
Example #12
0
 /// <summary>
 /// Test element-wise for finiteness (not infinity or not Not a Number).
 /// </summary>
 /// <param name="a"></param>
 /// <returns>The result is returned as a boolean array.</returns>
 public static NDArray <bool> isfinite(NDArray a)
 => BackendFactory.GetEngine().IsFinite(a);
Example #13
0
 /// <summary>
 /// Returns a boolean array where two arrays are element-wise equal within a
 /// tolerance.
 /// The tolerance values are positive, typically very small numbers.The
 /// relative difference (`rtol` * abs(`b`)) and the absolute difference
 /// `atol` are added together to compare against the absolute difference
 /// between `a` and `b`.
 /// Warning: The default `atol` is not appropriate for comparing numbers
 /// that are much smaller than one(see Notes).
 ///
 /// See also <seealso cref="allclose"/>
 ///
 ///Notes:
 /// For finite values, isclose uses the following equation to test whether
 /// two floating point values are equivalent.
 /// <code>absolute(`a` - `b`) less than or equal to (`atol` + `rtol` * absolute(`b`))</code>
 /// Unlike the built-in `math.isclose`, the above equation is not symmetric
 /// in `a` and `b` -- it assumes `b` is the reference value -- so that
 /// `isclose(a, b)` might be different from `isclose(b, a)`. Furthermore,
 /// the default value of atol is not zero, and is used to determine what
 /// small values should be considered close to zero.The default value is
 /// appropriate for expected values of order unity: if the expected values
 /// are significantly smaller than one, it can result in false positives.
 /// `atol` should be carefully selected for the use case at hand. A zero value
 /// for `atol` will result in `False` if either `a` or `b` is zero.
 /// </summary>
 /// <param name="a">Input array to compare with b</param>
 /// <param name="b">Input array to compare with a.</param>
 /// <param name="rtol">The relative tolerance parameter(see Notes)</param>
 /// <param name="atol">The absolute tolerance parameter(see Notes)</param>
 /// <param name="equal_nan">Whether to compare NaN's as equal.  If True, NaN's in `a` will be
 ///considered equal to NaN's in `b` in the output array.</param>
 ///<returns>
 ///  Returns a boolean array of where `a` and `b` are equal within the
 /// given tolerance.If both `a` and `b` are scalars, returns a single
 /// boolean value.
 ///</returns>
 public static NDArray <bool> isclose(NDArray a, NDArray b, double rtol = 1.0E-5, double atol = 1.0E-8,
                                      bool equal_nan = false)
 => BackendFactory.GetEngine().IsClose(a, b, rtol, atol, equal_nan);
Example #14
0

        
Example #15
0

        
Example #16
0
 /// <summary>
 /// Test element-wise for Not a Number.
 /// </summary>
 /// <param name="a"></param>
 /// <returns>The result is returned as a boolean array.</returns>
 public static NDArray <bool> isnan(NDArray a)
 => BackendFactory.GetEngine().IsNan(a);
Example #17
0
 /// <summary>
 /// Test whether all array elements evaluate to True.
 /// </summary>
 /// <param name="nd"></param>
 /// <returns></returns>
 public static bool all(NDArray nd)
 => BackendFactory.GetEngine().All(nd);