question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generalize `CricuitGraph.iterate_parametrized_layers` regarding commuting gates.

See original GitHub issue

Feature details

Currently, CircuitGraph.iterate_parametrized_layers will generate the layers such that no gates within a parametrized layer use any same qubit. Instead, one could consider commuting parametrized operations to belong to the same layer, for example in

def circuit(x, y):
    qml.IsingXX(x, wires=[0, 1])
    qml.IsingXX(x, wires=[1, 2])
    qml.IsingYY(y, wires=[0, 1])
    qml.IsingYY(y, wires=[1, 2])

the current functionality will produce four layers, whereas I suggest to consider the two IsingXX and the two IsingYY to belong to the same layer, respectively.

As far as I can tell, the only use of iterate_parametrized_layers currently is in metric_tensor, for which this change is intended, because it reduces the number of circuits while increasing the subset of tensor entries that can be computed, using the covariance matrix based method. This cost reduction propagates through to the new Hadamard-test based metric tensor, because it computes the block diagonal using the covariance approach.

Implementation

This is non-trivial to do if we want to support all gates optimally, I think.

How important would you say this feature is?

1: Not important. Would be nice to have.

Additional information

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
josh146commented, Oct 12, 2021

This really makes me cringe 😬 but: #295 introduced the CircuitGraph (including the layer iteration algorithm), the metric tensor, the QNG optimizer, and the Operator.generator attribute… all at once 😬 😬

1reaction
josh146commented, Oct 12, 2021

I have a feeling it was added for something else prior to the metric tensor 😆 But I can’t recall what.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameterized quantum circuits as machine learning models
The first strategy to circuit design aims to comply with the fact that NISQ hardware has few qubits and usually operates on a...
Read more >
Circuit Transformations for Quantum Architectures - arXiv
A quantum circuit can be viewed as a directed acyclic graph (DAG), where vertices represent gates and directed edges represent qubit ...
Read more >
Generalization in quantum machine learning from few training ...
Abstract. Modern quantum machine learning (QML) methods involve variationally optimizing a parameterized quantum circuit on a training data set, ...
Read more >
Commuting Compositions for Quantum Circuit Reduction
gate sequences in support of circuit reduction. In particular, this work generalizes the notion of commuting gates and layers to n-layer ...
Read more >
Generalized swap networks for near-term quantum computing
For example, a single level of a QAOA circuit for Maximum Cut can be implemented in linear depth, and a single level for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found