Skip to main content

Crate tensor4all_tensorbackend

Crate tensor4all_tensorbackend 

Source
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 for global-defaults.

Structs§

AllocatorPressureRelief
Result reported by release_process_allocator_cached_memory.
BackendLinalgError
Error returned by the CPU backend linear-algebra dispatch helpers.
BackendScalar
Dynamic scalar used across tensor4all backends.
BridgeError
Error returned by the storage/tensor bridge helpers.
CpuExecutionContext
Caller-owned CPU execution domain for plain, graph, and eager-AD work.
FullPivLuMatrixResult
Result of complete-pivoting LU decomposition on Matrix values. This is the matrix-shaped counterpart of FullPivLuResult. It exists so downstream crates can use backend linalg without hand-writing TypedTensor conversion code.
FullPivLuResult
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.
HermitianEigendecomposition
Full eigendecomposition of a small Hermitian projected matrix.
HermitianEigenpair
Small Hermitian eigenpair returned by lowest_hermitian_eigenpair.
LogicalTensor
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.
StructuredStorage
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§

CpuExecutionContextError
Error returned by explicit CPU context graph or eager-runtime operations.
EagerContextError
Error returned when the process-global eager AD runtime cannot be initialized.
HermitianEigenError
Error returned by lowest_hermitian_eigenpair.
LogicalTensorData
Owned column-major scalar payload for a LogicalTensor.
LogicalTensorError
Error returned while validating, snapshotting, or reconstructing a logical tensor.
MatrixShapeError
Error returned when matrix shape or index validation fails.
MatrixTensorConversionError
Error returned when converting a [TypedTensor] into a Matrix.
NativeTensorReadInput
Read-only native tensor input that can either borrow external payload data or own a temporary materialized tensor.
StorageError
Errors returned by storage payload and elementwise operations.
StorageKind
Classifies the compact layout used by Storage.

Traits§

BackendLinalgScalar
Scalar bound accepted by tensor4all’s typed linalg wrappers.
BlasMul
BLAS-backed matrix multiplication dispatch.
FullPivLuScalar
Scalar types that can solve T * P = Pi1 via a right full-pivoting LU solve on the tenferro backend.
HermitianEigenScalar
Scalar types supported by lowest_hermitian_eigenpair.
MatrixScalar
Scalar bound for dense backend matrix utilities.
MatrixSolveScalar
Scalar types supported by solve_matrix. f64 and Complex64 are solved directly. f32 and Complex32 are 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.
MatrixTriangularSolveScalar
Scalar types supported by triangular_solve_matrix. f64 and Complex64 are solved directly. f32 and Complex32 are 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.
StorageScalar
Trait for scalar types that can be stored in Storage.
SumFromStorage
Types that can be computed as the result of a reduction over Storage.
TensorElement
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 * rhs over 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 over full_piv_lu_backend for callers that use Matrix as 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 A and B, returning A * 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 = B with the configured tenferro backend.
solve_matrix
Solve A X = B for column-major Matrix values. This routes the operation through the configured tenferro backend and keeps matrix-to-tensor conversion centralized in tensor4all-tensorbackend.
solve_matrix_owned
Solve A X = B while consuming column-major Matrix values. 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_side is true, this solves op(A) X = B; otherwise it solves X op(A) = B. lower selects the triangular half, transpose_a applies a transpose to A, and unit_diagonal treats the diagonal of A as ones.
triangular_solve_matrix
Solve a triangular system for column-major Matrix values. If left_side is true, this solves op(A) X = B; otherwise it solves X op(A) = B. lower selects the triangular half, transpose_a applies a transpose to A, and unit_diagonal treats the diagonal of A as ones.
triangular_solve_matrix_owned
Solve a triangular system while consuming column-major Matrix values. If left_side is true, this solves op(A) X = B; otherwise it solves X op(A) = B. lower selects the triangular half, transpose_a applies a transpose to A, and unit_diagonal treats the diagonal of A as 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§

StorageResult
Result type returned by storage methods that can fail with StorageError.