| Crates.io | qua_ten_net |
| lib.rs | qua_ten_net |
| version | 0.2.0 |
| created_at | 2024-12-17 14:49:16.267286+00 |
| updated_at | 2025-06-08 17:47:50.704324+00 |
| description | Rust package providing essential tools for working with tensor networks in computational quantum physics. |
| homepage | |
| repository | https://github.com/hoomania/QuaTenNet |
| max_upload_size | |
| id | 1486353 |
| size | 182,147 |

QuaTenNet is a Rust package providing essential tools for working with tensor networks in computational quantum physics. This library aims to facilitate the development and analysis of tensor network algorithms, making it easier for researchers and developers to implement computational quantum simulations.
ndarray for efficient manipulation of high-dimensional tensors.To include QuaTenNet in your Rust project, add the following line to your Cargo.toml file:
[dependencies]
qua_ten_net = "0.1.0" # Replace with the latest version
Tensor contraction is fundamental to tensor networks. In the graphical representation of tensor contraction, each tensor is depicted as a geometric object (usually a circle), and the indices of the tensor are represented as legs that connect to the tensor. This visualization helps in understanding the relationships and operations between tensors in a network.
In the tencon module, free legs are addressed using negative numbers, while each positive number must be repeated twice in the contraction order. This approach ensures clarity in the representation of tensor connections and contractions.

The contraction graph above can be represented in Rust code as follows, allowing us to contract our tensors with a simple syntax:
let tensor_a = tensor::random(&[3, 2, 2]); // Define A with a shape of (3, 2, 2)
let tensor_b = tensor::random(&[2, 2, 4, 5]); // Define B with a shape of (2, 2, 4, 5)
let tensor_c = tencon::contract(
&[tensor_a, tensor_b],
&[&[-1, 1, 2], &[1, 2, -2, -3]],
)
You can find examples of how to use QuaTenNet in the examples directory.
To run an example, use the following command:
cargo run --example tencon
cargo run --example tendot
cargo run --example trace
cargo run --example tensor
Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.
This project is licensed under the GPLv3. See the LICENSE file for more details.