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.

46 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
0 answers
174 views

Quantum Optimization via Quantum Label Classification in Quantum Circuits

I have been reading Farhi and Neven's paper on quantum neural networks on quantum circuits. I also found an example - albeit not ideal as pointed out by a couple of users - thank you - in here. ...
Enrique Segura's user avatar
3 votes
0 answers
196 views

Measuring the expected energy of a quantum circuit

I implemented the following circuit: I am interested in measuring the expected energy of the circuit. I am using Cirq. I am wondering what are the next steps. Sorry if the question seems very basic, ...
Enrique Segura's user avatar
2 votes
1 answer
126 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 ...
Inm's user avatar
  • 383
2 votes
1 answer
109 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 ...
pcr's user avatar
  • 121
2 votes
0 answers
95 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 \...
Ananth_Rao's user avatar
2 votes
0 answers
205 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 ...
CatQubit's user avatar
2 votes
0 answers
92 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 ...
Cuhrazatee's user avatar
2 votes
0 answers
103 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. ...
user14860's user avatar
2 votes
0 answers
132 views

How to convert a dataset of different values in [0,1000] to quantum data for training a model using Tensorflow QuantumHaving?

...
Alexander Makalovij's user avatar
2 votes
0 answers
124 views

Wrong Expectation value when implementing a VQE for the Heisenberg Hamiltonian

I tried to implement an extended Heisenberg-Hamiltonian as an extra exercise further than my homework. My Hamiltonian is the following: $H = \sum_{NN} \sigma_x\sigma_x + \sigma_z\sigma_z$ I try to ...
Schrödinger314's user avatar
2 votes
0 answers
126 views

A bug during CIRQ installation

I had the following problem with an installation of the Cirq. When I typed python -m pip install cirq, I got the following line: "Cannot uninstall 'sympy'. It is ...
Elijah's user avatar
  • 21
2 votes
2 answers
544 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 ...
mavzolej's user avatar
  • 1,810
2 votes
0 answers
156 views

Cirq: Any interesting introductory level example using 2D grid of qubits?

I have already asked this question on reddit.com/r/QuantumComputing. Cirq supports to create quantum circuits composed by qubits having 2D grid structure. We have been preparing educational ...
Abuzer Yakaryilmaz's user avatar
2 votes
0 answers
117 views

Would this quantum algorithm implementation work?

I am trying to implement the order finding algorithm on Cirq finding the minimal positive $r$ for coprime $x$ and $N$ satisfying the equation $x^r \ = \ 1$(mod$ \ N$). In my case, I have set $x \ = \ ...
Jack Ceroni's user avatar
1 vote
0 answers
19 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)...
lake_apricot's user avatar
1 vote
0 answers
24 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?. ...
Luis ALberto's user avatar
1 vote
1 answer
83 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 ...
Luis ALberto's user avatar
1 vote
0 answers
16 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 ...
Zarathustra's user avatar
1 vote
0 answers
26 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: ...
Shuhul Handoo's user avatar
1 vote
0 answers
34 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 ...
Qubii's user avatar
  • 151
1 vote
0 answers
58 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 ...
Jessica John Britto's user avatar
1 vote
0 answers
107 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^\...
Eenoku's user avatar
  • 223
1 vote
0 answers
27 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 ...
CADENTIC's user avatar
1 vote
0 answers
97 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 ...
Markivaira's user avatar
1 vote
0 answers
43 views

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

I have a code that essentially looks like this ...
Turbotanten's user avatar
1 vote
0 answers
100 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 ...
Lakshit Dabas's user avatar
1 vote
0 answers
111 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 ...
Schrödinger314's user avatar
1 vote
0 answers
296 views

Implementing the HHL algorithm with negative eigenvalues (Cirq)

How do I implement the HHL with negative eigenvalues? This paper (https://arxiv.org/abs/1803.01486) says that: what if $\lambda<0$? This problem actually does not hard to solve, since we can ...
user3886914's user avatar
1 vote
0 answers
104 views

Adding Quantum State Tomography Step to HHL Algorithm (Cirq)

Over the past month, I have been learning about the HHL algorithm and am interested in extending the Cirq implementation to include the quantum state tomography step to extract the amplitudes or ...
quantum_novice's user avatar
1 vote
0 answers
42 views

Can We Currently Import Quantum Datasets (Datasets Containing Quantum Data) Onto NISQ-era Quantum Computers?

I'm still investigating the TFQ whitepaper. In one section of the paper, the authors say this with respect to Quantum Datasets In general, [a quantum dataset] might come from a given black-box ...
Darien Schettler's user avatar
1 vote
0 answers
106 views

Ising Model, Graphs, and Cirq

How would you explain, pictorially and without too much overhead, an interaction between the qubits on this model using Cirq? I am interested in trying to map accurately the ansatz on Cirq to a ...
Enrique Segura's user avatar
1 vote
2 answers
394 views

How to calculate the probabilities of observing quantum states using the "expectation_from_wavefunction" in cirq (and why)

I am currently simulating some quantum circuits, and want to calculate the probabilities of observing each individual state. I am able to use Cirq for this, and calculate it using $P_{00} = |\alpha|^2$...
Thomas Hubregtsen's user avatar
0 votes
0 answers
44 views

How to best implement this algorithm?

I am trying to design an algorithm to find a solution to a certain problem. I have N qubits which encode the problem (let's call them the problem qubits) and one check_qubit (which is flipped to |1>...
Q.Ask's user avatar
  • 195
0 votes
0 answers
277 views

Grover's algorithm for max cut problem - Implementation in cirq

I am using the Grover's algorithm for max cut problem using an oracle for the graph described below to check whether it admits a valid 2-coloring. Here are the edges: (0,3),(0,4),(1,3),(1,4),(2,3),(2,...
Hamideh's user avatar
  • 259
0 votes
1 answer
122 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, the oracle function marks the state |111>. How can I change the Oracle function to mark |010>? ...
Hamideh's user avatar
  • 259
0 votes
0 answers
40 views

Understanding the meaning of [2, 2] for input_register and target_register in a custom Cirq gate

I'm learning a custom gate implementation from google Cirq official tutorial of shor algorithm(https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/experiments/shor.ipynb#scrollTo=...
Tonight223's user avatar
0 votes
0 answers
33 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 ...
Ohad's user avatar
  • 1,654
0 votes
0 answers
137 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 ...
Rayhan's user avatar
  • 123
0 votes
0 answers
32 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 ...
lm1909's user avatar
  • 93
0 votes
1 answer
104 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: ...
sailx's user avatar
  • 345
0 votes
0 answers
53 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, ...
Elijah Connor's user avatar
0 votes
0 answers
57 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. ...
Qubii's user avatar
  • 151
0 votes
0 answers
16 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 ...
Inm's user avatar
  • 383
0 votes
0 answers
30 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: ...
MeltedStatementRecognizing's user avatar
0 votes
0 answers
69 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 ...
Q.Ask's user avatar
  • 195
-1 votes
1 answer
92 views

Implementing Cirq Coding Gates

Can someone please help me making these gates on CIRQ programming: Decrement Gate (-1) Splitter Gate (If possible) I was having trouble implementing these and was not sure if it's possible either. ...
Upatel2's user avatar
  • 33