Skip to main content

Module idx_tensor

Module idx_tensor 

Source
Expand description

Dynamic-length tensor implementation.

Structs§

IdxTensor
Dynamic-rank tensor with structured payload storage – the central data type of tensor4all. IdxTensor stores a logical multi-dimensional tensor of supported scalar values (f32, f64, Complex32, or Complex64) together with a list of DynIndex labels. f64/Complex64 tensors may use compact Storage snapshots; f32/Complex32 tensors retain an eager payload as the authoritative representation because compact storage supports only the 64-bit dtypes. The logical layout may be dense, diagonal, or explicitly structured. The indices carry unique identities (UUIDs) so that contraction, addition, and other binary operations can automatically match legs by identity rather than position.
TensorHermitianEigendecomposition
Hermitian eigendecomposition of a rank-2 IdxTensor. Eigenvectors are returned as a rank-2 tensor whose first index is the input matrix row index and whose second index labels eigenvector columns. The eigenvalues are detached primal values intended for nonsmooth selection logic such as truncation cutoffs.

Enums§

IdxTensorError
Errors returned by the fallible numerical and comparison methods on IdxTensor. The enum is intentionally owned by tensor4all-core: callers can match storage, shape, scalar, subtraction, and invalid-value failures without depending on the internal anyhow plumbing. Wrapped backend diagnostics retain their complete std::error::Error::source chain.
StructuredSelectorError
Errors returned when constructing a compact copy-selector tensor. A copy-selector has logical values scale * delta(left, right) * delta(site, selected_value) and is used to carry a bond through a fixed physical site without dense bond-squared storage.
TensorStorageError
Error returned when IdxTensor::storage or IdxTensor::to_storage cannot produce a compact f64/Complex64 storage snapshot from the authoritative payload. Backend diagnostics remain available through std::error::Error::source instead of being erased into a display string. The error is cloneable so a deferred failure can be retained by cloned tensors without rebuilding a detached primal value.

Traits§

RandomScalar
Trait for scalar types that can generate random values from a standard normal distribution. This enables the generic IdxTensor::random constructor.

Functions§

compute_permutation_from_indices
Compute the permutation array from original indices to new indices. This function finds the mapping from new indices to original indices by matching index IDs. The result is a permutation array perm such that new_indices[i] corresponds to original_indices[perm[i]].
diag_idx_tensor
Create a diagonal tensor with dynamic rank from diagonal data.
print_and_reset_pairwise_contract_profile
Print and clear the aggregated pairwise IdxTensor contraction profile.
reset_pairwise_contract_profile
Reset the aggregated pairwise IdxTensor contraction profile.
unfold_split
Unfold a tensor into a matrix by splitting indices into left and right groups. This function validates the split, permutes the tensor so that left indices come first, and returns a rank-2 native tenferro tensor along with metadata.