nuvec-core 0.0.1

Lazy array graph, primitives, dtypes and evaluation for nuvec
Documentation
//! Lazy array graph, primitives, dtypes, streams and evaluation: the core of nuvec.
//!
//! Operations on [`Array`]s record a graph and return immediately. Nothing is computed
//! until an array is evaluated, explicitly or by reading it back:
//!
//! ```
//! use nuvec_core::{Array, Result};
//!
//! # fn main() -> Result<()> {
//! let a = Array::from_slice(&[1.0f32, 2.0, 3.0], &[3])?;
//! let b = Array::full(&[3], 10.0f32)?;
//! let c = (&a + &b) * &a; // lazy: nothing computed yet
//! assert!(!c.is_evaluated());
//! assert_eq!(c.to_vec::<f32>()?, vec![11.0, 24.0, 39.0]);
//! # Ok(())
//! # }
//! ```
//!
//! Binary operations promote types (MLX's table) and broadcast shapes (NumPy rules); views
//! (`reshape`, `transpose`, `slice`, `broadcast_to`, `expand_dims`, `squeeze`) share data.
//!
//! Reductions (`sum`, `mean`, `max`, `argmax`, …) work over any axes and layouts;
//! `matmul` broadcasts batch dimensions and uses a SIMD GEMM on the CPU.
//!
//! **Status:** pre-alpha. Evaluated on the CPU.

#![forbid(unsafe_code)]

mod array;
mod buffer;
mod cast;
mod device;
mod dtype;
mod error;
mod eval;
mod kernels;
mod ops;
mod primitive;
mod shape;
mod view;

pub use array::Array;
pub use device::{Device, DeviceKind, Stream, default_stream, set_default_stream};
pub use dtype::{Category, Complex64, DType, Element, at_least_float, bf16, f16, promote_types};
pub use error::{Error, Result};
pub use eval::eval;
pub use ops::{
    abs, add, all, any, arange, argmax, argmin, astype, broadcast_to, cos, divide, equal, exp,
    expand_dims, greater, greater_equal, less, less_equal, log, matmul, max, maximum, mean, min,
    minimum, multiply, negative, not_equal, ones, prod, reshape, sigmoid, sin, slice, sqrt,
    squeeze, subtract, sum, tanh, transpose, where_, zeros,
};
pub use primitive::{ArgReduceOp, BinaryOp, Primitive, ReduceOp, UnaryOp};
pub use shape::Flags;
pub use view::SliceArg;

/// The version of this crate.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");