Coder Social home page Coder Social logo

Generation of CFI files / circuits. about acqdp HOT 3 OPEN

CSNWEB avatar CSNWEB commented on May 4, 2024
Generation of CFI files / circuits.

from acqdp.

Comments (3)

chenkenshin avatar chenkenshin commented on May 4, 2024

Hello @CSNWEB , unlike in other numerical experiments, this function
acqdp/demo/QAOA/qaoa.py at a8bd68e0a73814643e815f461c74a759858780cb · alibaba/acqdp
directly translates a QAOA problem to a tensor network representing the ``lightcone'' of a set of qubits. Unfortunately, it is not possible to generate a unique quantum circuit from a json file representing a tensor network.

For all the numerical experiments mentioned in the original paper, we were given the option to utilize a code capsule. The specific version of the ACQDP package, along with scripts that replicate the results reported in the paper, is accessible at Code Ocean capsule.

You can find the input file and shell commands we ran at https://codeocean.com/capsule/8055748/tree/v3. The command line for CFI is

python -m demo.QAOA.qaoa_demo ../data/QAOA/cfi.json 6  > ../results/QAOA_cfi.result

For random circuit sampling tasks, the command line is

python -m examples.circuit_simulation ../data/SUPREMACY/circuit_n53_m12_s0_e0_pABCDCDAB.qsim -o ../data/SUPREMACY/m12_1.json > ../results/SUPREMACY_m12_1.result

Let me know if you have any further questions.

from acqdp.

toucanmeister avatar toucanmeister commented on May 4, 2024

Hi, I work with @CSNWEB.
Thank you for your answer!

I have another question relating to this.
We've tried using the qaoa_demo script to generate tensor networks from the CFI circuits. We've managed to get the subscripts, but the tensor data (the numpy arrays) seem to be None. Where can we get the tensor data from?

Our attempt so far looks like this:

from . import qaoa
import json
import numpy as np
from sys import argv

exp_name = argv[1]
with open(exp_name, 'r') as f:
    graphs = json.load(f)
num_layers = int(argv[2])
random_angles = np.random.uniform(0, 2 * np.pi, 2 * num_layers)
energy_list = []

a = qaoa.QAOAOptimizer({tuple(e): np.array([[1, -1], [-1, 1]]) for e in graphs['edges']}, num_layers=num_layers)
tn = a.preprocess(**graphs)[0]

inputs, output, shapes = tn.subscripts()
print(inputs)
print(output)
print(shapes)

tensors = [node['tensor']._data for node in tn.nodes.values()]
print(tensors)

Run with python -m demo.QAOA.qaoa_demo ../data/QAOA/tn_CFI_I_blue_4.json 6

from acqdp.

fangzh-umich avatar fangzh-umich commented on May 4, 2024

The tensor data are not determined until QAOAOptimizer.query is called with a concrete set of params, at which point query calls decorate to fill in the data.

from acqdp.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.