Expand description
Read-only array allocated in Rust, safe to access from the host language without copying.
This module defines HostArray, a bridge between Rust-owned numeric arrays
and the host language (Python, C, Wasm/JS). A HostArray stores a raw data pointer together
with shape, strides, and scalar type metadata. It optionally owns the underlying allocation
via a Box<dyn Any>, ensuring the data remains valid for as long as the HostArray exists.
HostArray is the return type of
SolutionWrapper::get_ys,
SolutionWrapper::get_ts, and
SolutionWrapper::get_sens.
§Conversion traits
- ToHostArray — convert owned Rust types (e.g.
Vec<T>,nalgebra::DMatrix<T>,faer::Mat<T>) into aHostArray. - FromHostArray — convert a
HostArrayback into a Rust type (e.g.Vec<f64>,Vec<Vec<f64>>,ndarray::ArrayView2).
§Key methods
- HostArray::new, HostArray::new_vector, HostArray::alloc_vector, HostArray::new_col_major — constructors.
- HostArray::as_array — view as
ndarray::ArrayView2. - HostArray::as_slice — view as
&[T]. HostArray::data_ptr,HostArray::ndim,HostArray::dim,HostArray::stride,HostArray::dtype— metadata accessors.
Structs§
- Host
Array - a read-only array that is allocated in rust and can be safely accessed in the host language (e.g. Python) without copying