2022 Developer Survey is open! Take survey.

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
0 answers
27 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
75 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
47 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
40 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
2 votes
1 answer
53 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
  • 21
1 vote
0 answers
37 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
1 vote
0 answers
46 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
41 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
79 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
  • 123
1 vote
0 answers
25 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
61 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
185 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
  • 119
0 votes
1 answer
85 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
156 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
59 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
57 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
117 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
79 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
163 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
57 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
101 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
316 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
67 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
86 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
135 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
125 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
1 vote
1 answer
56 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
117 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
167 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
477 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
76 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
73 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
176 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
99 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
  • 406
1 vote
1 answer
107 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 ...
user avatar
  • 11
3 votes
1 answer
99 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 ...
user avatar
  • 406
2 votes
1 answer
82 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: ...
user avatar
  • 406
2 votes
0 answers
101 views

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

...
user avatar
3 votes
1 answer
393 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 ...
user avatar
3 votes
2 answers
132 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-...
user avatar
  • 1,626
4 votes
1 answer
46 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 ...
user avatar
1 vote
1 answer
191 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 ...
user avatar
3 votes
1 answer
147 views

Does TensorFlow Quantum tfq.convert_to_tensor work on custom gates?

I'm trying to use Cirq with TensorFlow Quantum to simulate a variational quantum classifier. There's a tutorial on the TFQ website on building a quantum neural network to classify a simplified version ...
user avatar
  • 1,626
1 vote
2 answers
123 views

Why is the Measurement Result Always 1? (expected to find uniformly random measurement)

I created a $|0\rangle$ state then applied $H$ gate to get $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$ and then I meausred my state. But I always found 1. I expected to find 0 and 1 uniformly random ...
user avatar
  • 406
2 votes
1 answer
349 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....
user avatar
7 votes
3 answers
218 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: ...
user avatar
1 vote
1 answer
58 views

Cirq - Measure Density Matrix Function Getting First Element

Hello I am using measure density matrix function like that: ...
user avatar
  • 406
1 vote
0 answers
175 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 ...
user avatar
1 vote
1 answer
167 views

Cirq-Measuring a State with Rotation Matrix

I have this state: $$p |\text{GHZ}\rangle \langle \text{GHZ}| + (1-p)\rho$$ And after creating this state I have this code lines: ...
user avatar
  • 406