Equana

📊

Arrays

Array creation, manipulation, and higher-order functions.

arange
Evenly spaced values over a half-open interval [start, stop).
arange(start, stop, step) → Array [start, start+step, ...] up to but excluding stop
argmax
Index (1-based) of the maximum element.
argmax(arr) → Int64 index of the largest element
argmin
Index (1-based) of the minimum element.
argmin(arr) → Int64 index of the smallest element
cumsum
Cumulative sum of an array.
cumsum(arr) → Array of running totals
delete
Remove an element at the given index.
delete(arr, idx) → New array with element removed
diag
Square matrix with the given vector on its main diagonal.
diag(v) → n×n matrix with v on the diagonal, zeros elsewhere
enumerate
Pair each element with its 1-based index.
enumerate(arr) → Array of (index, element) tuples
eye
Identity matrix.
eye(n, cols) → n×n (or rows×cols) matrix with ones on the main diagonal
fill
Create an array filled with a value.
fill(val, n) → Array of n copies of val
filter
Filter array elements by a predicate.
filter(arr, fn) → Array of elements for which fn returns true
length
Number of elements in a collection.
length(x) → Number of elements
linspace
Create an array of evenly spaced values.
linspace(start, stop, n) → Array of n evenly spaced values from start to stop
map
Apply a function to each element.
map(arr, fn) → Array of transformed elements
max
Maximum value.
max(a) → Maximum value
mean
Arithmetic mean of all elements.
mean(arr) → Mean value
min
Minimum value.
min(a) → Minimum value
ndims
Number of dimensions.
ndims(x) → Number of dimensions
ones
Create an array of ones.
ones(n) → Array of n ones
prod
Product of all elements.
prod(arr) → Total product
push
Append an element to an array.
push(arr, val) → New array with val appended
rand
Uniformly distributed random numbers in [0, 1).
rand(n, cols) → Float64 scalar (no args), vector rand(n), or matrix rand(rows, cols)
randn
Standard normally distributed random numbers.
randn(n, cols) → Float64 scalar (no args), vector randn(n), or matrix randn(rows, cols)
reduce
Reduce an array to a single value using a binary function.
reduce(arr, fn, init) → Accumulated result
reverse
Reverse an array.
reverse(arr) → Reversed array
size
Shape of an array or NDArray.
size(x) → Array of dimension sizes
sort
Sort an array in ascending order.
sort(arr) → Sorted array
sum
Sum of all elements.
sum(arr) → Total sum
zeros
Create an array of zeros.
zeros(n) → Array of n zeros
zip
Combine two arrays element-wise into tuples.
zip(a, b) → Array of (a[i], b[i]) tuples