Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 60 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,66 @@
![pylint](https://img.shields.io/badge/PyLint-9.01-yellow?logo=python&logoColor=white)
![pylint](https://img.shields.io/badge/PyLint-9.02-yellow?logo=python&logoColor=white)

# Quantum Computing Application Specifications

This projct focuses on the documentation of applications for Quantum Computers.
This project focuses on the documentation of applications for Quantum Computers. Quantum Computing Application (QCA) is a python library for constructing quantum circuits for a set of
kernels and applications from the corresponding paper, and generating a series of resource estimates from it. All resource estimates are in the Clifford + T gateset.

QCA is structured the following:
- notebooks/
- A series of jupyter notebooks corresponding to each chapter in the paper which describes on how the application's workflow would look like. The following is a mapping of the notebook to its corresponding chapter on the report
- ExoticPhasesExample.ipynb -> Chapter 3. Exploring exotic phases of magnetic materials near instabilities
- DickeModelExample.ipynb -> Chapter 4. Driven-dissipative Dicke model in the ultrastrong coupling regime
- HighTemperatureSuperConductorExample.ipynb -> Chapter 5. High-temperature superconductivity and exotic properties of FermiHubbard models
- ArtificialPhotosynthesisExample.ipynb -> Chapter 6. Computational catalysis for artificial photosynthesis
- QuantumChromoDynamicsExample.ipynb -> Chapter 7. Simulations of quantum chromodynamics and nuclear astrophysics
- scripts/
- Python scripts that allows an end user to run an application over the command line
- qca.utils
- Module that contains utility functions regarding constructing circuits for a given application'
- tests/
- Unit test cases to verify QCA's functionality

After running some program, you'd get the following output:
```json
{
[(OPTIONAL) block of metadata information]
[block of resource estimates]
}
```
where the block of metadata information is the following (note that any key below is optional):
```json
{
"name": str, // Name of the experiment
"category": str, // Type of experiment such as scientific or industrial
"size": str, // Size of the Hamiltonian
"task": str, // The computational task such as ground_state_energy_estimation and time_dependent_dynamics
"implementation": str, // Description of the implementation such as block encoding used
"value": float, // The utility estimate in US dollars for the problem
"value_per_t_gate": float, // The utility estimate value per t gate,
"repetitions_per_application": int, // Total number of times to repeat the circuit to realize its utility
"is_extrapolated": bool, // Denoting if the circuit was extrapolated to save compute time
"gate_synth_accuracy": float, // The approximation error to decompose the circuit
"nsteps": int, // Total number of steps taken
"evolution_time": float, // Total evolution time
"energy_precision": float, // Acceptable shift in state energy
}
```

where the block of resource estimations is the following:
```json
{
"num_qubits": int, // number of qubits in the system
"t_count": int, // total number of T gates
"clifford_count": int, // total number of clifford gates
"gate_count": int, // total number of gates
"gate_depth": int, // total gate depth
"subcircuit_occurences": int, // total number of times we come across this subcircuit
"t_depth": int, // total T depth
"max_t_depth_wire": int, // maximum number of T-gates on a wire
}
```

unless stated otherwise, the output will be generated as "{application_name}_re.json"

# Citation

Expand Down
13 changes: 10 additions & 3 deletions src/qca/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def gen_resource_estimate(
gate_count = count_gates(cpt_circuit)
t_count = count_T_gates(cpt_circuit)
t_depth = get_T_depth(cpt_circuit)
max_t_depth_wire = get_T_depth_wire(cpt_circuit)
clifford_count = gate_count - t_count
circuit_depth = len(cpt_circuit)

Expand All @@ -163,6 +164,7 @@ def gen_resource_estimate(
'circuit_depth': circuit_depth,
'gate_count': gate_count,
't_depth': t_depth,
'max_t_depth_wire': max_t_depth_wire,
'clifford_count': clifford_count,
}

Expand Down Expand Up @@ -207,7 +209,8 @@ def estimate_cpt_resources(
if nsteps and is_extrapolated:
highest_scope = logical_re['Logical_Abstract']
for key in highest_scope:
highest_scope[key] = scale_resource(highest_scope[key], nsteps)
if key != 'num_qubits':
highest_scope[key] = scale_resource(highest_scope[key], nsteps)

logical_re['Logical_Abstract']['subcircuit_occurences'] = 1
if include_nested_resources and nsteps:
Expand All @@ -229,6 +232,7 @@ def grab_single_step_estimates(num_qubits: int, main_estimates: dict, algo_name:
'circuit_depth': main_estimates['circuit_depth']//nsteps,
'gate_count': main_estimates['gate_count']//nsteps,
't_depth': main_estimates['t_depth']//nsteps,
'max_t_depth_wire': main_estimates['max_t_depth_wire']//nsteps,
'clifford_count': main_estimates['clifford_count']//nsteps,
'subcircuit_occurences': nsteps,
'subcircuit_info': {}
Expand Down Expand Up @@ -270,7 +274,6 @@ def circuit_estimate(
subcircuit_counts[gate_type][0] += 1
else:
t0 = time.perf_counter()
# decomposed_circuit = cirq.Circuit(cirq.decompose(operation))
decomposed_circuit = complete_decomposition(cirq.Circuit(operation))
t1 = time.perf_counter()
decomposed_elapsed = t1-t0
Expand All @@ -297,6 +300,7 @@ def circuit_estimate(
total_gate_count = 0
total_gate_depth = 0
total_T_count = 0
total_max_T_depth_wire = 0
total_T_depth = 0
total_clifford_count = 0
subcircuit_re = []
Expand All @@ -315,19 +319,21 @@ def circuit_estimate(
gate_depth = resource_estimate['circuit_depth']
t_depth = resource_estimate['t_depth']
t_count = resource_estimate['t_count']
max_t_depth_wire = resource_estimate['max_t_depth_wire']
clifford_count = resource_estimate['clifford_count']

curr_gate_count = subcircuit_occurences * gate_count
curr_gate_depth = subcircuit_occurences * gate_depth
curr_t_depth = subcircuit_occurences * t_depth
curr_t_count = subcircuit_occurences * t_count
curr_max_t_depth_wire = subcircuit_occurences * max_t_depth_wire
curr_clifford_count = subcircuit_occurences * clifford_count

if (nsteps or bits_precision) and is_extrapolated:
total_gate_count += scale_resource(curr_gate_count, nsteps, bits_precision)
total_gate_depth += scale_resource(curr_gate_depth, nsteps, bits_precision)
total_T_depth += scale_resource(curr_t_depth, nsteps, bits_precision)
total_T_count += scale_resource(curr_t_count, nsteps, bits_precision)
total_max_T_depth_wire += scale_resource(curr_max_t_depth_wire, nsteps, bits_precision)
total_clifford_count += scale_resource(curr_clifford_count, nsteps, bits_precision)

main_estimates = {
Expand All @@ -337,6 +343,7 @@ def circuit_estimate(
'circuit_depth': total_gate_depth,
'gate_count': total_gate_count,
't_depth': total_T_depth,
'max_t_depth_wire': total_max_T_depth_wire,
'clifford_count': total_clifford_count,
'subcircuit_occurences': 1,
'subcircuit_info': {}
Expand Down
1 change: 1 addition & 0 deletions tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def test_get_resource_estimate(self):
't_count': 8,
't_depth': 2,
'gate_count': 20,
'max_t_depth_wire': 2,
'clifford_count': 12,
'circuit_depth': 5}
self.assertEqual(circ_estimate, correct_estimate)
Expand Down