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
1answer
44 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 ...
0
votes
3answers
76 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
1answer
42 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
0answers
42 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 ...
1
vote
1answer
101 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
0answers
64 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
1answer
84 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 ...
6
votes
2answers
670 views

Is Qiskit more popular than cirq? Why?

It seems like most people are using Qiskit, what's the difference?
0
votes
1answer
47 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
1answer
77 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 ...
4
votes
1answer
237 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
0answers
40 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 ...
0
votes
1answer
62 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 ...
1
vote
1answer
97 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 ...
3
votes
1answer
93 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
1answer
51 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 ...
1
vote
1answer
67 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
1answer
82 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 ...
3
votes
0answers
189 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 ...
0
votes
1answer
53 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
0answers
60 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. ...
1
vote
1answer
83 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 ...
0
votes
0answers
53 views

Random Circuit Generation in Cirq

I am trying to improve an optimization method as describe in this paper: enter link description here For that I need to create many random equivalent circuits. In my experiment I have 6 beam splitters ...
1
vote
2answers
73 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
1answer
88 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 ...
0
votes
0answers
43 views

Interpret graph nodes as qubits

I am trying implement MAXCUT using QAOA. I have a graph with edges defined by an edges set. My edges set looks a bit like this: ...
3
votes
1answer
81 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 ...
2
votes
1answer
67 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
1answer
177 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 ...
3
votes
2answers
111 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-...
4
votes
1answer
45 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
1answer
123 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 ...
3
votes
1answer
113 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 ...
1
vote
2answers
95 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 ...
2
votes
1answer
251 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....
7
votes
3answers
136 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: ...
1
vote
1answer
49 views

Cirq - Measure Density Matrix Function Getting First Element

Hello I am using measure density matrix function like that: ...
1
vote
0answers
124 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 ...
1
vote
1answer
115 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: ...
1
vote
1answer
54 views

Bit Flip, Seperable state and Several Question about Cirq

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

Multiple Bipartite Entangled State in Cirq

I am trying to create this state: rho = = q . rho_{1,2} + r . rho_{2,3} + s . rho{1,3} + (1-q-r-s) . rho_separable And I wrote this code: ...
0
votes
1answer
140 views

Cirq: Creating an arbitrary gate for an arbitrary number of qubits

How do I create an arbitrary unitary gate for an arbitrary number of qubits in Cirq? Note: A solution for creating a single qubit gate is answered by Thomas W from this post. How do I create my own ...
0
votes
1answer
146 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
2answers
348 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!
0
votes
1answer
84 views

Output a Cirq gate as a Numpy array?

How do I output a Cirq gate as a Numpy array? For example, I would like to print a Pauli X gate cirq.X as ...
2
votes
0answers
102 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 ...
0
votes
1answer
224 views

XX and YY and ZZ Hamiltonians in vqe

I'm trying to implement a vqe in cirq and I have sort of a brain knot. I have a 4 qubit chain with periodic boundary condition. So in fact a 2x2 qubit grid. Now 2 of them each are coupled. How do I ...
-1
votes
1answer
59 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. ...
1
vote
2answers
119 views

Running Google Cirq example code from their webpage -- where do I find information about PROCESSOR_ID?

I'm just ttrying to run the simple example code in Google's Cirq startup page: https://cirq.readthedocs.io/en/stable/google/engine.html I think I have the access authorized correctly via Google's ...