Skip to main content

Crate ferray

Crate ferray 

Source

Re-exports§

pub use config::set_num_threads;
pub use config::with_num_threads;
pub use ferray_io as io;
pub use ferray_window as window;
pub use ferray_strings as strings;
pub use ferray_ma as ma;

Modules§

aliases
casting
config
dimension
finfo
histogram
prelude
promotion
threshold
Parallel threshold configuration constants.

Macros§

promoted_type
Compile-time type promotion macro.
s
NumPy-style slice indexing macro.

Structs§

ArcArray
A reference-counted N-dimensional array with copy-on-write semantics.
Array
An owned, heap-allocated N-dimensional array.
ArrayFlags
Flags describing the memory properties of an array.
ArrayView
An immutable, borrowed view into an existing array’s data.
ArrayViewMut
A mutable, borrowed view into an existing array’s data.
Axis
Newtype for axis indices used throughout ferray.
FieldDescriptor
Describes a single field within a structured (record) dtype.
Ix0
A zero-dimensional (scalar) dimension.
Ix1
A fixed-rank dimension with 1 axes.
Ix2
A fixed-rank dimension with 2 axes.
Ix3
A fixed-rank dimension with 3 axes.
Ix4
A fixed-rank dimension with 4 axes.
Ix5
A fixed-rank dimension with 5 axes.
Ix6
A fixed-rank dimension with 6 axes.
IxDyn
A dynamic-rank dimension whose number of axes is determined at runtime.
UniqueResult
Result from the unique function.

Enums§

Bins
How to specify bins for histogram functions.
ConvolveMode
Convolution mode.
CorrelateMode
Mode for the correlate function, mirroring numpy.correlate.
CowArray
A copy-on-write array that is either a borrowed view or an owned array.
DType
Runtime descriptor for the element type stored in an array.
DynArray
A runtime-typed array whose element type is determined at runtime.
FerrayError
The primary error type for all ferray operations.
MemoryLayout
Describes the memory layout of an N-dimensional array.
Side
Side parameter for searchsorted.
SliceInfoElem
One element of a multi-axis slice specification, produced by the s![] macro.
SortKind
Sorting algorithm selection.

Constants§

E
Euler’s number, the base of natural logarithms.
EULER_GAMMA
The Euler-Mascheroni constant (gamma ~ 0.5772…).
INF
Positive infinity.
NAN
Not a number (quiet NaN).
NEG_INF
Negative infinity.
NEWAXIS
Sentinel value for expand_dims indicating a new axis should be inserted.
NZERO
Negative zero (-0.0).
PI
The ratio of a circle’s circumference to its diameter.
PZERO
Positive zero (+0.0).

Traits§

AsRawBuffer
Trait exposing the raw memory layout of an array for zero-copy interop.
DeriveFerrayRecord
Trait implemented by types that can be used as structured array elements.
Dimension
Trait for types that describe the dimensionality of an array.
Element
Trait bound for types that can be stored in a ferray array.
FerrayRecord
Trait implemented by types that can be used as structured array elements.

Functions§

