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.

180 questions
4
votes
1 answer

Estimate run time of Cirq circuit on forthcoming Google quantum computer

Calling cirq.Simulator().run(..) on your circuit to get an idea of how it'd behave if you were to run on Google's (apparently) forthcoming real hardware is fine and dandy. Is there a way to estimate how long it would take? Apologies if this is not…
P.Windridge
  • 141
  • 2
4
votes
3 answers

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.
Jack Ceroni
  • 990
  • 6
  • 16
2
votes
0 answers

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 materials to teach the basics of quantum computing and…
2
votes
1 answer

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 got the following results. If I implement the…
2
votes
1 answer

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 gate of single qubit on each qubit and another…
sailx
  • 345
  • 1
  • 7
2
votes
1 answer

How to cite cirq in a scientific article?

What would be the best/prefered bibtex entry for citing cirq ? Is this ok ? @article{cirq, title={Cirq, a python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits}, …
1
vote
2 answers

How to measure a qubit and depending on measurement outcome act with a gate (cirq)

Is there a way on cirq that I can make a measurement on a qubit, and depending on the outcome of that measurement act with another gate on that qubit. So, I want to measure a qubit (in the computational basis) and then apply a gate (say the Y gate)…
Q.Ask
  • 195
  • 6
1
vote
1 answer

How can I define two distinct sets of qubits? (Cirq)

I am trying to familiarise myself with Cirq, and I came across something I don't know how to code. I would like to define two sets of qubits as follows: say the number of qubits in set 1 and 2 are both 3, then I would like my qubits in set 1 to…
Q.Ask
  • 195
  • 6
1
vote
0 answers

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

I have a code that essentially looks like this # Density matrix simulator sim = cirq.DensityMatrixSimulator( split_untangled_states=True ) # Simulate result = sim.simulate( circuit, resolver, initial_state=rho, …
Turbotanten
  • 566
  • 2
  • 14
1
vote
1 answer

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 introduce it to the _unitary_(self) method. I did the…
Amin
  • 47
  • 4
1
vote
1 answer

Cirq: creating a new device with custom coupling topology?

Cirq has two in-built realizations of quantum hardware, which are realized as GridQubit() and LineQubit() classes (naming convention is slightly disturbing:). GridQubit device mimics connectivity of Google's quantum chips (Bristlecone, Sycamore) and…
0
votes
1 answer

Is there a function that returns the probability of measuring a particular state in Cirq?

It is possible to use cirq.simulate and then the final_state keyword to get the final wavefunction of the circuit, however, the circuit that I am trying to simulate is very large, and the simulation seems to take a long time. Thus, I was wondering…
Jack Ceroni
  • 990
  • 6
  • 16
0
votes
1 answer

AttributeError: module 'cirq' has no attribute 'google'

I have just installed Qiskit, Qutip, and Cirq in my Anaconda Enviornment. When I tried to run the test program: import cirq from cirq import * print(cirq.google.Foxtail) # should print: # (0, 0)───(0, 1)───(0, 2)───(0, 3)───(0, 4)───(0, 5)───(0,…
0
votes
1 answer

How to build a controlled two-qubit gate?

I have a two-qubit gate with below unitary: def _unitary_(self): st = np.sin(self.theta) ct = np.cos(self.theta) ei = np.exp(1j*self.phi) emi = np.exp(-1j*self.phi) return np.array([ [1., …
Amin
  • 47
  • 4
0
votes
1 answer

Placement of quantum circuits

I have a question concerning the placement of quantum circuits on Google devices. Consider the following code: import cirq q = [cirq.LineQubit(x) for x in range(5)] circuit = cirq.Circuit(cirq.CNOT.on(q[0],q[3]),…