NDArray
classin packageklyn.math
public class NDArray<T extends AbstractNumber = Double>
NDArray

Represents a multi-dimensional array (NDArray) with elements of type T.

Storage model:

  • fixed-size row-major layout
  • ULong dimensions, element counts and strides; Long indices and axes
  • NDArray<Double> uses a native contiguous buffer for hot numeric kernels
  • other numeric specializations use primitive list storage when available, with a boxed fallback for operations that require objects
Example
import klyn.math

values = NDArray<Double>([1.0, 4.0, 9.0])
print(values.sqrt())
Properties
Modifier and Type Member Description
public property flat
flat[index as Long] as T
Reads or writes one scalar using a row-major linear index, at any rank.
public readonly property ndim
ndim as ULong
The number of dimensions in the array.
public readonly property shape
shape as IList<ULong>
The shape of the array.
public readonly property size
size as ULong
The total number of elements in the array.
public readonly proper t
ty t as NDArray<T>
The transpose of the NDArray (2D only).
Constructors
Modifier and Type Member Description
public NDArray
NDArray(notnull values as IList<IList<T>>)
Copies rectangular rows into a new 2D NDArray, including empty rows.
public NDArray
NDArray(notnull values as IList<T>)
Copies a list of values into a new 1D NDArray, including an empty vector.
Methods
Modifier and Type Member Description
public _getScalar1D
_getScalar1D(i as Long) as T
Reads the typed scalar used by one-dimensional indexed mutations.
public _sliceAxes
_sliceAxes(notnull specifications as Long[]) as NDArray<T>
Internal entry point for multidimensional slice syntax.
public native abs
abs() as NDArray<T>
Returns the element-wise absolute value.
public native acos
acos() as NDArray<Double>
Returns the element-wise arccosine.
public argMax
argMax(axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Long> = null) as NDArray<Long>
First extremum index in row-major order over the reduced axes.
public argMax
argMax(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Long> = null) as NDArray<Long>
Returns the indices of the maximum values along one axis.
public argMax
argMax(ignoreNaN as Boolean = false, where as Boolean[] = null) as Long
Returns the flat index of the maximum element.
public argMin
argMin(axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Long> = null) as NDArray<Long>
First extremum index in row-major order over the reduced axes.
public argMin
argMin(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Long> = null) as NDArray<Long>
Returns the indices of the minimum values along one axis.
public argMin
argMin(ignoreNaN as Boolean = false, where as Boolean[] = null) as Long
Returns the flat index of the minimum element.
public native asin
asin() as NDArray<Double>
Returns the element-wise arcsine.
public native atan
atan() as NDArray<Double>
Returns the element-wise arctangent.
public atan2
atan2(value as T) as NDArray<Double>
Returns the element-wise atan2(this, value).
public native atan2
atan2(notnull other as NDArray<T>) as NDArray<Double>
Returns the element-wise atan2(this, other).
public binCount
binCount(minLength as Long = 0l) as NDArray<ULong>
Counts occurrences of each non-negative integer, retaining exact ULong counts.
public binCount
binCount(notnull weights as NDArray<Double>, minLength as Long = 0l) as NDArray<Double>
Weighted occurrence counts; each weight is added to its integer bin.
public native cbrt
cbrt() as NDArray<Double>
Returns the element-wise cube root.
public native ceil
ceil() as NDArray<T>
Applies ceil element-wise while preserving the array element type.
public copy
copy() as NDArray<T>
Creates an independent contiguous copy with the same shape and dtype.
public correlate
correlate(notnull other as NDArray<T>, mode as CorrelationMode = CorrelationMode.Valid) as NDArray<Double>
Direct discrete cross-correlation c[k] = sum(x[i+k] * other[i]).
public correlation
correlation(notnull other as NDArray<T>, ignoreNaN as Boolean = false) as Double
Pearson correlation of two equally-sized 1D series.
public correlation
correlation(rowVariables as Boolean = true, ignoreNaN as Boolean = false) as NDArray<Double>
Symmetric matrix of Pearson coefficients, without copying columns.
public native cos
cos() as NDArray<Double>
Returns the element-wise cosine in radians.
public native cosh
cosh() as NDArray<Double>
Returns the element-wise hyperbolic cosine.
public covariance
covariance(notnull other as NDArray<T>, ddof as Long = 1l, ignoreNaN as Boolean = false) as Double
Sample covariance of two equally-sized 1D series, in Double.
public covariance
covariance(rowVariables as Boolean = true, ddof as Long = 1l, ignoreNaN as Boolean = false) as NDArray<Double>
Covariance matrix of 1D/2D observations, with O(variables squared) output.
public native degrees
degrees() as NDArray<Double>
Converts each element from radians to degrees.
public digitize
digitize(notnull edges as NDArray<Double>, right as Boolean = false) as NDArray<Long>
Assigns every element to a monotone sequence of bin boundaries.
public native exp
exp() as NDArray<Double>
Returns the element-wise exponential.
public native exp2
exp2() as NDArray<Double>
Returns the element-wise power of two.
public native expm1
expm1() as NDArray<Double>
Returns the element-wise exp(value) - 1.
public static eye
eye(size as Long) as NDArray<T>
Creates a new NDArray with ones on the diagonal and zeros elsewhere.
public flatten
flatten() as NDArray<T>
Copies the NDArray into an independent contiguous 1D array in row-major order.
public native floor
floor() as NDArray<T>
Applies floor element-wise while preserving the array element type.
public fmod
fmod(value as T) as NDArray<Double>
Returns the element-wise floating-point remainder with a scalar.
public native fmod
fmod(notnull other as NDArray<T>) as NDArray<Double>
Returns the element-wise floating-point remainder with another array.
public static full
full(notnull shape as ArrayList<Object>, value as T) as NDArray<T>
Creates a new NDArray filled with a given value.
public static full
full(notnull shape as IList<Int>, value as T) as NDArray<T>
Creates a new NDArray filled with a given value.
public static full
full(notnull shape as IList<Long>, value as T) as NDArray<T>
Accepts 64-bit signed shape dimensions without truncation.
public static full
full(notnull shape as IList<UInt>, value as T) as NDArray<T>
Creates a new NDArray filled with a given value.
public static full
full(notnull shape as IList<ULong>, value as T) as NDArray<T>
Accepts 64-bit unsigned shape dimensions without truncation.
public static full
full(notnull shape as Tuple, value as T) as NDArray<T>
Creates a new NDArray filled with a given value using a tuple shape.
public get
get(notnull indices as Long[]) as T
Reads a scalar using one integer coordinate per axis, at any rank.
public getFlat
getFlat(index as Long) as T
Reads an element by its row-major linear index, regardless of rank.
public histogram
histogram(bins as Long = 10l, bounds as Tuple<Double, Double> = null, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, NDArray<Double>>
Histogram of all elements, flattened without copying the source.
public histogram
histogram(notnull edges as NDArray<Double>, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, NDArray<Double>>
Histogram with explicitly supplied finite ascending boundaries; source unchanged.
public histogram2D
histogram2D(notnull other as NDArray<T>, bins as Long = 10l, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, NDArray<Double>, NDArray<Double>>
Joint histogram of paired 1D observations, without an N-by-2 temporary.
public histogram2D
histogram2D(notnull other as NDArray<T>, notnull bins as IList<Long>, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, NDArray<Double>, NDArray<Double>>
Joint histogram with separate bin counts for each coordinate.
public histogram2D
histogram2D(notnull other as NDArray<T>, notnull edges as IList<NDArray<Double>>, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, NDArray<Double>, NDArray<Double>>
Joint histogram with independently specified x/y edges.
public histogramBinEdges
histogramBinEdges(bins as Long = 10l, bounds as Tuple<Double, Double> = null, ignoreNaN as Boolean = false) as NDArray<Double>
Computes only uniform histogram boundaries, without allocating/counting bins.
public histogramDD
histogramDD(bins as Long = 10l, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, IList<NDArray<Double>>>
D-dimensional histogram of an [observations,coordinates] matrix (or 1D series).
public histogramDD
histogramDD(notnull bins as IList<Long>, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, IList<NDArray<Double>>>
D-dimensional histogram with one bin count per coordinate.
public histogramDD
histogramDD(notnull edges as IList<NDArray<Double>>, density as Boolean = false, weights as NDArray<Double> = null, ignoreNaN as Boolean = false) as Tuple<NDArray<Double>, IList<NDArray<Double>>>
D-dimensional histogram with explicit coordinate edges; source unchanged.
public hypot
hypot(value as T) as NDArray<Double>
Returns the element-wise Euclidean distance with a scalar.
public native hypot
hypot(notnull other as NDArray<T>) as NDArray<Double>
Returns the element-wise Euclidean distance with another array.
public static linspace
linspace(start as Double, stop as Double, count as Long = 50, endpoint as Boolean = true) as NDArray<T>
Creates evenly spaced samples, including both endpoints by default.
public native log
log() as NDArray<Double>
Returns the element-wise natural logarithm.
public native log10
log10() as NDArray<Double>
Returns the element-wise base-10 logarithm.
public native log1p
log1p() as NDArray<Double>
Returns the element-wise log(1 + value).
public native log2
log2() as NDArray<Double>
Returns the element-wise base-2 logarithm.
public max
max(axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<T> = null) as NDArray<T>
Extreme values over several axes, retaining exact integer comparisons.
public max
max(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<T> = null) as NDArray<T>
Returns maximum values along one axis.
public max
max(ignoreNaN as Boolean = false, where as Boolean[] = null) as Object
Returns the maximum value of the array.
public mean
mean(axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Arithmetic mean over several axes, with FP64 accumulation.
public mean
mean(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Computes the arithmetic mean along one axis.
public mean
mean(ignoreNaN as Boolean = false, where as Boolean[] = null) as Double
Computes the arithmetic mean of all elements.
public mean
mean(notnull weights as NDArray<Double>, axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Weighted mean along axes; weights may be source-shaped or a flat reduced-slice vector.
public mean
mean(notnull weights as NDArray<Double>, axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Weighted mean along axes; weights may be source-shaped or a flat reduced-slice vector.
public mean
mean(notnull weights as NDArray<Double>, ignoreNaN as Boolean = false, where as Boolean[] = null) as Double
Weighted arithmetic mean of every selected element.
public median
median(axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Exact sample median by axes; O(largest slice) reusable scratch, source unchanged.
public median
median(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Exact sample median by axes; O(largest slice) reusable scratch, source unchanged.
public median
median(ignoreNaN as Boolean = false, where as Boolean[] = null) as Double
Exact sample median.
public min
min(axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<T> = null) as NDArray<T>
Extreme values over several axes, retaining exact integer comparisons.
public min
min(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<T> = null) as NDArray<T>
Returns minimum values along one axis.
public min
min(ignoreNaN as Boolean = false, where as Boolean[] = null) as Object
Returns the minimum value of the array.
public static ones
ones(notnull shape as ArrayList<Object>) as NDArray<T>
Creates a new NDArray with ones.
public static ones
ones(notnull shape as IList<Int>) as NDArray<T>
Creates a new NDArray with ones.
public static ones
ones(notnull shape as IList<Long>) as NDArray<T>
Accepts 64-bit signed shape dimensions without truncation.
public static ones
ones(notnull shape as IList<UInt>) as NDArray<T>
Creates a new NDArray with ones.
public static ones
ones(notnull shape as IList<ULong>) as NDArray<T>
Accepts 64-bit unsigned shape dimensions without truncation.
public static ones
ones(notnull shape as Tuple) as NDArray<T>
Creates a new NDArray with ones from a tuple shape.
public peakToPeak
peakToPeak(axes as IList<Long>, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Range (maximum minus minimum) along the selected axes, without materializing slices.
public peakToPeak
peakToPeak(axis as Long, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Range (maximum minus minimum) along the selected axes, without materializing slices.
public peakToPeak
peakToPeak(ignoreNaN as Boolean = false, where as Boolean[] = null) as Double
Range (maximum minus minimum) of all selected elements, accumulated in Double.
public percentile
percentile(notnull q as IList<Double>, axes as IList<Long> = null, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null) as NDArray<Double>
Several sample percentiles, sharing quantile selection and scratch storage.
public percentile
percentile(notnull q as IList<Double>, axis as Long, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null) as NDArray<Double>
Multiple percentiles along one axis; sample scratch is shared across requests.
public percentile
percentile(q as Double, axes as IList<Long>, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Exact sample percentile with q in [0,100] by axes; O(largest slice) reusable scratch, source unchanged.
public percentile
percentile(q as Double, axis as Long, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Exact sample percentile with q in [0,100] by axes; O(largest slice) reusable scratch, source unchanged.
public percentile
percentile(q as Double, method as QuantileMethod = QuantileMethod.Linear, ignoreNaN as Boolean = false, where as Boolean[] = null) as Double
Exact sample percentile with q in [0,100].
public native pow
pow(notnull other as NDArray<T>) as NDArray<Double>
Raises each element to the matching power array.
public pow
pow(value as T) as NDArray<Double>
Raises each element to the given scalar power.
public quantile
quantile(notnull q as IList<Double>, axes as IList<Long> = null, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null) as NDArray<Double>
Several exact quantiles, sharing the same sample scratch per output lane.
public quantile
quantile(notnull q as IList<Double>, axis as Long, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null) as NDArray<Double>
Multiple quantiles along one axis; sample scratch is shared across requests.
public quantile
quantile(q as Double, axes as IList<Long>, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Exact sample quantile with q in [0,1] by axes; O(largest slice) reusable scratch, source unchanged.
public quantile
quantile(q as Double, axis as Long, method as QuantileMethod = QuantileMethod.Linear, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Exact sample quantile with q in [0,1] by axes; O(largest slice) reusable scratch, source unchanged.
public quantile
quantile(q as Double, method as QuantileMethod = QuantileMethod.Linear, ignoreNaN as Boolean = false, where as Boolean[] = null) as Double
Exact sample quantile with q in [0,1].
public native radians
radians() as NDArray<Double>
Converts each element from degrees to radians.
public static randint
randint(min as Int, max as Int, notnull shape as IList<Int>) as NDArray<T>
Creates a NDArray with random integers in [min, max] using read-only shape dimensions.
public static randint
randint(min as Int, max as Int, notnull shape as IList<Long>) as NDArray<T>
Accepts 64-bit signed shape dimensions without truncation.
public static randint
randint(min as Int, max as Int, notnull shape as IList<UInt>) as NDArray<T>
Creates a new NDArray with random integers.
public static randint
randint(min as Int, max as Int, notnull shape as IList<ULong>) as NDArray<T>
Accepts 64-bit unsigned shape dimensions without truncation.
public static randint
randint(min as Int, max as Int, notnull shape as Tuple) as NDArray<T>
Creates a NDArray with random integers in [min, max] using a tuple shape.
public static randint
randint(min as Int, max as Int, size as Long) as NDArray<T>
Creates a 1D NDArray with random integers in [min, max].
public static randn
randn(notnull shape as IList<Int>) as NDArray<T>
Creates a NDArray sampled from a standard normal distribution using read-only shape dimensions.
public static randn
randn(notnull shape as IList<Long>) as NDArray<T>
Accepts 64-bit signed shape dimensions without truncation.
public static randn
randn(notnull shape as IList<UInt>) as NDArray<T>
Creates a new NDArray with random floating-point numbers from a normal distribution.
public static randn
randn(notnull shape as IList<ULong>) as NDArray<T>
Accepts 64-bit unsigned shape dimensions without truncation.
public static randn
randn(notnull shape as Tuple) as NDArray<T>
Creates a NDArray sampled from a standard normal distribution using a tuple shape.
public static randn
randn(size as Long) as NDArray<T>
Creates a 1D NDArray sampled from a standard normal distribution.
public static random
random(notnull shape as IList<Int>) as NDArray<T>
Creates a NDArray with random values in [0, 1) using read-only shape dimensions.
public static random
random(notnull shape as IList<Long>) as NDArray<T>
Accepts 64-bit signed shape dimensions without truncation.
public static random
random(notnull shape as IList<UInt>) as NDArray<T>
Creates a new NDArray with random values in [0, 1).
public static random
random(notnull shape as IList<ULong>) as NDArray<T>
Accepts 64-bit unsigned shape dimensions without truncation.
public static random
random(notnull shape as Tuple) as NDArray<T>
Creates a NDArray with random values in [0, 1) using a tuple shape.
public static random
random(size as Long) as NDArray<T>
Creates a 1D NDArray with random values in [0, 1).
public reshape
reshape(notnull shape as ArrayList<Object>) as NDArray<T>
Reshapes using a vector mixing integer widths, such as ULong metadata and Int literals.
public reshape
reshape(notnull shape as IList<Int>) as NDArray<T>
Reshapes the NDArray to the specified shape.
public reshape
reshape(notnull shape as IList<Long>) as NDArray<T>
Accepts 64-bit signed shape dimensions without truncation.
public reshape
reshape(notnull shape as IList<UInt>) as NDArray<T>
Reshapes using unsigned 32-bit dimensions, without changing element order.
public reshape
reshape(notnull shape as IList<ULong>) as NDArray<T>
Reshapes using unsigned 64-bit dimensions, including existing shape metadata.
public reshape
reshape(notnull shape as Tuple) as NDArray<T>
Reshapes the NDArray using a tuple shape.
public reshape
reshape(rows as Long, cols as Long) as NDArray<T>
Reshapes the NDArray using two dimensions.
public native round
round() as NDArray<T>
Rounds each element to the nearest integer value while preserving the array element type.
public set
set(i as Long, value as T) as Void
Sets one element in a 1D NDArray.
public set
set(notnull indices as Long[], value as T)
Writes one scalar using a complete coordinate vector, for any rank.
public set
set(row as Long, col as Long, value as T) as Void
Sets one element in a 2D NDArray.
public setFlat
setFlat(index as Long, value as T) as Void
Writes an element by its row-major linear index without reshaping the array.
public native sin
sin() as NDArray<Double>
Returns the element-wise sine in radians.
public native sinh
sinh() as NDArray<Double>
Returns the element-wise hyperbolic sine.
public sort
sort() as NDArray<T>
Sorts the NDArray in place.
public sort
sort(axis as Long) as NDArray<T>
Sorts the NDArray along one axis, in place.
public native sqrt
sqrt() as NDArray<Double>
Returns the element-wise square root.
public standardDeviation
standardDeviation(axes as IList<Long>, ddof as Long = 0l, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Standard deviation along the selected axes, without materializing slices.
public standardDeviation
standardDeviation(axis as Long, ddof as Long = 0l, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Standard deviation along the selected axes, without materializing slices.
public standardDeviation
standardDeviation(ignoreNaN as Boolean = false, ddof as Long = 0l, where as Boolean[] = null) as Double
Standard deviation of all selected elements, accumulated in Double.
public native sum
sum() as Object
Computes the sum of all elements.
public sum
sum(axes as IList<Long>, keepDims as Boolean = false, where as Boolean[] = null, ignoreNaN as Boolean = false, result as NDArray<T> = null) as NDArray<T>
Sum over several axes, preserving the source numeric element type.
public sum
sum(axis as Long, keepDims as Boolean = false, where as Boolean[] = null, ignoreNaN as Boolean = false, result as NDArray<T> = null) as NDArray<T>
Computes the sum along one axis.
public sum
sum(ignoreNaN as Boolean, where as Boolean[] = null) as Object
Masked/NaN-aware global sum, retaining the numeric type of this array.
public native tan
tan() as NDArray<Double>
Returns the element-wise tangent in radians.
public native tanh
tanh() as NDArray<Double>
Returns the element-wise hyperbolic tangent.
public toList
toList() as ArrayList<T>
Copies the array contents into a row-major ArrayList<T>.
public override toString
toString() as String
Returns a string representation of the array.
public native trunc
trunc() as NDArray<T>
Applies trunc element-wise while preserving the array element type.
public variance
variance(axes as IList<Long>, ddof as Long = 0l, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Variance along the selected axes, without materializing slices.
public variance
variance(axis as Long, ddof as Long = 0l, keepDims as Boolean = false, ignoreNaN as Boolean = false, where as Boolean[] = null, result as NDArray<Double> = null) as NDArray<Double>
Variance along the selected axes, without materializing slices.
public variance
variance(ignoreNaN as Boolean = false, ddof as Long = 0l, where as Boolean[] = null) as Double
Variance of all selected elements, accumulated in Double.
public static zeros
zeros(notnull shape as ArrayList<Object>) as NDArray<T>
Creates a new NDArray with zeros.
public static zeros
zeros(notnull shape as IList<Int>) as NDArray<T>
Creates a new NDArray with zeros.
public static zeros
zeros(notnull shape as IList<Long>) as NDArray<T>
Accepts 64-bit signed shape dimensions without truncation.
public static zeros
zeros(notnull shape as IList<UInt>) as NDArray<T>
Creates a new NDArray with zeros.
public static zeros
zeros(notnull shape as IList<ULong>) as NDArray<T>
Accepts 64-bit unsigned shape dimensions without truncation.
public static zeros
zeros(notnull shape as Tuple) as NDArray<T>
Creates a new NDArray with zeros from a tuple shape.
Operators
Modifier and Type Member Description
public static native operator*(notnull first as NDArray<T>, notnull second as NDArray<T>) as NDArray<T> Multiplies two NDArrays element-wise.
public static operator**(notnull first as NDArray<T>, notnull second as NDArray<T>) as NDArray<T> Raises first NDArray to second NDArray element-wise.
public static native operator+(notnull first as NDArray<T>, notnull second as NDArray<T>) as NDArray<T> Adds two NDArrays element-wise.
public static native operator-(notnull first as NDArray<T>, notnull second as NDArray<T>) as NDArray<T> Subtracts two NDArrays element-wise.
public static native operator/(notnull first as NDArray<T>, notnull second as NDArray<T>) as NDArray<T> Divides two NDArrays element-wise.
public static operator/(notnull first as NDArray<T>, second as T) as NDArray<T> Divides every element by a scalar without modifying the source array.
public static operator//(notnull first as NDArray<T>, notnull second as NDArray<T>) as NDArray<T> Integer-divides two NDArrays element-wise.
public static operator@(notnull first as NDArray<T>, notnull second as NDArray<T>) as NDArray<T> Matrix multiplication (2D x 2D).
public operator[](i as Long) as Object Gets one scalar for a 1D array, or an independent first-axis slice for higher ranks.
public operator[](row as Long, col as Long) as T Gets one element for 2D arrays.