Expand description
Tensor storage and linear algebra backend for tensor4all.
CpuExecutionContext is the canonical CPU integration path. It requires a
caller-supplied backend and owns plain, graph, and eager-AD runtime state.
§Feature flags
explicit-context: explicit CPU execution and logical tensor transfer.global-defaults: legacy process-global tensor operations.backend-tenferro(default): compatibility alias forglobal-defaults.
Structs§
- Allocator
Pressure Relief - Result reported by
release_process_allocator_cached_memory. - Backend
Linalg Error - Error returned by the CPU backend linear-algebra dispatch helpers.
- Backend
Scalar - Dynamic scalar used across tensor4all backends.
- Bridge
Error - Error returned by the storage/tensor bridge helpers.
- CpuExecution
Context - Caller-owned CPU execution domain for plain, graph, and eager-AD work.
- Full
PivLu Matrix Result - Result of complete-pivoting LU decomposition on
Matrixvalues. This is the matrix-shaped counterpart ofFullPivLuResult. It exists so downstream crates can use backend linalg without hand-writingTypedTensorconversion code. - Full
PivLu Result - Result of complete-pivoting LU decomposition
P A Q^T = L U. The parity output from tenferro is intentionally omitted because current tensor4all callers only need the permutation matrices and the upper triangular factor for pivot selection. - Hermitian
Eigendecomposition - Full eigendecomposition of a small Hermitian projected matrix.
- Hermitian
Eigenpair - Small Hermitian eigenpair returned by
lowest_hermitian_eigenpair. - Logical
Tensor - Backend-free, dtype-preserving logical host tensor in column-major order.
- Matrix
- A dense 2D matrix in column-major layout.
- Storage
- Storage backend for tensor data.
- Structured
Storage - Structured tensor snapshot storage.
- SvdResult
- Result of SVD decomposition
A = U * diag(S) * Vt. The singular values are stored in a real-valued typed tensor, even when the input matrix is complex.
Enums§
- CpuExecution
Context Error - Error returned by explicit CPU context graph or eager-runtime operations.
- Eager
Context Error - Error returned when the process-global eager AD runtime cannot be initialized.
- Hermitian
Eigen Error - Error returned by
lowest_hermitian_eigenpair. - Logical
Tensor Data - Owned column-major scalar payload for a
LogicalTensor. - Logical
Tensor Error - Error returned while validating, snapshotting, or reconstructing a logical tensor.
- Matrix
Shape Error - Error returned when matrix shape or index validation fails.
- Matrix
Tensor Conversion Error - Error returned when converting a [
TypedTensor] into aMatrix. - Native
Tensor Read Input - Read-only native tensor input that can either borrow external payload data or own a temporary materialized tensor.
- Storage
Error - Errors returned by storage payload and elementwise operations.
- Storage
Kind - Classifies the compact layout used by
Storage.
Traits§
- Backend
Linalg Scalar - Scalar bound accepted by tensor4all’s typed linalg wrappers.
- BlasMul
- BLAS-backed matrix multiplication dispatch.
- Full
PivLu Scalar - Scalar types that can solve
T * P = Pi1via a right full-pivoting LU solve on the tenferro backend. - Hermitian
Eigen Scalar - Scalar types supported by
lowest_hermitian_eigenpair. - Matrix
Scalar - Scalar bound for dense backend matrix utilities.
- Matrix
Solve Scalar - Scalar types supported by
solve_matrix.f64andComplex64are solved directly.f32andComplex32are promoted to the corresponding 64-bit dtype for the backend solve and then converted back, because the current tenferro CPU LU solve is double precision only. - Matrix
Triangular Solve Scalar - Scalar types supported by
triangular_solve_matrix.f64andComplex64are solved directly.f32andComplex32are promoted to the corresponding 64-bit dtype for the backend solve and then converted back, because the current tenferro CPU triangular solve is double precision only. - Storage
Scalar - Trait for scalar types that can be stored in
Storage. - SumFrom
Storage - Types that can be computed as the result of a reduction over
Storage. - Tensor
Element - Public scalar element types supported by tensor4all dense/diag constructors.
Functions§
- axpby_
native_ tensor - Compute
a * lhs + b * rhs. - axpby_
storage_ native - Compute
a * lhs + b * rhsover storages via native tensors. - batched_
mat_ mul_ same_ shape - Batched matrix multiplication for column-major matrices with one shared shape.
- batched_
mat_ mul_ same_ shape_ owned - Batched matrix multiplication while consuming column-major input buffers.
- conj_
native_ tensor - Conjugate a native tensor.
- contract_
native_ tensor - Contract two native tensors along matching axes.
- contract_
storage - Contract two storage tensors along specified axes.
- contract_
storage_ native - Contract storages via native tensors.
- default_
eager_ ctx - Return the optional process-global eager context used by convenience APIs.
- dense_
native_ tensor_ from_ col_ major - Build a dense native tensor from column-major data.
- diag_
native_ tensor_ from_ col_ major - Build a dense native tensor whose logical values are diagonal.
- einsum_
native_ tensor_ reads - Execute a cached einsum over read-only native tensor inputs.
- einsum_
native_ tensors - Execute a cached einsum over borrowed native tensors.
- einsum_
native_ tensors_ owned - Execute a cached einsum over owned native tensors.
- from_
vec2d - Create a matrix from a rectangular 2D vector.
- full_
piv_ lu_ backend - Compute complete-pivoting LU with the configured tenferro backend.
- full_
piv_ lu_ matrix - Compute complete-pivoting LU for a column-major
Matrix. This is a convenience wrapper overfull_piv_lu_backendfor callers that useMatrixas their dense boundary type. - hermitian_
eigendecomposition - Compute all eigenpairs of a small Hermitian projected matrix.
- hermitian_
exponential_ first_ column - Compute the first column of
exp(exponent * A)for a small Hermitian matrix. - lowest_
hermitian_ eigenpair - Compute the smallest eigenpair of a small Hermitian projected matrix.
- make_
mut_ storage - Helper to get a mutable reference to storage, cloning if needed (COW).
- mat_mul
- Matrix multiplication: A * B.
- mat_
mul_ owned - Matrix multiplication: consume
AandB, returningA * B. - min_dim
- Get the minimum dimension from a slice of dimensions.
- native_
tensor_ primal_ to_ dense_ col_ major - Materialize dense column-major values from a native tensor.
- native_
tensor_ primal_ to_ diag - Materialize diagonal values from a native tensor, promoting to the
matching real (
f64) or complex (Complex64) dtype. - native_
tensor_ primal_ to_ storage - Materialize a native tensor into dense storage.
- outer_
product_ native_ tensor - Compute the outer product of two native tensors.
- outer_
product_ storage_ native - Outer-product storages via native tensors.
- permute_
native_ tensor - Permute axes of a native tensor.
- permute_
storage_ native - Permute storage by round-tripping through native tensors.
- print_
and_ reset_ native_ einsum_ profile - Print and clear the aggregated native einsum profile.
- qr_
backend - Compute a thin/economy QR decomposition on a typed tensor.
- qr_
native_ tensor - Compute a QR decomposition on a native tensor.
- release_
process_ allocator_ cached_ memory - Ask the process allocator to return cached/free memory to the operating system.
- reset_
native_ einsum_ profile - Reset the aggregated native einsum profile.
- reshape_
col_ major_ native_ tensor - Reshape a native tensor without changing its column-major linearization.
- scale_
native_ tensor - Multiply a native tensor by a dynamic scalar.
- scale_
storage_ native - Scale storage by a scalar via native tensors.
- solve_
backend - Solve
A X = Bwith the configured tenferro backend. - solve_
matrix - Solve
A X = Bfor column-majorMatrixvalues. This routes the operation through the configured tenferro backend and keeps matrix-to-tensor conversion centralized intensor4all-tensorbackend. - solve_
matrix_ owned - Solve
A X = Bwhile consuming column-majorMatrixvalues. This routes the operation through the configured tenferro backend and reuses the input buffers when constructing backend tensors for directly supported scalar types. - storage_
payload_ native_ read_ input - Build a read-only native tensor input over the compact storage payload.
- storage_
to_ native_ tensor - Convert storage to a dense native tensor.
- submatrix
- Get a submatrix by selecting specific rows and columns.
- submatrix_
argmax - Find the position and value of the maximum absolute value in a submatrix.
- sum_
native_ tensor - Sum all elements of a native tensor, returning a dynamic scalar.
- svd_
backend - Compute a thin/economy SVD on a typed tensor.
- svd_
native_ tensor - Compute an SVD on a native tensor.
- swap_
cols - Swap two columns in a matrix in-place.
- swap_
rows - Swap two rows in a matrix in-place.
- tangent_
native_ tensor - Return the tangent tensor when present.
- transpose
- Transpose the matrix.
- triangular_
solve_ backend - Solve a triangular system with the configured tenferro backend.
If
left_sideis true, this solvesop(A) X = B; otherwise it solvesX op(A) = B.lowerselects the triangular half,transpose_aapplies a transpose toA, andunit_diagonaltreats the diagonal ofAas ones. - triangular_
solve_ matrix - Solve a triangular system for column-major
Matrixvalues. Ifleft_sideis true, this solvesop(A) X = B; otherwise it solvesX op(A) = B.lowerselects the triangular half,transpose_aapplies a transpose toA, andunit_diagonaltreats the diagonal ofAas ones. - triangular_
solve_ matrix_ owned - Solve a triangular system while consuming column-major
Matrixvalues. Ifleft_sideis true, this solvesop(A) X = B; otherwise it solvesX op(A) = B.lowerselects the triangular half,transpose_aapplies a transpose toA, andunit_diagonaltreats the diagonal ofAas ones. - try_
from_ vec2d - Create a matrix from a 2D vector, returning an error for ragged rows.
- with_
default_ backend - Run a closure against the optional process-global CPU backend.
Type Aliases§
- Storage
Result - Result type returned by storage methods that can fail with
StorageError.