Questions tagged [programming]

For questions relating writing code to be executed on a quantum computer. For questions using or about a specific programming language, consider using also a more specific tag.

Filter by
Sorted by
Tagged with
1
vote
1answer
74 views

Can quantum computing help to recover a lost private key?

I lost a private key for an ethereum wallet. While seeking for information I found out that only quantum computers can decrypt a public key. Is this really a possibility? Thanks in advance.
2
votes
1answer
73 views

How to implement Cx mod N unitary

The following links provides circuts for $a\in\{2,7,8,11,13\}$ and $N=15$: https://qiskit.org/textbook/ch-algorithms/shor.html#3.-Qiskit-Implementation https://arxiv.org/abs/1202.6614v3. I am ...
1
vote
1answer
70 views

Why after transpiling a Qiskit circuit we obtain a different result?

I am trying to obtain the correct circuit transpiled for the ibmq_london device, as I want to know what the real gates applied in the quantum computer are. I am implementing the QFT circuit for 5 ...
0
votes
1answer
62 views

How the simulator work?

Recently I focused on how to simulate in classical computer, and I found Qiskit offers qasmsimulator and statevector simulator. ...
1
vote
1answer
21 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
29 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
55 views

What extra functionality is available to an IBM Q Network member over a regular IBM Q Experience user

I've been trying to figure out the extra functionality available to IBM Q Network members that are not available to normal ...
0
votes
1answer
33 views

How can I represent mixed states in Q#?

I have a mixed state with a density matrices corresponding to $\rho=\sum_0^{2^n-1}p_i|i\rangle\langle i|$. How would i represent this in Q#? How would I go about applying Unitary Operations $U$ on ...
0
votes
1answer
38 views

Question About How Qiskit Reset Gate Affects Other Entangled Qubits

I am trying to understand how the reset gate in Qiskit affects qubits its entangled with. Consider the following circuit with qubits $q_0$ and $q_1$: Where circuit240 takes $|0\rangle$ to $a|0\rangle ...
4
votes
3answers
78 views

Can you transform a quantum program into an arrangement of slits?

Is it possible (in theory) to convert any problem that can be solved on a quantum computer into an arrangement of slits carved into a piece of metal foil, and then to run the program by shining light ...
3
votes
1answer
53 views

Expectation value of an operator error: Composition is not defined over operators of different dimensions,

I am trying to calculate the expectation value of a customized operator on two similar but differently constructed states $\phi = \phi_2 =\frac{1}{\sqrt{2}}\left( |001⟩ + |011⟩\right)$ which consist ...
1
vote
1answer
31 views

Microsoft Q#: “Namespace declarations can only occur at a global scope” error

I am having challenges with Microsoft Q#. I wrote this short code and it says it can only occur at a global scope. How do I fix this error? Any ideas? Thank you
1
vote
1answer
50 views

A question about how does the single qubit gate simulated in simulator?

I have found the procedure of simulation process as this picture : Image reference. So in the low-level compilers, all single-qubit gates are approximated by the universal gate set (CNOT, H, T, S). ...
1
vote
2answers
48 views

Algorithm to find stabilizer states

I'm working on a project in which I have to find stabilizer states based on a few criteria, the main one being that it has to have a certain amount of coherence, I'm using the following equation to ...
0
votes
1answer
26 views
0
votes
1answer
38 views

Why is import qiskit failing to import in Anaconda Jupyter Notebook

I recently downloaded Anaconda(Python 3.7) on Windows 10 and I am having difficulty importing Qiskit in jupyter notebook. I tried the following line: import qiskit ...
1
vote
2answers
41 views

Why is the number of solutions given in Qiskit textbook(Quantum Counting Algorithm) as N-M instead of M?

I'm following the Qiskit textbook for Quantum Counting. We have assumed $M$ as the number of states containing solutions throughout the algorithm but at last, $N-M$ has been taken as the solution. ...
-1
votes
1answer
24 views

