Skip to main content

tensor_optim/
lib.rs

1//! This library offers basic tensor types:
2//!
3//! - `RefTensor`: Statically sized slices with a mutable reference for data.
4//!     - Ownership: The tensor does not own it's data, it has references for the lifetime `'a` to each slice.
5//!     - Allocation: This tensor has no dynamic allocation, it doesn't have it's own memory, just pointers.
6//! - `ArrTensor`: Statically sized arrays build the foundation for shape and data memory.
7//!     - Ownership: The entire tensor is owned by the `struct`.
8//!     - Allocation: This tensor has no dynamic allocation, it lives on the stack.
9//! - `DynTensor`: A dynamically allocated tensor with far more flexibility than the others.
10//!     - Ownership: The entire tensor is owned by the `struct`.
11//!     - Allocation: This tensor dynamically allocates everything, shape is boxed and data is wrapped in `Arc`.
12//!
13//! Note: The crate is fully documented, `no-std` compatible, and well tested.
14//! It doesn't even need `alloc` unless the `alloc` feature (off by default) is enabled.
15
16#![forbid(missing_docs)]
17#![forbid(clippy::nursery)]
18#![forbid(clippy::all)]
19#![warn(clippy::pedantic)]
20#![allow(clippy::many_single_char_names)]
21#![no_std]
22
23#[cfg(feature = "alloc")]
24extern crate alloc;
25
26mod internal;
27
28pub use internal::views::RefTensor;
29pub use internal::ConstTensorOps;
30pub use internal::TensorOps;
31
32#[cfg(feature = "no_stack")]
33pub use internal::arr_box::ArrTensor;
34
35#[cfg(not(feature = "no_stack"))]
36pub use internal::array::ArrTensor;
37
38#[cfg(feature = "alloc")]
39pub use internal::dynamic::DynTensor;