Skip to main content

tensor4all_core/defaults/
mod.rs

1//! Default concrete type implementations.
2//!
3//! This module provides the default concrete types for tensor network operations:
4//!
5//! - [`DynId`]: Runtime identity (UUID-based unique identifier)
6//! - [`TagSet`]: Tag set for metadata (Arc-wrapped for cheap cloning)
7//! - [`Index`]: Generic index type (`Index<Id, Tags>`)
8//! - [`DynIndex`]: Default index type (`Index<DynId, TagSet>`)
9//! - [`IdxTensor`]: Dense tensor with dynamic rank
10//!
11//! Linear algebra operations:
12//! - [`svd::svd`]: Singular Value Decomposition
13//! - [`qr::qr`]: QR decomposition
14//! - [`factorize::factorize`]: Unified factorization interface
15//! - [`direct_sum::direct_sum`]: Direct sum of tensors
16//!
17//! These types are suitable for most tensor network applications and provide
18//! a good balance of flexibility and performance.
19
20#[cfg(feature = "tenferro-cuda")]
21mod cuda;
22/// Engine selection for the implicit and context-scoped eager frontends.
23pub(crate) mod eager_session;
24/// Dynamic-length tensor implementation.
25pub mod idx_tensor;
26pub mod index;
27
28// Contraction
29pub mod contract;
30mod contract_session;
31pub(crate) mod structured_contraction;
32
33// Linear algebra modules
34pub mod direct_sum;
35pub mod factorize;
36pub mod qr;
37pub mod svd;
38
39pub use contract::{
40    contract, contract_owned, contract_owned_with_options, contract_pair,
41    contract_pair_with_options, contract_with_options, outer_product,
42    print_and_reset_contract_profile, reset_contract_profile, tensordot, ContractionOptions,
43};
44pub use contract_session::{
45    contract_pair_on_session, contract_with_options_on_session, index_select_on_session,
46    inner_product_on_session, norm_on_session, norm_squared_on_session, permute_indices_on_session,
47    permute_on_session, select_indices_on_session, stack_along_new_index_on_session,
48    sum_on_session,
49};
50#[cfg(feature = "tenferro-cuda")]
51pub use cuda::{IdxTensorCudaError, PendingCudaIdxDownload};
52pub use idx_tensor::{
53    compute_permutation_from_indices, diag_idx_tensor, print_and_reset_pairwise_contract_profile,
54    reset_pairwise_contract_profile, unfold_split, IdxTensor, IdxTensorError, TensorStorageError,
55};
56pub use index::{DefaultIndex, DefaultTagSet, DynId, DynIndex, Index, TagSet};
57
58// Re-export linear algebra functions and types
59pub use direct_sum::direct_sum;
60pub use factorize::{
61    factorize, Canonical, FactorizeAlg, FactorizeError, FactorizeOptions, FactorizeResult,
62};
63pub use qr::{default_qr_rtol, qr, qr_with, set_default_qr_rtol, QrError, QrOptions};
64pub use svd::{svd, svd_with, SvdError, SvdOptions};