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
0 votes
0 answers
9 views

Custom noise models in Cirq

I want to simulate a quantum circuit using Cirq, with a noise model that defines a certain error rate $e_1$ for single-qubit gates and a certain error rate $e_2$ for 2-qubit gates. So I know it's ...
  • 1,574
0 votes
0 answers
17 views

tensorflow, tensorflow-quantum, tensorflow-federated latest version compatibility?

I have been working with on some research on tensorflow, tensorflow-quantum and tensorflow-federated and the problem with that is I just can't install those three at my google colab and I tried ...
  • 123
0 votes
0 answers
11 views

Cirq/OpenFermion Trotterization of parametrised FermionOperator?

I am using OpenFermion and Cirq. I would like to define a Hamiltonian with a symbolic parameter and then generate a quantum circuit via Trotterization of its time evolution, which then also contains ...
  • 71
2 votes
1 answer
35 views

Generalizing a brick-wall circuit acting on qubits to acting on qudits

Recently, I have been creating a "brick layer" circuit of random unitary gates (each acting on 2 qubits) which acts on a n qubit register using cirq. A typical circuit looks like this. (...
1 vote
0 answers
13 views

Two-time correlators in Cirq?

Is there a way to calculate two-time correlators in Cirq directly? For example, suppose we have an initial mixed state described by a density matrix $\rho_0$, and we want to obtain in our quantum ...
1 vote
1 answer
55 views

Efficient simulation of circuit with variable depth using Cirq

I have a program that needs to evaluate several Cirq circuits by using both simulators the Simulator() and ...
1 vote
0 answers
21 views

How to take gradient of the `tfq.layers.State` output?

I am using the following code for building a quantum circuit as a custom tf.keras.layers.Layer: ...
0 votes
1 answer
50 views

How to change the qubits of a cirq Circuit?

I am constructing generic circuits, and I would like to change the qubits after creating the circuits. Is there a way in cirq to do so? for instance: ...
  • 325
0 votes
0 answers
43 views

Topmost Universal Gate Based Quantum Simulator?

I am Elijah I'm interested in Drug Discovery and Materials Simulation. I want to purchase a gate based Quantum Simulator for research. I received a proposal. Full State Simulator 30 Qubits on Laptop, ...
3 votes
1 answer
61 views

how to flatten a cirq.Circuit with CircuitOperation

I have a cirq.Circuit that uses a CircuitOperation, something like: ...
  • 325
0 votes
0 answers
31 views

How can i describe Custome Gate Sets in Cirq?

i try to create a Custome GateSet with the CompilationTargetGateset class but it does not work. ...
  • 117
1 vote
0 answers
33 views

Is there a method in pyQuil to create logical boolean gates

is there another way to represent a boolean gate. The straight forward way would be to define a gate my a matrix and then apply this gate to the circuit. What i mean by that? For Example an AND-Gate ...
  • 117
4 votes
1 answer
172 views

How to define a custom gate from a matrix in TKET

I'm currently learning all about different quantum tools such as qiskit, tket, cirq, Forest SDK and so on. I just want to create a circuit that gets executed given a matrix, because a circuit can be ...
  • 117
1 vote
0 answers
23 views

Convert an integer to its basis state in Cirq

I am trying to implement Quantum Adder using QFT in Cirq. I previously did the same problem using Pennylane, in which I converted an integer into its Basis state using the BasisStatePreparation method ...
1 vote
0 answers
76 views

How to rewrite this Cirq problem into Qiskit?

I have a following example problem in Cirq, representing a very simple operator given by $$ \hat{H} = a^\dagger_0a_2 + a_0a^\dagger_1 + 0.9\, a^\dagger_0a_1a^\dagger_2a^\dagger_3 + a^\...
  • 211
2 votes
1 answer
81 views

Merge two Y**0.5 gate into a single Y gate

How can I merge two consecutive cirq.Y**0.5 gates into a single cirq.Y gate with a transformer? I can use ...
  • 349
0 votes
0 answers
14 views

Noise model on CircuitOperation

When I use a self-defined NoiseModel to add noise to the circuit in cirq, it treats cirq.CircuitOperation as a single operation ...
  • 349
1 vote
1 answer
38 views

Two Qudit custom gate error in Cirq

I am trying to build two qudit CX (d-dim) gate. and getting below error. There is no issue in the unitary matrix. Please suggest to resolve the error.
  • 15
0 votes
1 answer
41 views

Interpretation of Qudit measurement output in cirq

Here [+1] represents X gate for qutrit. How the Counter value is coming to 5? which is the measurement outcome(q0q1q2->102). Even for (q0q1q2->101) also counter value is 5. In total, for this 3 ...
  • 15
1 vote
1 answer
127 views

How we can perform measurements on an X, Y or Z basis in cirq?

How we can perform measurements on an X, Y or Z basis in cirq? Is there any function where we can give the list of qubits and measurement basis as an argument and get the output?
0 votes
1 answer
50 views

Printing Stabilizer State of a circuit using Cirq

How to print the stabilizers for a given circuit using Cirq (just like in Qiskit)? For example, if I have the following cluster state and make a circuit using Cirq. I give the circuit as input, and I ...
0 votes
0 answers
26 views

Why importing cirq_ionq gives an unexpected argument error

I'm trying to install cirq_ionq, a python library for running cirq circuits on IonQ's quantum hardware. However, when I try importing it I get an unexpected argument error: ...
3 votes
1 answer
278 views

is cirq suitable for simulation of quantum error correction?

I experimented with stim and qiskit for QECC simulations. They both have limitations : for example stim has no support for non-clifford operations (qiskit does); qiskit has no support for multiple ...
  • 1,475
0 votes
1 answer
88 views

$S^2$ expectation value of a circuit seems wrong

I need to rewrite a following circuit from Cirq to Qiskit with $2\varphi = \pi$. It's a circuit representing an initial state for VQE calculation. Considering, that ...
  • 211
0 votes
1 answer
71 views

CIRQ How to iteratively apply a multi qubit gate to first n qubits

I've got an arbitrary n qubit circuit, with a "for Q in range(n):", which creates a custom gate class that affects (Q+1) qubits, which I want to apply to first (Q+1) qubits of the circuit ...
1 vote
1 answer
124 views

Use simulator.simulate() to obtain probability distribution instead of simulator.run() (cirq)

So far, I have my code set up to find the probability distribution using simulator.run(), and I was wondering if I can use the simulator.simulate() function instead to obtain a probability ...
  • 101
1 vote
2 answers
112 views

How to measure a qubit and depending on measurement outcome act with a gate (cirq)

Is there a way on cirq that I can make a measurement on a qubit, and depending on the outcome of that measurement act with another gate on that qubit. So, I want to measure a qubit (in the ...
  • 101
0 votes
0 answers
56 views

Circuit gives unexpected phase factor (cirq)

I implemented the following circuit on cirq: For clarity: the circuit consists of X gates, (controlled) Hadamard gates (H), N-toffoli gates, and reset operations (R). The (1,4) qubit is the one I ...
  • 101
1 vote
0 answers
22 views

duality quantum computing simulation

I am a starter of this quantum mostly new to quantum computing but I wonder if there is any option of simulating duality quantum computing in qiskit or IBM q or any other alternative way? Duality ...
1 vote
1 answer
74 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 ...
  • 111
0 votes
1 answer
106 views

Question about Controlled Modulo Quantum Gate

How does the Ux(x, N) function implements Ux|y> -> |xy mod N> ? ...
  • 111
1 vote
0 answers
56 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 ...
0 votes
1 answer
289 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: ...
0 votes
0 answers
57 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 ?
  • 111
2 votes
0 answers
74 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 \...
3 votes
1 answer
121 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 ...
1 vote
1 answer
74 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 ...
  • 101
0 votes
1 answer
141 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: ...
  • 223
1 vote
1 answer
72 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 ...
1 vote
1 answer
63 views

cirq_google library in Python

I am trying to use the cirq_google library in Python but I receive an error: ...
  • 223
2 votes
0 answers
130 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 ...
0 votes
0 answers
24 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 ...
1 vote
1 answer
46 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 ...
1 vote
1 answer
198 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. ...
  • 223
3 votes
1 answer
130 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 ...
3 votes
1 answer
244 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, ...
  • 33
1 vote
1 answer
61 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 ...
  • 15
2 votes
1 answer
87 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?
3 votes
1 answer
184 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 ...
  • 31
3 votes
1 answer
114 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-...