Skip to main content

Crate sim_lib_numbers_tensor

Crate sim_lib_numbers_tensor 

Source
Expand description

The n-dimensional tensor number domain: the uniform Tensor value, its domain registration and constructors (tensor, vec, mat, …), and the SpecTensor interface that specialized element-type backends plug into.

Modules§

domains
Canonical symbols for the number-domain family.

Structs§

SpecTensorDescriptor
Metadata describing one registered SpecTensor backend, surfaced as a descriptor value so the registry can advertise the specialized tensor.
Tensor
The uniform tensor value: an n-dimensional array of scalar number cells.
TensorNumbersLib
Registered number-domain library that installs the numbers/tensor domain.

Traits§

SpecTensor
Interface a specialized element-type tensor backend implements to bridge its own storage and the uniform Tensor value.

Functions§

build_scalar_tensor_value
Builds a rank-0 scalar tensor wrapping a single scalar number value.
build_tensor_value
Builds a tensor Value of the given shape from row-major data cells.
checked_element_count
The number of cells in a tensor of the given shape, failing closed when the dimension product overflows usize instead of wrapping (release) or panicking (debug).
element_count
The number of cells in a tensor of the given shape. An empty shape is a scalar (one cell). This is the one home for the element_count helper that the generic, broadcast, linalg, and every typed tensor crate re-grew.
flatten_tensor_scalar_cells
Clones a tensor’s row-major cell values as a flat vector.
number_domain
The symbol naming the tensor number domain (numbers/tensor).
number_literal_for_tensor_cell
Extracts the canonical NumberLiteral of a scalar tensor cell value, or None if the value is not a number. Shared backing for the typed literal-cell parsers below.
parse_complex_literal_cell
Parses a tensor cell as a (real, imaginary) pair, returning None unless it is a number in the numbers/complex domain whose canonical a+bi form parses cleanly.
parse_f64_literal_cell
Parses a tensor cell as an f64, returning None unless it is a number in the numbers/f64 domain whose canonical form parses cleanly.
parse_i64_literal_cell
Parses a tensor cell as an i64, returning None unless it is a number in the numbers/i64 domain whose canonical form parses cleanly.
parse_rational_literal_cell
Parses a tensor cell as a (numerator, denominator) rational pair, returning None unless it is a number in the numbers/rational domain whose canonical num/den form parses cleanly.
spec_tensor_descriptor_value
Encodes a SpecTensorDescriptor as a registry descriptor table value with kind, symbol, dtype, implementation, and storage entries.
spec_tensor_symbol
Builds a descriptor symbol (numbers/tensor-spec/<name>) for a specialized tensor backend.
tensor_dtype
The shared element number domain (dtype) of a tensor’s cells.
tensor_value_class_symbol
The symbol naming the tensor value class (numbers/Tensor) under which tensor values register and reconstruct.
tensor_value_ref
Borrows the Tensor backing a value, or None if it is not a tensor.