This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Base class for each gate | |
class Gate: | |
def __init__(self, name: str, qubits): | |
self._name = name | |
if isinstance(qubits, list): | |
self._qubits = qubits | |
else: | |
self._qubits = [qubits] | |
def qasm(self) -> str: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ====================================================================== | |
// Copyright CERFACS (February 2018) | |
// Contributor: Adrien Suau (suau@cerfacs.fr) | |
// | |
// This software is governed by the CeCILL-B license under French law and | |
// abiding by the rules of distribution of free software. You can use, | |
// modify and/or redistribute the software under the terms of the | |
// CeCILL-B license as circulated by CEA, CNRS and INRIA at the following | |
// URL "http://www.cecill.info". | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ====================================================================== | |
# Copyright CERFACS (February 2018) | |
# Contributor: Adrien Suau (suau@cerfacs.fr) | |
# | |
# This software is governed by the CeCILL-B license under French law and | |
# abiding by the rules of distribution of free software. You can use, | |
# modify and/or redistribute the software under the terms of the | |
# CeCILL-B license as circulated by CEA, CNRS and INRIA at the following | |
# URL "http://www.cecill.info". | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quantum circuit to illustrate issue #1 | |
// of https://github.com/nelimeee/qasm2error | |
OPENQASM 2.0; | |
include "qelib1.inc"; | |
// A quantum gate that applies 10 times non-simplifiable | |
// gates to the given qubit | |
gate g10 q { | |
y q; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Qconfig | |
import qiskit | |
import numpy as np | |
qiskit.register(Qconfig.APItoken, Qconfig.config["url"]) | |
ibmqx4 = qiskit.get_backend('ibmqx4') | |
qubit_number = ibmqx4.configuration['n_qubits'] | |
shot_number = 8192 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.linalg as la | |
A = .25 * np.array([[15, 9, 5, -3], | |
[9, 15, 3, -5], | |
[5, 3, 15, -9], | |
[-3, -5, -9, 15]]) | |
t0 = 2 * np.pi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "~/venv/papis/lib64/python3.6/site-packages/prompt_toolkit/application/application.py", line 652, in _run_async2 | |
result = yield f | |
File "~/venv/papis/lib64/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 86, in step_next | |
new_f = coroutine.send(None) | |
File "~/venv/papis/lib64/python3.6/site-packages/prompt_toolkit/application/application.py", line 595, in _run_async | |
self._redraw() | |
File "~/venv/papis/lib64/python3.6/site-packages/prompt_toolkit/application/application.py", line 444, in _redraw | |
self.renderer.render(self, self.layout) | |
File "~/venv/papis/lib64/python3.6/site-packages/prompt_toolkit/renderer.py", line 590, in render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ====================================================================== | |
# Copyright CERFACS (November 2018) | |
# Contributor: Adrien Suau (suau@cerfacs.fr) | |
# | |
# This software is governed by the CeCILL-B license under French law and | |
# abiding by the rules of distribution of free software. You can use, | |
# modify and/or redistribute the software under the terms of the | |
# CeCILL-B license as circulated by CEA, CNRS and INRIA at the following | |
# URL "http://www.cecill.info". | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ====================================================================== | |
# Copyright CERFACS (November 2018) | |
# Contributor: Adrien Suau (suau@cerfacs.fr) | |
# | |
# This software is governed by the CeCILL-B license under French law and | |
# abiding by the rules of distribution of free software. You can use, | |
# modify and/or redistribute the software under the terms of the | |
# CeCILL-B license as circulated by CEA, CNRS and INRIA at the following | |
# URL "http://www.cecill.info". | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
from qiskit.mapper._compiling import two_qubit_kak | |
A = numpy.array([[15, 9, 5, -3], [9, 15, 3, -5], [5, 3, 15, -9], [-3, -5, -9, 15]], dtype=numpy.complex) / 4 | |
two_qubit_kak(A) |
OlderNewer