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.
187
questions
2
votes
1
answer
203
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 ...
0
votes
1
answer
196
views
Initialize circuit by density matrix (i.e. mixed state) by Cirq, Qiskit, QuTip
I want to do a simulation involving:
mid-circuit measurement (i.e. based on the measurement result of some qubits to append further gates on other qubits; e.g., Pauli error correction in entanglement ...
1
vote
1
answer
512
views
Marking a specific quantum state in the oracle function in the Grover's algorithm
I have a simple implementation of Grover's algorithm. As depicted in the results below, the oracle function marks the state |111>. How can I change the Oracle function to mark |010>?
...
2
votes
0
answers
73
views
Is there a theoretical method to achieve a positive semi-definite density matrix in QST?
The problem of encountering negative eigenvalues in the density matrix during Quantum State Tomography (QST) is well-explained in this Quantum Computing Stack Exchange post.
However, I am seeking ...
0
votes
0
answers
28
views
How can I measure qutrits in the X basis using cirq?
I attempted to create a custom measurement class which, in my case, allows us to go from the z basis to x basis using a hadamard gate transformation, and then we measure wrt that new basis. However, ...
0
votes
1
answer
231
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:
...
1
vote
1
answer
95
views
quantum multiplier for large numbers
I am working on a project where I need to calculate 3x+1 for numbers 0 to infinity. I have an 8GB RAM laptop and I am using Cirq. For small numbers, I was able to perform the multiplication using the ...
2
votes
2
answers
595
views
VQE Cirq example
Is my understanding correct that in this example the Hamiltonian measurement is not performed through measuring individual Pauli operators because all its terms are mutually commuting? So, for each ...
1
vote
1
answer
96
views
Need help regarding building a custom VQE
I want to write code for a custom Variational Quantum Eigensolver (VQE) capable of computing eigenvalue(s) for non-Hermitian systems, based on this paper. I have formulated a cost function (provided ...
0
votes
0
answers
24
views
How do I perform measurements in the X basis for qutrits in cirq?
After applying the hadamard gate to a 0 state qutrit, I should be able to get it into the + state, but how do I then measure the circuit in the X basis as opposed to the computational basis?
2
votes
1
answer
165
views
In Cirq, how do I separate transpilation from execution in simulator.simulate()?
In Qiskit, there are explicit transpile (where a circuit is transpiled to primitive gates) and backend.run (where the circuit is executed in either statevector simulation or real hardware) steps. What ...
0
votes
0
answers
13
views
Expectation values with finite number of shots with qsimcirq
I was using qsimcirq for VQE to obtain exact expectation values of the energy for a certain Hamiltonian with
...
0
votes
0
answers
59
views
Why does cirq produce a non-positive semidefinite density matrix doing quantum tomography?
While doing quantum tomography in cirq, I ended up getting a density matrix which is not positive semi-definite. Why is this so? Here's the code I used:
...
1
vote
1
answer
53
views
How does the cirq compilation process work?
Cirq compilation process.
I cannot find the documentation that describes the internal structure of the library Cirq by Google.
There is much information related to high level functions, but none ...
-1
votes
2
answers
64
views
How to do quantum tomography on a subsystem of 2 of 30 qubits in cirq?
I have a 30 qubit system and I need to do quantum tomography on a subsystem of 2 of its qubit. How can I do this in Cirq?
1
vote
0
answers
36
views
Finding partial trace in CIRQ
Suppose I have a 30 qbit system, due to computational complexity, I can't find the density matrix of the system. But is it possible to find the partial trace of the a sub-system of 2 qubits out of 30 ...
3
votes
2
answers
101
views
How to compose a larger circuit onto a smaller circuit in Qiskit, adding extra quantum registers to some fixed list
$\newcommand{\ket}[1]{|{#1}\rangle}$
I have a Qiskit quantum circuit for multiplication $M$, that I want to compose onto another qiskit quantum circuit for inner ...
0
votes
1
answer
111
views
How to implement a depolarizing noise channel for qutrits using cirq?
Anyone have any idea how I can implement a depolarizing noise channel for qutrits using cirq? Say using the kraus operators within a class inheriting from cirq.Gate or so?
1
vote
2
answers
84
views
How can we see on Cirq that Google Sycamore has 54 qubits?
Hello, can you explain how to see in Google Cirq that the figure above is a 54 qubits quantum computer ? thanks
1
vote
0
answers
27
views
How to convert a custom observable matrix to a Cirq observable for simulation?
I aim to conduct a Cirq simulation using a custom observable. However, the measure_observables function in Cirq requires an Iterable of cirq.PauliString, making it challenging to directly use a custom ...
1
vote
1
answer
68
views
cirq entanglement qubits
The following code originates from a third-party, although, I have added the commented line containing "UNCOMMENT THE START OF THIS LINE".
...
1
vote
2
answers
384
views
How to create a multicontrol mcx gate or operation in cirq
In qiskit the method to apply a multi control with more than 2 control qubits is:
qc.mct ( listcontrols,targetbit,listancillas, mode=mode[i])
What is the ...
1
vote
1
answer
157
views
Measuring a specific observable using cirq
I am simulating a circuit in cirq, and I need to measure an observable $$A(\theta) = R^\dagger_z(\theta)XR_z(\theta),$$
and I am not quite sure how to do that.
My first thought was to apply these ...
1
vote
0
answers
57
views
Tensorflow_quantum hybrid models tf-quantum
I am trying to QCNN for MNIST classification equivalent to that built in.
I’m having problems trying to pass my quantum circuit built with cirq as a Keras layer. Here’s what I have:
...
4
votes
0
answers
163
views
Variational Quantum Eigensolver (VQE) by scipy minimize in cirq does not work
I tried to make a cirq program calculating an eigenvalue of the observable by VQE. Inspired by the qulacs VQE tutorial, I defined a cost function from the expectation value of the observable with ...
1
vote
0
answers
77
views
How to create a 3-D state (array) of qubits in qiskit or cirq etc?
I want a 3-D cube-like array for state of qubits, on which I want further to implement different sets of rotations, etc, for cryptographic means. You can create a 2D grid qubit in cirq with ...
1
vote
1
answer
242
views
If Statement OpenQasm 2.0
in the documentation for OpenQasm 2.0 it says one can use an if statement like so:
if(c_reg==int) Quantum Operation.
However, I would like to execute the following: ...
2
votes
3
answers
329
views
Controlled NOT gate which flips target when at least one of the control qubits is |1>
I would like to have a controlled NOT gate which flips my target qubit when at least one of the control qubits is |1>.
I would like to be able to do this for arbitrary n. For a system with 2 ...
9
votes
1
answer
2k
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.
1
vote
1
answer
76
views
Classical control of an entire sub-circuit in cirq
I would like to evolve a quantum state through an entire sub-circuit in my circuit based on classical control. I am aware of the current state of classical control in cirq (https://quantumai.google/...
1
vote
0
answers
33
views
Is there a way to find the computational resources required to perform a simulation of n- qubits in Cirq similar to qsim?
I’m trying to model basic spin chains in 1D using VQE (ideal circuit) with cirq and qsim. The models have between 10-20 sites and varying interactions (nearest neighbour, next to nearest neighbour etc)...
1
vote
0
answers
40
views
How to Find a circuit that evolves from one density matrix to another(qiskit or cirq)
given two density matrices, dmBefore and dmAfter, I want to generate(find) a circuit in Qiskit or Cirq that starting initaliazed with dmBefore ends with dmAfter after it's execution. Is it possible?.
...
3
votes
1
answer
88
views
Cirq seems to output 0 instead of |2> with qutrits
I am experimenting a bit with qutrits on Cirq and came across a problem: my output is 0 when it should be |2>.
I defined my qutrit as follows:
...
0
votes
1
answer
209
views
AttributeError: module 'cirq_google' has no attribute 'Foxtail'
I have installed cirq in my anaconda environment by using the command:
pip install cirq
When I ran the code below to print the ...
1
vote
1
answer
217
views
Resolving AWS-Braket - ValidationException: An error occurred (ValidationException) when calling the CreateQuantumTask operation
I have a quantum circuit for the Markovian Reservoir Engineering[MRE] Model, written in cirq (frontend) and trying to run it on Ionq hardware, using qbraid credits. This is all being done on qbraid ...
0
votes
0
answers
187
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 ...
1
vote
1
answer
346
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?
2
votes
1
answer
200
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
22
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
104
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 ...
2
votes
0
answers
41
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
0
answers
79
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
127
views
how to flatten a cirq.Circuit with CircuitOperation
I have a cirq.Circuit that uses a CircuitOperation, something like:
...
1
vote
0
answers
105
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.
...
3
votes
1
answer
563
views
Cirq: n-qubit GHZ state
I am trying to write $n$ party GHZ state but at the end of the day, it seems like bi partite state. I am missing a detail. Here is my code
...
1
vote
1
answer
267
views
Producing $|ghz\rangle\langle ghz|$ State in Cirq
I could manage to produce 3 qubit ghz state in Cirq. But I don't know how I can produce $|GHZ\rangle\langle GHZ|$ in Cirq
Here is my code for 3 qubit ghz state
Can you help me please for improving my ...
1
vote
0
answers
35
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 ...
1
vote
0
answers
113
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
174
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^\...
2
votes
1
answer
121
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 ...