The MASM Forum
General => The Soap Box => Topic started by: LiaoMi on February 07, 2018, 11:34:50 PM

(http://s.4pda.to/ZYQ8lwN5SCKw6uJBQHOez0nc6v8GttLMQz2t9B.jpg)
https://arxiv.org/pdf/1707.03429 (https://arxiv.org/pdf/1707.03429)
This document describes a quantum assembly language (QASM) called OpenQASM that is used to implement experiments with low depth quantum circuits. OpenQASM represents universal physical circuits over the CNOT plus SU(2) basis with straightline code that includes measurement, reset, fast feedback, and gate subroutines. The simple text language can be written by hand or by higher level tools and may be executed on the IBM Q Experience.
Gate and operation specification for quantum circuits  https://github.com/QISKit/openqasm
qft.qasm: Quantum Fourier transform on 4 qubits.
// quantum Fourier transform
OPENQASM 2.0;
include "qelib1.inc";
qreg q[4];
creg c[4];
x q[0];
x q[2];
barrier q;
h q[0];
cu1(pi/2) q[1],q[0];
h q[1];
cu1(pi/4) q[2],q[0];
cu1(pi/2) q[2],q[1];
h q[2];
cu1(pi/8) q[3],q[0];
cu1(pi/4) q[3],q[1];
cu1(pi/2) q[3],q[2];
h q[3];
measure q > c;
https://en.wikipedia.org/wiki/OpenQASM (https://en.wikipedia.org/wiki/OpenQASM)
Open Quantum Assembly Language (OpenQASM; pronounced "open kazm") is an intermediate representation for quantum instructions. The language was first described in a paper published in July 2017, and source code was released as part of IBM's Quantum Information Software Kit (QISKit) for use with their Quantum Experience cloud quantum computing platform. The language has similar qualities to traditional hardware description languages such as Verilog.
libquantum is a C library for the simulation of quantum mechanics, with a special focus laid to quantum computing. It started as a pure quantum computer simulator, but support for general quantum simulation has been recently added.
Quantum computing  Quantum virtual machine (libquantum) http://www.libquantum.de/ (http://www.libquantum.de/)
Based on the principles of quantum mechanics, libquantum provides an implementation of a quantum register. Basic operations for register manipulation such as the Hadamard gate or the ControlledNOT gate are available through an easytouse interface. Measurements can be performed on either single qubits or the whole quantum register.
Features
Simulation of arbitrary quantum algorithms is possible
High performance and low memory consumption
Optional timeevolution using fourthorder RungeKutta or exact diagonalization, including optimizations for sparse Hamiltonians
Decoherence support for realistic quantum computation
Interface for quantum error correction (QEC)
Supports the density operator formalism
Implementations of Shor's factoring algorithm and Grover's search algorithm are included
libquantum is available as Free Software under the terms of the GNU General Public License (GPL), version 3. See the file COPYING for further details.
Be ready for the future :biggrin:

I have some trouble with my flux.asm code, a serious bug appeared when I ran it,my clock shows me I am back in the good old 1955... :badgrin:

and now the matrix battery is coming:
https://www3.nhk.or.jp/nhkworld/en/vod/scienceview/2015184/ (https://www3.nhk.or.jp/nhkworld/en/vod/scienceview/2015184/)
you find Qasm is to advanced, start with the basics, like in QBASIC :P :badgrin:

@LiaoMi
The IBM Quantum Computer does not understand the cul instructions. :(
(http://atelierweb.com/a/quantum.jpg)
PS: On a second attempt I could make it run after dropping some gate U1. But I don't understand how it works, I guess I need to spend time reading the instructions.

@LiaoMi
The IBM Quantum Computer does not understand the cul instructions. :(
(http://atelierweb.com/a/quantum.jpg)
PS: On a second attempt I could make it run after dropping some gate U1. But I don't understand how it works, I guess I need to spend time reading the instructions.
Hi,
Controlled (cX cY cZ) gates
The matrix representing the controlled U is
(https://wikimedia.org/api/rest_v1/media/math/render/svg/1f6eeb5d020f23932c9e4d9ac4b7b48b78da9985)
When U is one of the Pauli matrices, σx, σy, or σz, the respective terms "controlledX", "controlledY", or "controlledZ" are sometimes used.
The same thing for me :biggrin: maybe execution depends on the version of the backend, with logic "Controlled NOT gate" is not so difficult, but visualization of the simulation, it reminds me of matrix calculations or simulations of simd instructions.
Backend: ibmqx2 (5 Qubits)  active for me and
// Implementation of Deutsch algorithm with two qubits for f(x)=x
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5];
creg c[5];
x q[4];
h q[3];
h q[4];
cx q[3],q[4];
h q[3];
measure q[3] > c[3];
https://github.com/QISKit/openqasm/blob/master/examples/ibmqx2/Deutsch_Algorithm.qasm works for me :P Who wants to try, the simulator can be found here  https://quantumexperience.ng.bluemix.net/qx/qasm (https://quantumexperience.ng.bluemix.net/qx/qasm)
Information about gates https://en.wikipedia.org/wiki/Quantum_gate (https://en.wikipedia.org/wiki/Quantum_gate)
https://en.wikipedia.org/wiki/Qubit (https://en.wikipedia.org/wiki/Qubit)
Some gates are not supported in this topology or not defined, probably there is a dependency on the topology set.
Open Quantum Assembly Language  https://github.com/QISKit/openqasm/blob/master/spec/qasm2.rst (https://github.com/QISKit/openqasm/blob/master/spec/qasm2.rst)
Information about the different backends on the IBM Q experience  https://github.com/QISKit/ibmqxbackendinformation (https://github.com/QISKit/ibmqxbackendinformation)

When we select to run on the real computer, not the simulator, the job enters in a queue and take ages for the results to be delivered, although the message says will be the next one to run.
Only today I received the result from my yesterday's run.
I will try again when there are more qubits, 5 is too short for anything interesting. :biggrin: