qua_ten_net

Crates.ioqua_ten_net
lib.rsqua_ten_net
version0.2.0
created_at2024-12-17 14:49:16.267286+00
updated_at2025-06-08 17:47:50.704324+00
descriptionRust package providing essential tools for working with tensor networks in computational quantum physics.
homepage
repositoryhttps://github.com/hoomania/QuaTenNet
max_upload_size
id1486353
size182,147
Hooman (hoomania)

documentation

README

QuaTenNet (QTN)

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.

Features

  • General tools for constructing and manipulating tensor networks.
  • Utilizes ndarray for efficient manipulation of high-dimensional tensors.
  • Use Greedy algorithm for tensor contraction.
  • User-friendly API for seamless integration into quantum physics projects.

Installation

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

Contraction Graph

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.

Contraction Graph

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]],
    )

Examples

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

Contribution

Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.

License

This project is licensed under the GPLv3. See the LICENSE file for more details.

Commit count: 18

cargo fmt