Find orthogonal state for random 7 qubit state

I have a system that generates a random 7 qubit state and I need a method to always find the orthogonal state. I'm currently using python and qutip for this, representing this 7 qubit state by a 128-...
0
votes
1answer
30 views

How can I print out a state vector of a specific wire?

Suppose we start from 2 wires (q0 and q1) and through some quantum gates, suppose we measure q1 wire only. As we measure the q1 wire, the state vector of this quantum state would be determined ...
1
vote
2answers
62 views

If two reduced density matrices are equal, does that mean that the two subsystems are the same?

Suppose we have a $3$-qubit system at time $t_0$ in the state $$\vert{\psi(t_0)}\rangle= \vert{q_0}\rangle \otimes \vert{q_1} \rangle \otimes \vert{q_2}\rangle. $$ We want to check if, for instance, ...
1
vote
1answer
21 views

Error code: 3458

I ran my qsvm code on the quantum computer and I'm facing the following error: ...
0
votes
3answers
99 views
1
vote
1answer
28 views

Qiskit textbook install error

I'm trying to install the qiskit_textbook repository (https://github.com/qiskit-community/qiskit-textbook) and I keep getting this error ...
1
vote
1answer
24 views

What is the shortest sequence of decomposition a given single-qubit unitary gate

Given a single-qubit unitary matrix, can we find the shortest sequence of Clifford + T gates that correspond to that unitary? According to Fast and efficient exact synthesis of single qubit unitaries ...
5
votes
2answers
96 views

Representation of rotation operators $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ about arbitrary axis for $3$ qubits

I was wondering in how to interpret and represent the operator $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ for a 3 qubit system in a circuit using qiskit. I was thinking I could just perform an ...
1
vote
2answers
61 views

How can I create a basis state of $n$ qubits in Q#?

I would like to create a set of basis qubits. For example if I have $n=2$ I should get 4 states being 01 10 11 00. Generalized for $2^n$. Is there a way to do this in Q#?
2
votes
1answer
48 views

Is it possible to create a gate in Q# that is dictated by a matrix?

When observing the Hadamard gate it is simply a transformation matrix. I am wondering if there is functionality to hard code an arbitrary transformation matrix and its family members up till $m \times ...
1
vote
0answers
40 views

How do you decide which rotations to use in a Quantum Machine Learning model?

I am trying to design a model using Q#'s machine learning library that takes in two features (real numbers from 0 to 1) and classifies as 0 or 1. So how do I decide which Rotations and what seeds to ...
2
votes
0answers
31 views

How do I optimize HHL algorithm in Qiskit?

How do I optimize HHL algorithm in Qiskit? I tried to follow this tutorial on HHL in Qiskit. My project requires solving a very specific type of linear equations $Ax=b$ like the one below. ...
1
vote
1answer
25 views

How to append an Instruction to a QuantumCircuit with variable length of QuantumRegisters as qargs?

I think it is a bug but I'm not really sure. Basically, what I'm trying to do is the following: I have an Oracle Instruction which I want to append to my QuantumCircuit, looks as follows: ...
0
votes
1answer
25 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: ...
-2
votes
0answers
25 views

aqt qasm simulator error: Max retries exceeded with url: /marmot/sim/

Running code that is fine with the backend = qasm_simulator but gives a connection timeout error below when using the ...
2
votes
1answer
39 views

Graph coloring - Q# -

I am checking Q# - Graph coloring for (C in 0 .. (1 <<< N) - 1) { InitializeColor(C, register); Can you help me explain ...
2
votes
2answers
94 views

Q# Error: No namespace with the name “Microsoft.Quantum.MachineLearning” exists

I'm having trouble getting the namespace Microsoft.Quantum.MachineLearning. Here is an example Q# code: ...
0
votes
1answer
35 views

Is there a way to grab probablities of my qubits in Q#?

https://qiskit.org/textbook/ch-algorithms/grover.html I am looking for a visual, or just probabilities like the ones given in the link.Is this possible on Q#?
5
votes
3answers
125 views

