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
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-...
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. ...
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
102 views

Bit Flip, Separable state and Several Question about Cirq

1)I want to use noise model for my state and bit_flip is not defined on cirq. ...
2 votes
0 answers
128 views

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

...
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 ...
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, ...
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?
2 votes
1 answer
76 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 ...
2 votes
1 answer
194 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 ...
1 vote
0 answers
36 views

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

I have a code that essentially looks like this ...
2 votes
1 answer
870 views

Cirq: easiest way to compute qubit Hamiltonian expectation value with number of shots

I was wondering what was the easiest way to take a qubit Hamiltonian, and get an expectation value estimated with a certain number of shots over a parameterized quantum circuit (or ansatz) with Cirq.
5 votes
2 answers
663 views

N-Toffoli on Cirq

I am looking for guidance in more generally how to developed n-bit gates in Cirq. I am working on a QNN paper and I need to develop a n-controlled gate to be able to measure the cost function of the ...
1 vote
1 answer
113 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 ...
1 vote
1 answer
381 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 ...
7 votes
3 answers
282 views

How to learn parameters in a quantum circuit, given an interference pattern?

Using cirq, I have the following quantum circuit, with three parameters: phi, alpha and beta: ...
0 votes
1 answer
155 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 ...
1 vote
3 answers
2k 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 ...
1 vote
1 answer
90 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 ...
2 votes
0 answers
80 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 ...
5 votes
0 answers
1k 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 ...
1 vote
1 answer
121 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 ...
1 vote
0 answers
92 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 ...
2 votes
1 answer
58 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 ...
2 votes
1 answer
264 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 ...
9 votes
2 answers
3k views

Is Qiskit more popular than cirq? Why?

It seems like most people are using Qiskit, what's the difference?
0 votes
1 answer
62 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&...
2 votes
1 answer
120 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 ...
3 votes
2 answers
167 views

How do you represent one-qubit rotations in two registers as a $4\times 4$ unitary matrix?

Let's say you have a circuit that performs a Z-rotation in the first register, and a Y-rotation in second register. How can we express this "moment" in terms of a 4x4 matrix, i.e. a two-...
5 votes
1 answer
408 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?
1 vote
0 answers
99 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 ...
4 votes
1 answer
329 views

How to implement NM Algorithm for Variational Quantum Eigensolver?

First of all: thanks for reading again. I appreciate the feedback I have gotten from this community the past weeks as I started to feel ready to ask questions about quantum computing topics. I am ...
1 vote
0 answers
97 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 ...
1 vote
1 answer
202 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 ...
0 votes
1 answer
116 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 ...
3 votes
1 answer
170 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: ...
1 vote
1 answer
217 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 ...
1 vote
1 answer
299 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 ...
0 votes
1 answer
107 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\...
2 votes
0 answers
87 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. ...
2 votes
1 answer
313 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 ...
2 votes
2 answers
733 views

Can I run Cirq on IBMQ?

Google's quantum computer is not yet available for the public. Is it possible to run Cirq on IBM's quantum computers, instead of Qiskit? And if so, how can I do it? Thank you!
1 vote
2 answers
107 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 ...
1 vote
1 answer
141 views

What is a good program to practice using a quantum algorithm? Should I use Cirq or Qiskit?

I am starting to learn about Quantum Computers and Quantum Algorithms. I also started reading about Qiskit and Cirq. I really like learning about them and hopefully I can be a Software Engineer with ...
2 votes
1 answer
93 views

Cirq: Result of rotating qubit measurements never come [0 1] or [1 0 ], always come as [0,0] or [1,1]

I am creating a 2 qubit entangled state: ...
3 votes
1 answer
656 views

In Simon's algorithm, is there a general method to define an oracle given a certain periodicity?

I have to implement Simon's algorithm in Cirq. I have problems determining the oracle $f(x)$ defined such that $f(x)=f(x\oplus a)$ from a certain value of $a$. Given a random $a$, is there a general ...
-1 votes
1 answer
87 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. ...
2 votes
1 answer
540 views

Cirq.simulate expectation value of a Hamiltonian

I want to simulate the final state of an ansatz in cirq using simulate. Now I want to calculate the expectation value of a Hamiltonian. How do I do this? I can only find simulator.run examples in cirq....
4 votes
1 answer
53 views

Access and set_state during quantum computation simulation in cirq

The documentation for Cirq mentions the possibility to step through a circuit's moments, and access the exact wavefunction via step.state_vector(), and edit set it ...
1 vote
1 answer
286 views

Does Cirq support GPU acceleration?

I'm wondering if Cirq does (or plans to) support GPU acceleration of matrix operations, including density matrix simulations. I would like to speed up training and evaluations of variational circuits ...