A tensor contraction path finder. Tensor network can be contracted in a specific order, JDtensorPath utilizes hypergraph partitioning to build contraction order.
Main Features
Hyper-graph based path finder. Search a tensor network contraction path by using hyper-graph partitioning technique.
Fast and memory saving. Using new algorithm in setting partition weight and slcing, both memory usage and time consumption is smaller that other softwares.
Good compatibility. Can use jax or pytorch backend to carry out the contraction.
parallelism. Contraction can be done in a parallel manner.
# 'target_num_slices' is useful if you want to do the contraction in parallel, it will devide the tensor network into pieces and then calculat them in parallel
# 'math_repeats' means how many times are going to run JDtensorPath to find a best contraction path
# 'search_parallel' means to run the JDtensorPath in parallel, True means to use all the CPUs, integer number means to use that number of CPUs
from jdtensorpath import JDOptTN as jdopttn
slicing_opts = {'target_size':2**28, 'repeats':500, 'target_num_slices':None, 'contract_parallel':False}
hyper_opt = {'methods':['kahypar'], 'max_time':120, 'max_repeats':12, 'search_parallel':True, 'slicing_opts':slicing_opts}
my_compilecircuit = circuit.compilecircuit(backend="pytorch", use_jdopttn=jdopttn, hyper_opt = hyper_opt, tn_simplify = False)
Run the circuit
import torch
a = torch.tensor([0.54], requires_grad= True)
b = torch.tensor([0.12], requires_grad= True)
my_params = (a, b)
c = my_compilecircuit(*my_params)
>>> c = tensor([0.8515], grad_fn=<TorchExecuteBackward>)
Learn more
Please refer to the tutorials and examples of TeD-Q.
Tutorial and examples
For more diverse examples of using JDtensorPath together with TeD-Q, please refer to the following tutorials or our official documentation website.
JDtensorPath is released by JD Explore Academy and is currently maintained by Xingyao Wu. The project is not possible without the efforts made by our contributors.
License
JDtensorPath is free and open source, released under the Apache License, Version 2.0.
JDtensorPath
A tensor contraction path finder. Tensor network can be contracted in a specific order, JDtensorPath utilizes hypergraph partitioning to build contraction order.
Main Features
Installation
Prerequisite
Install
Getting started
Use JDtensorPath together with TeD-Q.
Simple example
Define the circuit with TeD-Q framework
Quantum circuit constuction
Compile quantum circuit with JDtensorPath
Run the circuit
Learn more
Please refer to the tutorials and examples of TeD-Q.
Tutorial and examples
For more diverse examples of using JDtensorPath together with TeD-Q, please refer to the following tutorials or our official documentation website.
1D Many Body Localization
Authors
JDtensorPath is released by JD Explore Academy and is currently maintained by Xingyao Wu. The project is not possible without the efforts made by our contributors.
License
JDtensorPath is free and open source, released under the Apache License, Version 2.0.