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
2answers
147 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
2answers
36 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
61 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
29 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
57 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
1answer
358 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 ...
2
votes
1answer
62 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
60 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
1answer
43 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
1answer
101 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....
3
votes
2answers
70 views

How do you represent one-quibit rotations in two registers as its own 4x4 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
39 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
66 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 ...
1
vote
2answers
66 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 ...
3
votes
1answer
69 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
128 views

Normalization of the quantum state in Cirq

My understanding, for instance from this youtube video, is the following: Assuming a state $\psi = \alpha |0\rangle + \beta |1\rangle$, where $\alpha$ and $\beta$ can be complex. I believe any state ...
5
votes
3answers
103 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
1answer
101 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
1answer
42 views

Cirq - Measure Density Matrix Function Getting First Element

Hello I am using measure density matrix function like that: ...
1
vote
0answers
68 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 ...
4
votes
3answers
3k views

Overview of Cirq, qiskit, q#, ibmq(circuit board), other [closed]

What is the difference between these frameworks or languages? What are the pros and cons of each of these? Do you know any similar framework/platform/language that gives some more advantages?
1
vote
1answer
89 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: ...
0
votes
1answer
52 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 ...
0
votes
1answer
24 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: ...
1
vote
1answer
44 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
62 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 ...
2
votes
2answers
101 views

How to cite cirq in a scientific article?

What would be the best/prefered bibtex entry for citing cirq ? Is this ok ? ...
2
votes
0answers
79 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
147 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
vote
2answers
102 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 ...
1
vote
1answer
51 views

Reordering commuting gates in cirq to reduce circuit depth?

The main functionality for ordering gates in a cirq circuit that I'm aware of is using the predefined insert strategies of cirq.Circuit.insert(). As far as I see, ...
-1
votes
1answer
37 views

Create this state using CIRQ Coding language [closed]

I needed help with CIRQ coding as I'm quite new to Quantum Computing. I read the tutorials on CIRQ but don't really understand it. I'd be very thankful if someone could help. A program to create the ...
0
votes
0answers
71 views

Deutsch-Jozsa algorithm: an oracle implementation

I would like to implement the Deutsch-Jozsa algorithm myself using cirq. However, I faced the problem of the implementation of the oracle. I endeavored to apply the Deutsch-Jozsa algorithm for $n+1$-...
0
votes
1answer
49 views

What is the analysis of the Bell Inequality protocol in Cirq's 'examples'?

This question is taken from https://github.com/quantumlib/Cirq/issues/3032. The "standard" protocol measures Alice's and Bob's qubits in different bases, while the one in Cirq measures in ...
1
vote
1answer
100 views

Visualizing custom gates in Cirq

I'm trying to visualize a custom gate in Cirq. I have through this page, which briefly mentions how to create custom gates in Cirq. However, I'm getting errors when trying to visualize it. My current ...
1
vote
1answer
53 views

Applying a gate to all line qubits without explicitly listing them in Cirq

Say we have a custom gate CG, defined by a unitary matrix U, and line qubits qubits in Cirq. ...
1
vote
1answer
54 views

Can not build circuit unitary for a three-qubit gate in Cirq

I am trying to implement a three-qubit gate in an eight-qubit circuit. The method I use is the same by which I create my two-qubit gates with no issues. I produce the unitary of the gate and then ...
0
votes
1answer
48 views

How to build a controlled two-qubit gate?

I have a two-qubit gate with below unitary: ...
1
vote
0answers
51 views

Adding Quantum State Tomography Step in Cirq HHL Algorithm Implementation

Over the past month, I have been learning about the HHL algorithm and am interested in extending the implementation provided here (https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py) to ...
0
votes
1answer
72 views

How to assign values to the symbols in a parametrized Cirq circuit without running it?

Is there a way to use a ParamResolver or Sweep to assign values to the symbols in a parameterized Cirq circuit without running it? For example, something like: ...
1
vote
1answer
309 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.
4
votes
3answers
727 views

How do I create my own unitary matrices that I can apply to a circuit in Cirq?

I am trying to simulate Deutsch's algorithm, and I need to apply the oracle function matrix to my circuit.
1
vote
0answers
29 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 ...
1
vote
2answers
171 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$...
0
votes
1answer
97 views

Implementing U2-Gates on Cirq

I am interested in using the QASM2Cirq methods to make this gate: u2(0, np.pi, q[0]). How can I build that object using Cirq rather than QASM string value passed onto cirq.
0
votes
1answer
290 views

VQE for Beginners : Using Tutorial and Cirq

I have been following this tutorial: https://dkopczyk.quantee.co.uk/vqe/ I am using Cirq to try to teach myself VQE, replicate their results, and also try to understand more about ansatz for ...
0
votes
1answer
45 views

Placement of quantum circuits

I have a question concerning the placement of quantum circuits on Google devices. Consider the following code: ...
2
votes
2answers
245 views

GridQubit in Cirq vs LineQubit

It's perhaps a very silly question, but in what ways is it advantageous to use GridQubit vs LineQubits to develop quantum circuits? Specially to develop ansatz ? Are GridQubits Cirq's way of ...