Questions tagged [cirq]

A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits. It is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators.

Filter by
Sorted by
Tagged with
1 vote
1 answer
31 views

In Cirq, how do I separate transpilation from execution in simulator.simulate()?

In Qiskit, there are explicit transpile [1] (where a circuit is transpiled to primitive gates) and backend.run [2] (where the ...
user avatar
  • 111
0 votes
1 answer
52 views

Question about Controlled Modulo Quantum Gate

How does the Ux(x, N) function implements Ux|y> -> |xy mod N> ? ...
user avatar
  • 111
1 vote
0 answers
25 views

Amplitude Amplification applied to HHL Algorithm

I’m trying to understand and implement the amplitude amplification algorithm described in the HHL paper. I’m using the cirq implementation of the HHL algorithm as my starting point. I have a couple of ...
user avatar
0 votes
1 answer
39 views

AttributeError: module 'cirq' has no attribute 'google'

I have just installed Qiskit, Qutip, and Cirq in my Anaconda Enviornment. When I tried to run the test program: ...
user avatar
0 votes
0 answers
31 views

unitary matrix of CCZPowGate and CZPowGate

For CCZPowGate , how to derive the unitary matrix of CCZ**t ? and how does it different from that of CZPowGate ?
user avatar
  • 111
2 votes
0 answers
43 views

Simulating density matrices in quantum simulators

I would like to load random quantum states sampled from a given density matrix based on its classical probabilities ie based on the definition of the given density matrix: $\rho = \sum_i p_i |\psi _i \...
user avatar
3 votes
1 answer
95 views

Cirq : Reference for Toffoli decomposition

I was trying to find a reference for the 7 T-gate decomposition of the Toffoli gate given by Cirq. The decomposition originates from the the one used for CCZPowGate as given in the doc string here ...
user avatar
1 vote
1 answer
45 views

How can I define two distinct sets of qubits? (Cirq)

I am trying to familiarise myself with Cirq, and I came across something I don't know how to code. I would like to define two sets of qubits as follows: say the number of qubits in set 1 and 2 are ...
user avatar
  • 13
0 votes
1 answer
34 views

type object 'Circuit' has no attribute 'from_ops'

I am working on a Cirq notebook and the quantum circuit is created in this way: ...
user avatar
  • 223
1 vote
1 answer
57 views

Cirq: Getting The Instances (samples) of a Quantum Circuit with Probabilistic Unitaries or Mixtures

The wavefunction simulator in Cirq uses a Monte Carlo approach to simulate a certain subset of quantum noise channels, namely through probabilistic/stochastic application of unitary gates. These are ...
user avatar
1 vote
1 answer
52 views

cirq_google library in Python

I am trying to use the cirq_google library in Python but I receive an error: ...
user avatar
  • 223
2 votes
0 answers
81 views

How to define a Clifford Gate while given a tableau in Google Cirq?

I would like to uniformly sample from the group of random Clifford gates. I am aware of the paper https://arxiv.org/abs/2003.09412 where they have designed the algorithm to do this task and even ...
user avatar
0 votes
0 answers
12 views

Understanding how control parameter inputs work in tfq.layers.ControlledPQC

In the documentation of tfq.layers.ControlledPQC, the authors provide model_params as one of the argument to the ControlledPQC object ...
user avatar
1 vote
1 answer
39 views

ValueError: Operation doesn't satisfy the given `keep` but can't be decomposed

I was going through Cirq tutorial on Shor's algorithm and was able to implement it successfully using cirq. But it takes forever to run for any n > 21; so I ...
user avatar
1 vote
1 answer
129 views

Writing a Phase Estimation function in Cirq

I am trying to write a phase estimation algorithm using Cirq. The algorithm works for different inputs but I receive a few errors in the estimate_phi(mystery) function. ...
user avatar
  • 223
2 votes
1 answer
64 views

How to Properly Cite Amazon Braket?

This is a fairly basic question, but how does one cite Braket in BibTeX style? A similar question was asked for Cirq in How to cite cirq in a scientific article? but I am unable to find a similar page ...
user avatar
3 votes
1 answer
143 views

How to use Cirq to transpile circuit to custom native gate set?

I am trying to use Cirq to compile arbitrary quantum circuits to custom native gate sets, e.g., to use the Cirq compiler to generate quantum circuits for different quantum computers (IBM, Rigetti, ...
user avatar
  • 33
1 vote
1 answer
54 views

Implementation of .run() methods in google Cirq

I am developing a sampling algorithm using Fourier analysis of Boolean functions for which I use Google's Cirq to obtain the state vector with .simulate(). I wanted to know what sampling algorithm ...
user avatar
  • 15
2 votes
1 answer
58 views

What does PhISwap gate mean in Cirq?

I am currently using the Cirq pakage and when drawing the circuit structure, I constantly encountered the PhISwap gate, like in here. What does this gate mean?
user avatar
3 votes
1 answer
94 views

How to convert Pennylane decompose_hamiltonian to Cirq PauliString?

I have a matrix that I would like to decompose into a Pauli String. Pennylane's qml.utils.decompose_hamiltonian does this and returns a list of coefficients and a list of operations representing the ...
user avatar
  • 31
3 votes
1 answer
69 views

Cirq error models

I have two questions about error channels used in Cirq to model noise quantum circuits. The first one is that for the deplorizing error model, one common setting is to set larger error rates for two-...
user avatar
2 votes
0 answers
65 views

Use parametrized quantum circuit output amplitudes for training in tensorflow

I am trying to train a quantum neural network in tensorflow_quantum (tfq). Using cirq.Circuit I have set up my circuit. I now need to wrap it in a keras model for ...
user avatar
2 votes
1 answer
57 views

Wrong expected value from cirq PauliString

I have to compute the exact expectation value from a state vector obtained after running a circuit. While I was running my code, I found different weird outcome so I decided to create few tests and I ...
user avatar
2 votes
1 answer
117 views

Find and replace gate

I have a collection of circuits with cirq that use CNOT(q1, q2). I would like to be able to find and replace all the instance of this gate in the circuit collection and replace them with a composite ...
user avatar
  • 153
1 vote
0 answers
27 views

Cirq: How to change `atol` in `validate_density_matrix` when using `DensityMatrixSimulator`

I have a code that essentially looks like this ...
user avatar
1 vote
1 answer
80 views

Openfermion state transformation from Bravyi-Kitaev basis to occupation number

I'm working in the Bravyi-Kitaev basis implemented by the openfermion.bravyi_kitaev() function to find the ground state of a fermionic operator in the BK ...
user avatar
1 vote
1 answer
223 views

Is there a quantum circuit builder package that allows you to import/export a circuit as a JSON?

I've done a superficial search in each of the qiskit, cirq, and braket open source repositories for such a feature, but can't find any explicit examples of this functionality. I'm wondering if anyone ...
user avatar
  • 131
0 votes
1 answer
104 views

Random circuits with google cirq

For my dissertation I need to simulate random circuits and I have been trying to use google Cirq for that. Looking at the documentation I have seen how to create my own circuit and simulate it, but it ...
user avatar
  • 15
1 vote
3 answers
1k views

Which quantum computing frame is suitable for optimization problems?

As in the computer world, not all programming languages are suitable for everything. Php = Backend Javascript = Frontend Data Analsys/ML = Python embedded systems = C Mobilphone/apps = Android / Swift ...
user avatar
1 vote
1 answer
71 views

Decomposition of the multi-controlled gate in tensorflow quantum

In TensorFlow Quantum 0.5.0, the support for Cirq gates that have arbitrary control via the gate.controlled_by function is added. I would like to know which kind of ...
user avatar
2 votes
0 answers
63 views

Does anyone know how to use TF Quantum with real hardware data?

I'm currently trying to embed a tensorflow model for denoising measurements as a tensorflow quantum model, and at some point I'd like for this to be able to run on hardware. After reading through all ...
user avatar
1 vote
1 answer
120 views

Does anyone have some references on EigenGate used in Google's cirq framework?

I am trying to understand the code below but can not find any references other than the code itself. https://github.com/quantumlib/Cirq/blob/v0.11.1/cirq-core/cirq/ops/eigen_gate.py I am not clear ...
user avatar
  • 11
1 vote
0 answers
83 views

Quantum Circuits for Time-Series Data

I am currently working with a dataset with autocorrelated features, i.e, x(t) affects the value of x(t+1) which affects the value of x(t+2). Suppose this is the circuit representing x(t): Does ...
user avatar
2 votes
1 answer
195 views

Encoding Numeric data as a quantum circuit in TFQ

I am working on a dataset where I have 6 input features that are numbers in the range of 1 - 1000 that need to be encoded as a quantum circuit. I am using TensorFlow Quantum for my research. While I ...
user avatar
7 votes
2 answers
2k views

Is Qiskit more popular than cirq? Why?

It seems like most people are using Qiskit, what's the difference?
user avatar
0 votes
1 answer
58 views

Cirq QAOA Tasks returns "iteration over a 0-d array" error

I'm trying to understand how to use Recirq for QAOA, and I tried to run the notebook for tasks: https://quantumai.google/cirq/experiments/qaoa/tasks. But it gives a "iteration over a 0-d array&...
user avatar
2 votes
1 answer
103 views

Why `cirq` needs `Qid` class instead of just `Qudit` class?

I am just wondering in what way cirq.Qid class generalizes qudits. From cirq.Qid documentation we read that it Identifies a ...
user avatar
5 votes
1 answer
335 views

Bloch sphere visualization using Cirq, ProjectQ, PyQuil

Is there a way to visualize the Bloch sphere using Cirq, ProjectQ, and/or PyQuil, as it is possible using plot_bloch_vector in Qiskit?
user avatar
1 vote
0 answers
81 views

How to avoid Cirq: State_vector is not normalized error for Feedback-loop in optimizer?

I am doing a VQE in Cirq, but sometimes I get this error while running steps of the classical optimization loop: State_vector is not normalized instead had norm 1.0000000010132789 And therefore the ...
user avatar
0 votes
1 answer
94 views

How can I compose the Ising XXPOW,YYPOW and ZZPOW gate in single qubit gates and CNOT,...?

I am a bit stuck in decomposing these gates in single qubit gates, in the Cirq documentation it is written, for example that XX is for example the tensor product of Rx gates. But when I calculate ...
user avatar
1 vote
1 answer
160 views

Expectation value of an arbitrary observable. My own definition and `cirq` limitations

In my previous question I was struggling with the definition of expectation value of an observable for a circuit. Here is what I have derived after some support (I simplify the definition to 2-qubit ...
user avatar
3 votes
1 answer
144 views

Multiplying quantum circuits in cirq using * and computing "expectation values"

I am reading cirq guide about Simulation and there is an example in "Expectation values" paragraph that I don't understand. Everything boils down to the following snippet: ...
user avatar
2 votes
1 answer
57 views

How to use pass_operation_over with cirq.Operation? [closed]

Lately I saw a pull request in the Cirq GiHub repo where some dev said a test should be defined, with these constraints: You need to find a case where a ...
user avatar
1 vote
1 answer
153 views

Setting the Initial State of Density Matrix Simulation in Cirq

I am trying to use the DensityMatrixSimulator in Cirq. I want to append gates to the circuit conditional on measurements. In order to reduce computational resources, I am trying to run these ...
user avatar
  • 11
1 vote
1 answer
211 views

How to create an observable: 'Identity \tensor Pauli gate' in Cirq

I am working on an implementation of the RQAOA algorithm on the Maxcut problem in Cirq. My graph G has n vertices. And after running a QAOA circuit with n qubits I obtain a state gammabeta (a vertical ...
user avatar
  • 13
5 votes
0 answers
644 views

In Cirq, how do you display circuit diagrams that are "prettier" than the ones displayed by default?

This is a duplicate of a question that was asked on the Cirq issues page. I'm duplicating this question to increase it's visibility. The standard way to print circuits in Cirq is by calling ...
user avatar
0 votes
1 answer
92 views

Best way to compute $\langle a|B|a \rangle$ in Cirq, where a is a state obtained running circuit A. And B is a different Quantum Circuit

I am implementing RQAOA in Cirq. After running regular QAOA to find an optimal state a (This I have done successfully). I need to calculate $\langle a|Z_iZ_j|a\...
user avatar
  • 13
2 votes
0 answers
76 views

Why wont my custom controlled gates in Cirq work on a simulator?

To initialize a state in Cirq, I created a custom controlled rotation and a custom rotation gate. The effect of applying the custom controlled gates to the qubits doesn't seem to affect the state. ...
user avatar
1 vote
1 answer
224 views

Is there a way to present conjugate transpose of a Y Pauli rotation as a Cirq Operator?

Given: Ry(theta) acting on one qubit I'm trying to use existing Cirq Operators to build the conjugate transpose of the above gate. I need the operator to produce the exact unitary of the given gate ...
user avatar
  • 37
1 vote
2 answers
102 views

What are the libararies for Machine Learning on NISQ Chip? And What are the roadmaps?

Nowadays quantum learning is hiring. And we can see mainly two different area. One of them is variational algorithms part. And the other one is classical learning for quantum systems like NISQ. (Some ...
user avatar
  • 446