abs
Compute the absolute value (magnitude) of complex numbers.
absolute
Elementwise absolute value.
add
Elementwise addition.
add_accumulate
Running (cumulative) addition along an axis.
add_broadcast
Elementwise addition with broadcasting.
add_reduce
Reduce by addition along an axis (column sums, row sums, etc.).
all
Test whether all elements are truthy.
allclose
Test whether two arrays are element-wise close within tolerances.
angle
Compute the angle (argument/phase) of complex numbers.
any
Test whether any element is truthy.
append
Append values to the end of an array along an axis.
arange
Create a 1-D array with evenly spaced values within a given interval.
arccos
Elementwise arc cosine.
arccosh
Elementwise inverse hyperbolic cosine.
arcsin
Elementwise arc sine.
arcsinh
Elementwise inverse hyperbolic sine.
arctan
Elementwise arc tangent.
arctan2
Elementwise two-argument arc tangent (atan2).
arctanh
Elementwise inverse hyperbolic tangent.
argmax
Index of the maximum value.
argmin
Index of the minimum value. For axis=None, returns the flat index. For axis=Some(ax), returns indices along that axis.
argsort
Return the indices that would sort an array along the given axis.
around
Alias for round – matches NumPy’s around.
array
Create an array from a flat vector and a shape (C-order).
array_add
Array addition (delegates to arithmetic::add).
array_bitand
Array bitwise AND (delegates to bitwise::bitwise_and).
array_bitnot
Array bitwise NOT (delegates to bitwise::bitwise_not).
array_bitor
Array bitwise OR (delegates to bitwise::bitwise_or).
array_bitxor
Array bitwise XOR (delegates to bitwise::bitwise_xor).
array_div
Array division (delegates to arithmetic::divide).
array_equal
Test whether two arrays have the same shape and elements.
array_equiv
Test whether two arrays are element-wise equal within a tolerance, or broadcastable to the same shape and element-wise equal.
array_mul
Array multiplication (delegates to arithmetic::multiply).
array_neg
Array negation (delegates to arithmetic::negative).
array_rem
Array remainder (delegates to arithmetic::remainder).
array_shl
Array left shift (delegates to bitwise::left_shift).
array_shr
Array right shift (delegates to bitwise::right_shift).
array_split
Split an array into sub-arrays at the given indices along axis.
array_sub
Array subtraction (delegates to arithmetic::subtract).
asarray
Interpret existing data as an array without copying (if possible).
bincount
Count occurrences of each value in a non-negative integer array.
bitwise_and
Elementwise bitwise AND.
bitwise_not
Elementwise bitwise NOT.
bitwise_or
Elementwise bitwise OR.
bitwise_xor
Elementwise bitwise XOR.
block
Assemble an array from nested blocks.
broadcast_to
Broadcast an array to a new shape (returns a new owned array).
cbrt
Elementwise cube root.
ceil
Elementwise ceiling (round toward positive infinity).
clip
Clip (limit) values to [a_min, a_max].
concatenate
Join a sequence of arrays along an existing axis.
conj
Compute the complex conjugate.
conjugate
Alias for conj.
convolve
Discrete, linear convolution of two 1-D arrays.
copysign
Elementwise copysign: magnitude of x1, sign of x2.
corrcoef
Compute the Pearson correlation coefficient matrix.
correlate
Discrete, linear cross-correlation of two 1-D arrays.
cos
Elementwise cosine.
cosh
Elementwise hyperbolic cosine.
count_nonzero
Count the number of non-zero elements along a given axis.
cov
Estimate the covariance matrix.
cross
Cross product of two 3-element 1-D arrays.
cumprod
Cumulative product along an axis (or flattened if axis is None).
cumsum
Cumulative sum along an axis (or flattened if axis is None).
deg2rad
Alias for radians.
degrees
Convert radians to degrees.
delete
Delete sub-arrays along an axis.
diag
Extract a diagonal or construct a diagonal array.
diagflat
Create a 2-D array with the flattened input as a diagonal.
diff
Compute the n-th discrete difference along the given axis.
digitize
Return the indices of the bins to which each value belongs.
divide
Elementwise division.
divide_broadcast
Elementwise division with broadcasting.
divmod
Return (floor_divide, remainder) as a tuple of arrays.
dsplit
Split array along axis 2 (depth split). Equivalent to split(a, n, 2).
dstack
Stack arrays along the third axis (depth-wise).
ediff1d
Differences between consecutive elements of an array, with optional prepend/append values.
empty
Create an uninitialized array.
equal
Elementwise equality test.
exp
Elementwise exponential (e^x).
exp2
Elementwise 2^x.
exp_fast
Fast elementwise exponential (e^x) with ≤1 ULP accuracy.
expand_dims
Insert a new axis of length 1 at the given position.
expm1
Elementwise exp(x) - 1, accurate near zero.
eye
Create a 2-D array with ones on the diagonal and zeros elsewhere.
fabs
Alias for absolute — float abs.
fix
Elementwise fix: round toward zero (same as trunc for real numbers).
flatten
Return a flattened (1-D) copy of the array.
flip
Reverse the order of elements along the given axis.
fliplr
Flip array left-right (reverse axis 1).
flipud
Flip array up-down (reverse axis 0).
float_power
Float power: x1^x2, always returning float.
floor
Elementwise floor (round toward negative infinity).
floor_divide
Floor division: floor(a / b).
fmax
Elementwise maximum, ignoring NaN.
fmin
Elementwise minimum, ignoring NaN.
fmod
C-style fmod (remainder has same sign as dividend).
frexp
Decompose into mantissa and exponent: x = m * 2^e.
frombuffer
Create an array from a byte buffer, interpreting bytes as elements of type T.
fromiter
Create a 1-D array from an iterator.
full
Create an array filled with a given value.
full_like
Create an array with the same shape as other, filled with fill_value.
gcd
Integer GCD (works on float representations of integers).
geomspace
Create a 1-D array with values spaced evenly on a geometric (log) scale.
get_print_options
Get current print options as (precision, threshold, linewidth, edgeitems).
gradient
Compute the gradient of a 1-D array using central differences.
greater
Elementwise greater-than test.
greater_equal
Elementwise greater-than-or-equal test.
heaviside
Heaviside step function.
histogram
Compute the histogram of a dataset.
histogram2d
Compute the 2-D histogram of two data arrays.
histogramdd
Compute a multi-dimensional histogram.
hsplit
Split array along axis 1 (horizontal split). Equivalent to split(a, n, 1).
hstack
Stack arrays horizontally (column-wise). Equivalent to concatenate along axis 1 for 2-D+ arrays, or along axis 0 for 1-D arrays.
hypot
Elementwise hypotenuse: sqrt(a^2 + b^2).
i0
Modified Bessel function of the first kind, order 0.
identity
Create a 2-D identity matrix of size n x n.
imag
Extract the imaginary part of a complex array.
in1d
Test whether each element of a is also present in b.
insert
Insert values along an axis before a given index.
interp
1-D linear interpolation.
interp_one
Convenience: interpolate a single scalar query point.
intersect1d
Return the sorted intersection of two 1-D arrays.
invert
Alias for bitwise_not.
isclose
Elementwise close-within-tolerance test.
isfinite
Elementwise test for finiteness.
isin
Test whether each element of element is in test_elements.
isinf
Elementwise test for infinity (positive or negative).
isnan
Elementwise test for NaN.
isneginf
Elementwise test for negative infinity.
isposinf
Elementwise test for positive infinity.
lcm
Integer LCM (works on float representations of integers).
ldexp
Multiply x by 2^n (ldexp).
left_shift
Elementwise left shift.
less
Elementwise less-than test.
less_equal
Elementwise less-than-or-equal test.
linspace
Create a 1-D array with num evenly spaced values between start and stop.
log
Elementwise natural logarithm.
log2
Elementwise base-2 logarithm.
log1p
Elementwise ln(1 + x), accurate near zero.
log10
Elementwise base-10 logarithm.
logaddexp
log(exp(a) + exp(b)), computed in a numerically stable way.
logaddexp2
log2(2^a + 2^b), computed in a numerically stable way.
logical_and
Elementwise logical AND.
logical_not
Elementwise logical NOT.
logical_or
Elementwise logical OR.
logical_xor
Elementwise logical XOR.
logspace
Create a 1-D array with values spaced evenly on a log scale.
max
Maximum value of array elements over a given axis.
maximum
Elementwise maximum, propagating NaN.
mean
Mean of array elements over a given axis.
median
Compute the median of array elements along a given axis.
meshgrid
Return coordinate arrays from coordinate vectors.
mgrid
Create a dense multi-dimensional “meshgrid” with matrix (‘ij’) indexing.
min
Minimum value of array elements over a given axis.
minimum
Elementwise minimum, propagating NaN.
mod_
Alias for remainder.
moveaxis
Move an axis to a new position.
multiply
Elementwise multiplication.
multiply_broadcast
Elementwise multiplication with broadcasting.
multiply_outer
Outer product: multiply_outer(a, b)[i, j] = a[i] * b[j].
nan_to_num
Replace NaN with zero, and infinity with large finite numbers.
nancumprod
Cumulative product ignoring NaNs.
nancumsum
Cumulative sum ignoring NaNs.
nanmax
Maximum of array elements, skipping NaN.
nanmean
Mean of array elements, skipping NaN. Returns NaN for all-NaN slices.
nanmedian
Median, skipping NaN values.
nanmin
Minimum of array elements, skipping NaN.
nanpercentile
Percentile, skipping NaN values.
nanprod
Product of array elements, treating NaN as one.
nanstd
Standard deviation of array elements, skipping NaN.
nansum
Sum of array elements, treating NaN as zero.
nanvar
Variance of array elements, skipping NaN.
negative
Elementwise negation.
nextafter
Return the next floating-point value after x1 towards x2.
nonzero
Return the indices of non-zero elements.
not_equal
Elementwise inequality test.
ogrid
Create a sparse (open) multi-dimensional “meshgrid” with ‘ij’ indexing.
ones
Create an array filled with ones.
ones_like
Create an array with the same shape as other, filled with ones.
pad
Pad an N-D array.
percentile
Compute the q-th percentile of array data along a given axis.
positive
Elementwise positive (identity for numeric types).
power
Elementwise power: a^b.
prod
Product of array elements over a given axis.
quantile
Compute the q-th quantile of array data along a given axis.
rad2deg
Alias for degrees.
radians
Convert degrees to radians.
ravel
Return a flattened (1-D) copy of the array.
real
Extract the real part of a complex array.
reciprocal
Elementwise reciprocal: 1/x.
remainder
Elementwise remainder (Python-style modulo).
repeat
Repeat elements of an array.
reshape
Reshape an array to a new shape (returns a new owned array).
resize
Resize an array to a new shape.
right_shift
Elementwise right shift.
rint
Alias for round – matches NumPy’s rint.
roll
Roll elements along an axis. Elements that roll past the end are re-introduced at the beginning.
rollaxis
Roll an axis to a new position (similar to moveaxis).
rot90
Rotate array 90 degrees counterclockwise in the plane defined by axes (0, 1).
round
Elementwise banker’s rounding (round half to even).
searchsorted
Find indices where elements should be inserted to maintain order.
set_print_options
Configure how arrays are printed.
setdiff1d
Return the sorted set difference of two 1-D arrays (elements in a not in b).
setxor1d
Return the sorted symmetric difference of two 1-D arrays.
sign
Elementwise sign: -1 for negative, 0 for zero, +1 for positive.
signbit
Elementwise sign bit test.
sin
Elementwise sine.
sinc
Normalized sinc function: sin(pix) / (pix).
sinh
Elementwise hyperbolic sine.
sort
Sort an array along the given axis (or flattened if axis is None).
spacing
Return the spacing of values: the ULP (unit in the last place).
split
Split an array into equal-sized sub-arrays.
sqrt
Elementwise square root.
square
Elementwise square: x^2.
squeeze
Remove axes of length 1 from the shape.
stack
Join a sequence of arrays along a new axis.
stats_cumprod
Cumulative product along an axis (or flattened if axis is None).
stats_cumsum
Cumulative sum along an axis (or flattened if axis is None).
stats_nancumprod
Cumulative product, treating NaN as one.
stats_nancumsum
Cumulative sum, treating NaN as zero.
std_
Standard deviation of array elements over a given axis.
subtract
Elementwise subtraction.
subtract_broadcast
Elementwise subtraction with broadcasting.
sum
Sum of array elements over a given axis, or over all elements if axis is None.
swapaxes
Swap two axes of an array.
tan
Elementwise tangent.
tanh
Elementwise hyperbolic tangent.
tile
Construct an array by repeating a the number of times given by reps.
transpose
Permute the axes of an array.
trapezoid
Integrate using the trapezoidal rule.
tri
Create a lower-triangular matrix of ones.
tril
Return the lower triangle of a 2-D array.
trim_zeros
Trim leading and/or trailing zeros from a 1-D array.
triu
Return the upper triangle of a 2-D array.
true_divide
Alias for divide — true division (float).
trunc
Elementwise truncation (round toward zero).
union1d
Return the sorted union of two 1-D arrays.
unique
Find the sorted unique elements of an array.
unwrap
Unwrap by changing deltas between values to their 2*pi complement.
var
Variance of array elements over a given axis.
vsplit
Split array along axis 0 (vertical split). Equivalent to split(a, n, 0).
vstack
Stack arrays vertically (row-wise). Equivalent to concatenate along axis 0 for 2-D+ arrays, or equivalent to stacking 1-D arrays as rows.
where_
Conditional element selection.
zeros
Create an array filled with zeros.
zeros_like
Create an array with the same shape as other, filled with zeros.

Type Aliases§

FerrayResult
Convenience alias used throughout ferray.

Derive Macros§

DeriveFerrayRecord
Derive macro that generates an unsafe impl FerrayRecord for a #[repr(C)] struct.
FerrayRecord
Derive macro that generates an unsafe impl FerrayRecord for a #[repr(C)] struct.