Compiling a classical function to a quantum circuit in practice

It can be shown that any classical function $f$ can be implemented by a quantum circuit $Q_f$, so that $$ \sum_{x}|x,0^k\rangle \xrightarrow{\mathit{Q_f}} \sum_{x}|x,f(x)\rangle $$ where $f$ has $k$ ...
1
vote
0answers
33 views

Attempting to use the QuantumMachineLearning Repositry with vscode and now import qsharp is reporting 'Fail'

I have been trying to follow the Quantum machine learning kata by using vscode and jupyter notebook, I was using the wrong version of iqsharp so changed it in the code like so: As can be seen the ...
2
votes
2answers
50 views

A question about a real programmable quantum computer

In the theory of universal quantum gates,I have known a common universal gate set is the Clifford + T gate set, which is composed of the CNOT, H, S and T gates. Then there is a concept called "...
0
votes
1answer
29 views

dotnet iqsharp install gives error “FileNotFoundError: The system cannot find the path specified”

installing Q# version g --version 0.1.2.3 in jupyter. but this command line dotnet iqsharp install responds system cannot find path specified . what should i do . i have also installed vscode ...
0
votes
1answer
49 views

How do I encode integers into BigEndian in Q#?

https://export.arxiv.org/ftp/arxiv/papers/1908/1908.07943.pdf page 4 point 1 states that we use the bits of an integer as a basis in our space. I understand that BigEndian grabs our largest bit and ...
4
votes
1answer
156 views

qsharp.reload() throws error in python

I'm trying to add the Q# machine learning library to my program by ...
1
vote
0answers
126 views

Q# Quantum.MachineLearning namespace doesn't exist error

I am trying to use the HalfMoon Classifier in Quantum Machine Learning Sample Examples. I am trying to run it locally. However I keep getting this error. ...
2
votes
1answer
65 views

How to apply a gate to a LittleEndian in Q#

I have been given a LittleEndian register. I want to know the following things: How many bits there are in the LittleEndian? How to convert the LittleEndian into a Qubit[] Array. How to access ...
1
vote
0answers
55 views

Example of Simple phase Change Using 2 Qubits [closed]

I need to manipulate phases in 2 qubits. I will eventually create 34 distinct phase sets to map to an alphabet I built. I see https://github.com/oreilly-qc/oreilly-qc.github.io/blob/master/samples/...
0
votes
1answer
45 views

How can I install the 'ibmq_qasm_simulator' backend?

I'm having trouble running the following cell: The system told me "The 'ibmq_qasm_simulator' backend is not installed in your system." I'm so confused. Is there a way I can install this backend in my ...
3
votes
2answers
47 views

Is there a “parameterized initialization” that I can apply to a QuantumRegister to re-use a circuit?

I'm working on a QuantumCircuit which measures the fidelity of one point (my "test vector") and two other points (my "data set", containing of states phi_1 and <...
2
votes
1answer
49 views

a question about quantum gate decomposition on simulator or emulator

I have read a paper about "approximated decomposition" of a unitary single gate (Solovay-Kitaev algorithm) which told us a any unitary single gate can be decomposed into {Hadamard, Phase} with any ...
0
votes
1answer
52 views

How to decompose unitary quantum gate in current simulator or emulator?

I have a question about how to decompose a unitary quantum gate in a currently existing simulator or emulator. I have read some papers about SK algorithm and other algorithms which aim to decompose ...
2
votes
1answer
83 views

Unable to use qiskit_textbook module

When I tried to use the Qiskit textbook module, it threw the following error: Command was: ...
1
vote
1answer
49 views

Trotterizing a Pauli sum in Qiskit

In Qiskit, how do I construct a circuit corresponding to the Trotter expansion of a Pauli sum $A+B+C+\ldots$ given as a WightedPauliSum object? $$ \operatorname{e}^...

1
2 3 4 5
8