public static long CountAll(Array arr) { double r, i; Internal.VERIFY(AFAlgorithm.af_count_all(out r, out i, arr._ptr)); return((long)r); }
public static Array SetUnique(Array arr, bool isSorted = false) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_set_unique(out ptr, arr._ptr, isSorted)); return(new Array(ptr)); }
public static Complex Min(AFArray arr) { double r, i; Internal.VERIFY(AFAlgorithm.af_min_all(out r, out i, arr._ptr)); return(new Complex(r, i)); }
public static Array AllTrue(Array arr, int dim = -1) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_all_true(out ptr, arr._ptr, getFNSD(dim, arr.Dimensions))); return(new Array(ptr)); }
public static NDArray Prod(NDArray arr, int dim) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_product(out ptr, arr._ptr, dim)); return(new NDArray(ptr)); }
public static double Min(SuperArray arr) { double r, i; Internal.VERIFY(AFAlgorithm.af_min_all(out r, out i, arr.variable._ptr)); return(r); }
public static Array SetIntersect(Array arr1, Array arr2, bool isUnique = false) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_set_intersect(out ptr, arr1._ptr, arr2._ptr, isUnique)); return(new Array(ptr)); }
public static (AFArray, AFArray) Grad(AFArray @in) { IntPtr dx, dy; Internal.VERIFY(AFAlgorithm.af_gradient(out dx, out dy, @in._ptr)); return(new AFArray(dx), new AFArray(dy)); }
public static Array Sort(Array arr, uint dim = 0, bool isAscending = true) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_sort(out ptr, arr._ptr, dim, isAscending)); return(new Array(ptr)); }
public static AFArray Max(AFArray arr, int dim) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_max(out ptr, arr._ptr, dim)); return(new AFArray(ptr)); }
public static Array Diff2(Array arr, int dim = 0) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_diff2(out ptr, arr._ptr, dim)); return(new Array(ptr)); }
public static Array Where(Array arr) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_where(out ptr, arr._ptr)); return(new Array(ptr)); }
public static Array ScanByKey(Array key, Array arr, int dim, af_binary_op op, bool inclusive_scan = true) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_scan_by_key(out ptr, key._ptr, arr._ptr, getFNSD(dim, arr.Dimensions), op, inclusive_scan)); return(new Array(ptr)); }
public static Complex Prod(NDArray arr) { double r, i; Internal.VERIFY(AFAlgorithm.af_product_all(out r, out i, arr._ptr)); return(new Complex(r, i)); }
public static Array Product(Array arr, int dim, double nanval) { IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_product_nan(out ptr, arr._ptr, getFNSD(dim, arr.Dimensions), nanval)); return(new Array(ptr)); }
public static SuperArray Min(SuperArray arr, uint dim) { AFArray y = CreateMajorSupportedArray(arr); IntPtr ptr; Internal.VERIFY(AFAlgorithm.af_min(out ptr, y._ptr, (int)dim)); return(new SuperArray(new AFArray(ptr))); }
public static Array Sort(Array arr, out Array indices, uint dim = 0, bool isAscending = true) { IntPtr outPtr, indPtr; Internal.VERIFY(AFAlgorithm.af_sort_index(out outPtr, out indPtr, arr._ptr, dim, isAscending)); indices = new Array(indPtr); return(new Array(outPtr)); }
public static Array Sort(out Array outValues, Array keys, Array values, uint dim = 0, bool isAscending = true) { IntPtr outKeyPtr; IntPtr outValPtr; Internal.VERIFY(AFAlgorithm.af_sort_by_key(out outKeyPtr, out outValPtr, keys._ptr, values._ptr, dim, isAscending)); outValues = new Array(outValPtr); return(new Array(outKeyPtr)); }
public static Array Max(Array arr, out Array idx, int dim = -1) { IntPtr outPtr; IntPtr idxPtr; Internal.VERIFY(AFAlgorithm.af_imax(out outPtr, out idxPtr, arr._ptr, getFNSD(dim, arr.Dimensions))); idx = new Array(idxPtr); return(new Array(outPtr)); }
public static returnType ProductAll <returnType>(Array arr, double nanval) { double r, i; Internal.VERIFY(AFAlgorithm.af_product_nan_all(out r, out i, arr._ptr, nanval)); if (typeof(returnType) == typeof(Complex)) { return((returnType)Convert.ChangeType(new Complex(r, i), typeof(returnType))); } else { return((returnType)Convert.ChangeType(r, typeof(returnType))); } }
public static returnType MaxAll <returnType>(Array arr, out uint idx) { double r, i; Internal.VERIFY(AFAlgorithm.af_imax_all(out r, out i, out idx, arr._ptr)); if (typeof(returnType) == typeof(Complex)) { return((returnType)Convert.ChangeType(new Complex(r, i), typeof(returnType))); } else { return((returnType)Convert.ChangeType(r, typeof(returnType))); } }
public static bool AnyTrueAll(Array arr) { double r, i; Internal.VERIFY(AFAlgorithm.af_any_true_all(out r, out i, arr._ptr)); if (r == 0) { return(false); } else { return(true); } }
public static SuperArray Min(SuperArray arr, uint[] dims) { AFArray y = CreateMajorSupportedArray(arr); IntPtr ptr = IntPtr.Zero; foreach (int dim in dims) { Internal.VERIFY(AFAlgorithm.af_min(out ptr, y._ptr, dim)); y._ptr = ptr; } return(new SuperArray(new AFArray(ptr))); }