Title: | Quantum Game Theory Simulator |
---|---|
Description: | General purpose toolbox for simulating quantum versions of game theoretic models (Flitney and Abbott 2002) <arXiv:quant-ph/0208069>. Quantum (Nielsen and Chuang 2010, ISBN:978-1-107-00217-3) versions of models that have been handled are: Penny Flip Game (David A. Meyer 1998) <arXiv:quant-ph/9804010>, Prisoner's Dilemma (J. Orlin Grabbe 2005) <arXiv:quant-ph/0506219>, Two Person Duel (Flitney and Abbott 2004) <arXiv:quant-ph/0305058>, Battle of the Sexes (Nawaz and Toor 2004) <arXiv:quant-ph/0110096>, Hawk and Dove Game (Nawaz and Toor 2010) <arXiv:quant-ph/0108075>, Newcomb's Paradox (Piotrowski and Sladkowski 2002) <arXiv:quant-ph/0202074> and Monty Hall Problem (Flitney and Abbott 2002) <arXiv:quant-ph/0109035>. |
Authors: | Indranil Ghosh |
Maintainer: | Indranil Ghosh <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.2 |
Built: | 2025-02-15 05:24:58 UTC |
Source: | https://github.com/indrag49/qgametheory |
The function builds one of the four Bell states, according to the input qubits
Bell(qubit1, qubit2)
Bell(qubit1, qubit2)
qubit1 |
1st input qubit |
qubit2 |
2nd input qubit |
One of the Bell states as a vector depending on the input qubits.
https://en.wikipedia.org/wiki/Bell_state
https://books.google.co.in/books?id=66TgFp2YqrAC&pg=PA25&redir_esc=y
init() Bell(Q$Q0, Q$Q0) Bell(Q$Q0, Q$Q1) Bell(Q$Q1, Q$Q0) Bell(Q$Q1, Q$Q1)
init() Bell(Q$Q0, Q$Q0) Bell(Q$Q0, Q$Q1) Bell(Q$Q1, Q$Q0) Bell(Q$Q1, Q$Q1)
This function operates the CNOT gate on a conformable input matrix/vector
CNOT(n)
CNOT(n)
n |
A vector/matrix |
A matrix or a vector after performing the CNOT gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() CNOT(Q$I4) CNOT(Q$Q11)
init() CNOT(Q$I4) CNOT(Q$Q11)
This function counts the number of columns of a vector or a matrix
col_count(M)
col_count(M)
M |
A vector/matrix |
An integer that gives the number of columns in a vector or a matrix.
init() col_count(Q$Q11) col_count(Q$lambda4) col_count(Q$I2)
init() col_count(Q$Q11) col_count(Q$lambda4) col_count(Q$I2)
This function operates the Fredkin gate on a conformable input matrix/vector
Fredkin(n)
Fredkin(n)
n |
A vector/matrix |
A matrix or a vector after performing the Fredkin gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() Fredkin(Q$I8) Fredkin(Q$Q110)
init() Fredkin(Q$I8) Fredkin(Q$Q110)
This function operates the Hadamard gate on a conformable input matrix/vector
Hadamard(n)
Hadamard(n)
n |
A vector/matrix |
A matrix or a vector after performing the Hadamard operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() Hadamard(Q$Q0) Hadamard(Q$I2) Hadamard(Hadamard(Q$Q1))
init() Hadamard(Q$Q0) Hadamard(Q$I2) Hadamard(Hadamard(Q$Q1))
This function applies the IDSDS algorithm to result in the equilibrium strategies based on the rationaility of the players. The input parameters are equal dimensional payoff matrices for the first and the second players.
IDSDS(P1, P2)
IDSDS(P1, P2)
P1 |
Payoff matrix to Alice |
P2 |
Payoff matrix to Bob |
A list consisting of the equilibrium strategies based on the rationality of the players by application of the IDSDS algorithm on P1
and P2
.
https://arxiv.org/abs/1512.06808
https://en.wikipedia.org/wiki/Strategic_dominance
init() Alice <- matrix(c(8, 0, 3, 3, 2, 4, 2, 1, 3), ncol=3, byrow=TRUE) Bob <- matrix(c(6, 9, 8, 2, 1, 3, 8, 5, 1), ncol=3, byrow=TRUE) IDSDS(Alice, Bob)
init() Alice <- matrix(c(8, 0, 3, 3, 2, 4, 2, 1, 3), ncol=3, byrow=TRUE) Bob <- matrix(c(6, 9, 8, 2, 1, 3, 8, 5, 1), ncol=3, byrow=TRUE) IDSDS(Alice, Bob)
Builds the parameters in the required environment after initialization
init()
init()
No return value, generates the required variables/parameters.
https://arxiv.org/pdf/Quant-ph/0512125.pdf
https://arxiv.org/pdf/0910.4222.pdf
https://arxiv.org/pdf/Quant-ph/9703032.pdf
https://en.wikipedia.org/wiki/Quantum_computing
https://en.wikipedia.org/wiki/Qubit
https://en.wikipedia.org/wiki/Qutrit
https://en.wikipedia.org/wiki/Clebsch%E2%80%93Gordan_coefficients_for_SU(3)
init() Q$Q110 Q$Qt12 Q$Q_minus Q$lambda4
init() Q$Q110 Q$Qt12 Q$Q_minus Q$lambda4
Builds the parameters in the global environment after initialization
initialize_()
initialize_()
https://arxiv.org/pdf/quant-ph/0512125.pdf
https://arxiv.org/pdf/0910.4222.pdf
https://arxiv.org/pdf/quant-ph/9703032.pdf
https://en.wikipedia.org/wiki/Quantum_computing
https://en.wikipedia.org/wiki/Qubit
https://en.wikipedia.org/wiki/Qutrit
https://en.wikipedia.org/wiki/Clebsch%E2%80%93Gordan_coefficients_for_SU(3)
initialize_() Q110 Qt12 Q_minus lambda4
initialize_() Q110 Qt12 Q_minus lambda4
This function computes the Levi-Civita symbol depending on the permutations of the three inputs, lying in 0 to 2
levi_civita(i, j, k)
levi_civita(i, j, k)
i |
an integer 0, 1 or 2 |
j |
an integer 0, 1 or 2 |
k |
an integer 0, 1 or 2 |
0, 1 or -1 after computing the Levi-Civita symbol depending on the permutations of the three inputs 0, 1 and 2
https://en.wikipedia.org/wiki/Levi-Civita_symbol
init() levi_civita(0, 2, 1) levi_civita(1, 2, 0) levi_civita(1, 2, 1)
init() levi_civita(0, 2, 1) levi_civita(1, 2, 0) levi_civita(1, 2, 1)
This function finds out the Nash equilibria of the 2-D payoff matrix for the players. The input parameters are equal dimensional payoff matrices for the first and the second players.
NASH(P1, P2)
NASH(P1, P2)
P1 |
Payoff matrix to Alice |
P2 |
Payoff matrix to Bob |
The cell positons of the Nash equilibrium/equilibria as a dataframe from the payoff matrices of the players.
https://arxiv.org/abs/1512.06808
https://en.wikipedia.org/wiki/Nash_equilibrium
init() Alice <- matrix(c(4, 3, 2, 4, 4, 2, 1, 0, 3, 5, 3, 5, 2, 3, 1, 3), ncol=4, byrow=TRUE) Bob <- matrix(c(0, 2, 3, 8, 2, 1, 2, 2, 6, 5, 1, 0, 3, 2, 2, 3), ncol=4, byrow=TRUE) NASH(Alice, Bob)
init() Alice <- matrix(c(4, 3, 2, 4, 4, 2, 1, 0, 3, 5, 3, 5, 2, 3, 1, 3), ncol=4, byrow=TRUE) Bob <- matrix(c(0, 2, 3, 8, 2, 1, 2, 2, 6, 5, 1, 0, 3, 2, 2, 3), ncol=4, byrow=TRUE) NASH(Alice, Bob)
This function generates the payoff matrix for the Quantum Battle of Sexes game for all the four combinations of p
and q
. moves
is a list of two possible strategies for each of the players and alpha, beta, gamma
are the payoffs for the players corresponding to the choices available to them with the chain of inequalities, alpha>beta>gamma
.
PayoffMatrix_QBOS(moves, alpha, beta, gamma)
PayoffMatrix_QBOS(moves, alpha, beta, gamma)
moves |
a list of matrices |
alpha |
a number |
beta |
a number |
gamma |
a number |
The payoff matrices for the two players as two elements of a list.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/abs/quant-ph/0110096
init() moves <- list(Q$I2, sigmaX(Q$I2)) PayoffMatrix_QBOS(moves, 5, 3, 1)
init() moves <- list(Q$I2, sigmaX(Q$I2)) PayoffMatrix_QBOS(moves, 5, 3, 1)
This function generates the payoff matrix for the Quantum Hawk and Dove game for all the four combinations of p
and q
. moves
is a list of two possible strategies for each of the players and v, j, D
are the value of resource, cost of injury and cost of displaying respectively.
PayoffMatrix_QHawkDove(moves, v, j, D)
PayoffMatrix_QHawkDove(moves, v, j, D)
moves |
a list of matrices |
v |
a number |
j |
a number |
D |
a number |
The payoff matrices for the two players as two elements of a list.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0108075.pdf
init() moves <- list(Q$I2, sigmaX(Q$I2)) PayoffMatrix_QHawkDove(moves, 50, -100, -10)
init() moves <- list(Q$I2, sigmaX(Q$I2)) PayoffMatrix_QHawkDove(moves, 50, -100, -10)
This function generates the payoff matrix for the Quantum Prisoner's Dilemma game . moves
is a list of the possible strategies for each of the players and w, x, y, z
are the payoffs for the players corresponding to the choices available to them with the chain of inequalities, z>w>x>y
.
This function also plots the probability distribution plots of the qubits for all the possible combinations of the strategies of the players.
PayoffMatrix_QPD(moves, w, x, y, z)
PayoffMatrix_QPD(moves, w, x, y, z)
moves |
a list of matrices |
w |
a number |
x |
a number |
y |
a number |
z |
a number |
The payoff matrices for the two players as two elements of a list.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0004076.pdf
init() moves <- list(Q$I2, sigmaX(Q$I2), Hadamard(Q$I2), sigmaZ(Q$I2)) PayoffMatrix_QPD(moves, 3, 1, 0, 5)
init() moves <- list(Q$I2, sigmaX(Q$I2), Hadamard(Q$I2), sigmaZ(Q$I2)) PayoffMatrix_QPD(moves, 3, 1, 0, 5)
This function operates the Phase gate on a conformable input matrix/vector
Phase(n)
Phase(n)
n |
a vector/matrix |
A matrix or a vector after performing the Phase gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() Phase(Q$I2) Phase(Q$Q_plus)
init() Phase(Q$I2) Phase(Q$Q_plus)
This function operates the hermitian transpose of the Phase gate on a conformable input matrix/vector
PhaseDagger(n)
PhaseDagger(n)
n |
a vector/matrix |
A matrix or a vector after performing the operation of the hermitian transpose of the Phase gate on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() Conj(t(Phase(Q$I2)))==PhaseDagger(Q$I2) PhaseDagger(Q$Q_plus)
init() Conj(t(Phase(Q$I2)))==PhaseDagger(Q$I2) PhaseDagger(Q$Q_plus)
This function returns the expected payoffs to Alice and Bob with respect to the probabilities p
and q
. p+q
should equal 1 and moves
is a list of two possible strategies for each of the players and alpha, beta, gamma
are the payoffs for the players corresponding to the choices available to them with the chain of inequalities, alpha>beta>gamma
.
QBOS(p, q, moves, alpha, beta, gamma)
QBOS(p, q, moves, alpha, beta, gamma)
p |
a real number between 0 and 1 including the end points |
q |
a real number between 0 and 1 including the end points |
moves |
alist of matrices |
alpha |
a number |
beta |
a number |
gamma |
a number |
A vector consisting of the Payoffs to Alice and Bob as its two elements depending on the inputs.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/abs/quant-ph/0110096
init() moves <- list(Q$I2, sigmaX(Q$I2)) QBOS(0, 1, moves, 5, 3, 1) QBOS(1, 1, moves, 5, 3, 1) QBOS(0.5, 0.5, moves, 5, 3, 1)
init() moves <- list(Q$I2, sigmaX(Q$I2)) QBOS(0, 1, moves, 5, 3, 1) QBOS(1, 1, moves, 5, 3, 1) QBOS(0.5, 0.5, moves, 5, 3, 1)
This function returns the expected payoff to Alice for three possible cases for the Quantum Duel game:
The game is continued for n
rounds and none of the players shoots at the air.
The game is continued for 2 rounds and Alice shoots at the air in her second round.
The game is continued for 2 rounds and Bob shoots at the air in her second round.
Psi
is the initial state of the quantum game, n
is the number of rounds, a
is the probability of Alice missing the target, b
is the probability of Bob missing the target, and alpha1, alpha2, beta1, beta2
are arbitrary phase factors that lie in -pi to pi that control the outcome of a poorly performing player.
QDuels_Alice_payoffs(Psi, n, a, b, alpha1, alpha2, beta1, beta2)
QDuels_Alice_payoffs(Psi, n, a, b, alpha1, alpha2, beta1, beta2)
Psi |
a vector representing the initial quantum state |
n |
an integer |
a |
a number |
b |
a number |
alpha1 |
a number |
alpha2 |
a number |
beta1 |
a number |
beta2 |
a number |
A list consisting of the payoff value to Alice depending on three situations of the quantum duel game: 1) The game is continued for n
rounds and none of the players shoots at the air, 2) The game is continued for 2 rounds and Alice shoots at the air in her second round and 3) The game is continued for 2 rounds and Bob shoots at the air in her second round.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0305058.pdf
init() QDuels_Alice_payoffs(Q$Q11, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7) Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Qs, Qs) QDuels_Alice_payoffs(Psi, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7)
init() QDuels_Alice_payoffs(Q$Q11, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7) Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Qs, Qs) QDuels_Alice_payoffs(Psi, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7)
This function returns the expected payoff to Bob for three possible cases for the Quantum Duel game:
The game is continued for n
rounds and none of the players shoots at the air.
The game is continued for 2 rounds and Alice shoots at the air in her second round.
The game is continued for 2 rounds and Bob shoots at the air in her second round.
Psi
is the initial state of the quantum game, n
is the number of rounds, a
is the probability of Alice missing the target, b
is the probability of Bob missing the target, and alpha1, alpha2, beta1, beta2
are arbitrary phase factors that lie in -pi to pi that control the outcome of a poorly performing player.
QDuels_Bob_payoffs(Psi, n, a, b, alpha1, alpha2, beta1, beta2)
QDuels_Bob_payoffs(Psi, n, a, b, alpha1, alpha2, beta1, beta2)
Psi |
a vector representing the initial quantum state |
n |
an integer |
a |
a number |
b |
a number |
alpha1 |
a number |
alpha2 |
a number |
beta1 |
a number |
beta2 |
a number |
A list consisting of the payoff value to Bob depending on three situations of the quantum duel game: 1) The game is continued for n
rounds and none of the players shoots at the air, 2) The game is continued for 2 rounds and Alice shoots at the air in her second round and 3) The game is continued for 2 rounds and Bob shoots at the air in her second round.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0305058.pdf
init() QDuels_Bob_payoffs(Q$Q11, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7) Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Qs, Qs) QDuels_Bob_payoffs(Psi, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7)
init() QDuels_Bob_payoffs(Q$Q11, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7) Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Qs, Qs) QDuels_Bob_payoffs(Psi, 5, 0.666666, 0.5, 0, 0, 0.2, 0.7)
This function helps us to plot Alice's and Bob's expected payoffs as functions of alpha1
and alpha2
. Psi
is the initial state of the quantum game, n
is the number of rounds, a
is the probability of Alice missing the target, b
is the probability of Bob missing the target, and
alpha1, alpha2, beta1, beta2
are arbitrary phase factors that lie in -pi to pi that control the outcome of a poorly performing player.
QDuelsPlot1(Psi, n, a, b, beta1, beta2)
QDuelsPlot1(Psi, n, a, b, beta1, beta2)
Psi |
a vector representing the initial quantum state |
n |
an integer |
a |
a number |
b |
a number |
beta1 |
a number |
beta2 |
a number |
No return value, plots Alice's and Bob's expected payoffs as functions of alpha1
and alpha2
.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0305058.pdf
init() QDuelsPlot1(Q$Q10, 2, 0.66666, 0.5, 0.2, 0.8)
init() QDuelsPlot1(Q$Q10, 2, 0.66666, 0.5, 0.2, 0.8)
This function helps us to plot Alice's and Bob's expected payoffs as functions of the number of rounds n
played in a repeated quantum duel. Psi
is the initial state of the quantum game, n
is the number of rounds, a
is the probability of Alice missing the target, b
is the probability of Bob missing the target, and
alpha1, alpha2, beta1, beta2
are arbitrary phase factors that lie in -pi to pi that control the outcome of a poorly performing player.
QDuelsPlot2(Psi, n, a, b, alpha1, alpha2, beta1, beta2)
QDuelsPlot2(Psi, n, a, b, alpha1, alpha2, beta1, beta2)
Psi |
a vector representing the initial quantum state |
n |
an integer |
a |
a number |
b |
a number |
alpha1 |
a number |
alpha2 |
a number |
beta1 |
a number |
beta2 |
a number |
No return value, plots Alice's and Bob's expected payoffs as functions of the number of rounds n
played in a repeated quantum duel.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0305058.pdf
init() QDuelsPlot2(Q$Q01, 10, 0.66666, 0.5, -pi/2, pi/4, 0.6, 0.4)
init() QDuelsPlot2(Q$Q01, 10, 0.66666, 0.5, -pi/2, pi/4, 0.6, 0.4)
This function helps us to plot the improvement in Alice's expected payoff as a function of a
and b
, if Alice chooses to fire at the air in her second shot, in a two round game. Psi
is the initial state of the quantum game, n
is the number of rounds, a
is the probability of Alice missing the target, b
is the probability of Bob missing the target, and
alpha1, alpha2, beta1, beta2
are arbitrary phase factors that lie in -pi to pi that control the outcome of a poorly performing player.
QDuelsPlot3(Psi, alpha1, alpha2)
QDuelsPlot3(Psi, alpha1, alpha2)
Psi |
a vector representing the initial quantum state |
alpha1 |
a number |
alpha2 |
a number |
No return value, plots the improvement in Alice's expected payoff as a function of a
and b
, if Alice chooses to fire at the air in her second shot, in a two round game.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0305058.pdf
init() Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Q$Q1, Qs) QDuelsPlot3(Psi, pi/3, pi/6)
init() Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Q$Q1, Qs) QDuelsPlot3(Psi, pi/3, pi/6)
This function helps us to plot the improvement in Bob's expected payoff as a function of a
and b
, if Bob chooses to fire at the air in her second shot, in a two round game. Psi
is the initial state of the quantum game, n
is the number of rounds, a
is the probability of Alice missing the target, b
is the probability of Bob missing the target, and
alpha1, alpha2, beta1, beta2
are arbitrary phase factors that lie in -pi to pi that control the outcome of a poorly performing player.
QDuelsPlot4(Psi, alpha1, alpha2)
QDuelsPlot4(Psi, alpha1, alpha2)
Psi |
a vector representing the initial quantum state |
alpha1 |
a number |
alpha2 |
a number |
No return value, plots the improvement in Bob's expected payoff as a function of a
and b
, if Bob chooses to fire at the air in her second shot, in a two round game.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0305058.pdf
init() Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Q$Q1, Qs) QDuelsPlot4(Psi, pi/3, pi/6)
init() Qs <- (Q$Q0+Q$Q1)/sqrt(2) Psi <- kronecker(Q$Q1, Qs) QDuelsPlot4(Psi, pi/3, pi/6)
This function performs Quantum Fourier Transform for a given state |y>
from the computational basis to the Fourier basis.
QFT(y)
QFT(y)
y |
an integer |
A vector representing the Quantum Fourier transformation of the state |y>
from the computational basis to the Fourier basis.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://books.google.co.in/books?id=66TgFp2YqrAC&pg=PA25&redir_esc=y
https://en.wikipedia.org/wiki/Quantum_Fourier_transform
init() QFT(5)
init() QFT(5)
This function returns the expected payoffs to Alice and Bob with respect to the probabilities p
and q
. p+q
should equal 1 and moves
is a list of two possible strategies for each of the players and v, j, D
are the value of resource, cost of injury and cost of displaying respectively.
QHawkDove(p, q, moves, v, j, D)
QHawkDove(p, q, moves, v, j, D)
p |
a real number between 0 and 1 including the end points |
q |
a real number between 0 and 1 including the end points |
moves |
a list of matrics |
v |
a number |
j |
a number |
D |
a number |
A vector consisting of the expected payoffs to Alice and Bob as its elements calculated according to the probabilities p
and q
provided as inputs.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0108075.pdf
init() moves <- list(Q$I2, sigmaX(Q$I2)) QHawkDove(0, 1, moves, 50, -100, -10) QHawkDove(0, 0, moves, 50, -100, -10)
init() moves <- list(Q$I2, sigmaX(Q$I2)) QHawkDove(0, 1, moves, 50, -100, -10) QHawkDove(0, 0, moves, 50, -100, -10)
This function performs a projective measurement of a quantum state n
, in the computational basis and plots the corresponding probability distributions of the qubits.
QMeasure(n)
QMeasure(n)
n |
a vector representing a quantum state |
No return value, plots the probability distributions of the qubits after performing a projective measurement of a quantum state n
.
https://books.google.co.in/books?id=66TgFp2YqrAC&pg=PA25&redir_esc=y
https://en.wikipedia.org/wiki/Measurement_in_quantum_mechanics
init() QMeasure(Q$Q10110)
init() QMeasure(Q$Q10110)
This function simulates the quantum version of the Monty Hall problem, by taking in Psi_in
as the initial quantum state of the game, gamma
lying in 0 to pi/2, Ahat
and Bhat
as the choice operators in SU(3) for Alice and Bob respectively as the inputs. It returns the expected payoffs to Alice and Bob after the end of the game.
QMontyHall(Psi_in, gamma, Ahat, Bhat)
QMontyHall(Psi_in, gamma, Ahat, Bhat)
Psi_in |
a vector representing the initial quantum state |
gamma |
a number between 0 and pi/2 including the end points |
Ahat |
a matrix lying in SU(3) |
Bhat |
a matrix lying in SU(3) |
A vector consisting of the expected payoffs to Alice and Bob as its elements depending on the input parameters.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0109035.pdf
init() Psi_in <- kronecker(Q$Qt0, (Q$Qt00+Q$Qt11+Q$Qt22)/sqrt(3)) QMontyHall(Psi_in, pi/4, Q$Identity3, Q$Hhat)
init() Psi_in <- kronecker(Q$Qt0, (Q$Qt00+Q$Qt11+Q$Qt22)/sqrt(3)) QMontyHall(Psi_in, pi/4, Q$Identity3, Q$Hhat)
This function simulates the quantum version of the Newcomb's Paradox by taking in the choice of the qubit |0> or |1> by the supercomputer Omega
and the probability 'probability'
with which Alice plays the spin flip operator. It returns the final state of the quantum game along with plotting the probability densities of the qubits of the final state after measurement.
QNewcomb(Omega, probability)
QNewcomb(Omega, probability)
Omega |
|0> or |1> |
probability |
a real number between 0 and 1 including the end points |
The final state of the quantum game as a vector along with plotting the probability densities of the qubits of the final state after measurement.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0202074.pdf
init() QNewcomb(Q$Q0, 0) QNewcomb(Q$Q1, 0) QNewcomb(Q$Q1, 0.7)
init() QNewcomb(Q$Q0, 0) QNewcomb(Q$Q1, 0) QNewcomb(Q$Q1, 0.7)
This function returns the expected payoffs to Alice and Bob, with the strategy moves by Alice and Bob as two of the inputs. w, x, y, z
are the payoffs to the players corresponding to the choices available to them with the chain of inequalities, z>w>x>y
.
This function also plots the probability distribution plots of the qubits for one of all the combinations of the strategies of the players.
QPD(U_Alice, U_Bob, w, x, y, z)
QPD(U_Alice, U_Bob, w, x, y, z)
U_Alice |
a matrix lying in SU(2) |
U_Bob |
a matrix lying in SU(2) |
w |
a number |
x |
a number |
y |
a number |
z |
a number |
A vector consisting of the expected payoffs to Alice and Bob as its elements according to the strategies played by Alice and Bob and also the payoff values.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/0004076.pdf
init() QPD(Hadamard(Q$I2), sigmaZ(Q$I2), 3, 1, 0, 5)
init() QPD(Hadamard(Q$I2), sigmaZ(Q$I2), 3, 1, 0, 5)
This function simulates the Quantum Penny Flip game by taking in the initial state of the game that is set by Alice and the strategies available to Alice and Bob. It returns the final state of the game along with the plot of the probability distribution of the qubits after measurement of the final state.
QPennyFlip(initial_state, strategies_Alice, strategies_Bob)
QPennyFlip(initial_state, strategies_Alice, strategies_Bob)
initial_state |
a vector representing the initial quantum state |
strategies_Alice |
a matrix lying in SU(2) |
strategies_Bob |
a matrix lying in SU(2) |
The final state of the game along with the plot of the probability distribution of the qubits after measurement of the final state by taking in the initial state of the game that is set by Alice and the strategies available to Alice and Bob as the inputs.
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://arxiv.org/pdf/quant-ph/0208069.pdf
https://arxiv.org/pdf/quant-ph/9804010.pdf
init() psi <- (u+d)/sqrt(2) S1 <- sigmaX(Q$I2) S2 <- Q$I2 H <- Hadamard(Q$I2) SA <- list(S1, S2) SB <- list(H) QPennyFlip(psi, SA,SB)
init() psi <- (u+d)/sqrt(2) S1 <- sigmaX(Q$I2) S2 <- Q$I2 H <- Hadamard(Q$I2) SA <- list(S1, S2) SB <- list(H) QPennyFlip(psi, SA,SB)
This function counts the number of rows of a vector or a matrix
row_count(M)
row_count(M)
M |
A vector/matrix |
An integer that gives the number of rows in a vector or a matrix.
init() row_count(Q$Q01) row_count(Q$lambda5) row_count(Q$Qt12)
init() row_count(Q$Q01) row_count(Q$lambda5) row_count(Q$Qt12)
This function operates the Rotation gate about the x-axis of the Bloch sphere by an angle theta
on a conformable input matrix n
.
Rx(n, theta)
Rx(n, theta)
n |
a vector/matrix |
theta |
an angle |
A vector or a matrix after operating the Rotation gate about the x-axis of the Bloch sphere, by an angle theta
, on a conformable input matrix or a vector n
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
http://www.physics.udel.edu/~msafrono/650/Lecture%204%20-%205.pdf
init() Rx(Q$Q0, pi/6)
init() Rx(Q$Q0, pi/6)
This function operates the Rotation gate about the y-axis of the Bloch sphere by an angle theta
on a conformable input matrix n
.
Ry(n, theta)
Ry(n, theta)
n |
a vector/matrix |
theta |
an angle |
A vector or a matrix after operating the Rotation gate about the y-axis of the Bloch sphere, by an angle theta
, on a conformable input matrix or a vector n
.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
http://www.physics.udel.edu/~msafrono/650/Lecture%204%20-%205.pdf
init() Ry(Q$Q1, pi/3)
init() Ry(Q$Q1, pi/3)
This function operates the Rotation gate about the z-axis of the Bloch sphere by an angle theta
on a conformable input matrix n
.
Rz(n, theta)
Rz(n, theta)
n |
a vector/matrix |
theta |
an angle |
A vector or a matrix after operating the Rotation gate about the z-axis of the Bloch sphere, by an angle theta
, on a conformable input matrix or a vector n
.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
http://www.physics.udel.edu/~msafrono/650/Lecture%204%20-%205.pdf
init() Rz(Q$Q1, pi)
init() Rz(Q$Q1, pi)
This function operates the Pauli-X gate on a conformable input matrix or a vector.
sigmaX(n)
sigmaX(n)
n |
a vector/matrix |
A matrix or a vector after performing the Pauli-X gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
http://www.physics.udel.edu/~msafrono/650/Lecture%204%20-%205.pdf
init() sigmaX(Q$I2) sigmaX(Hadamard(Q$I2)) sigmaX(Q$Q1)
init() sigmaX(Q$I2) sigmaX(Hadamard(Q$I2)) sigmaX(Q$Q1)
This function operates the Pauli-Y gate on a conformable input matrix or a vector.
sigmaY(n)
sigmaY(n)
n |
a vector/matrix |
A matrix or a vector after performing the Pauli-Y gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
http://www.physics.udel.edu/~msafrono/650/Lecture%204%20-%205.pdf
init() sigmaY(Q$I2) sigmaY(Hadamard(Q$I2)) sigmaY(Q$Q0)
init() sigmaY(Q$I2) sigmaY(Hadamard(Q$I2)) sigmaY(Q$Q0)
This function operates the Pauli-Z gate on a conformable input matrix or a vector.
sigmaZ(n)
sigmaZ(n)
n |
a vector/matrix |
A matrix or a vector after performing the Pauli-Z gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
http://www.physics.udel.edu/~msafrono/650/Lecture%204%20-%205.pdf
init() sigmaZ(Q$I2) sigmaZ(Hadamard(Q$I2)) sigmaZ(Q$Q0)
init() sigmaZ(Q$I2) sigmaZ(Hadamard(Q$I2)) sigmaZ(Q$Q0)
This function operates the SWAP gate on a conformable input matrix or a vector.
SWAP(n)
SWAP(n)
n |
a vector/matrix |
A matrix or a vector after performing the SWAP gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() SWAP(Q$I4) SWAP(Q$Q10)
init() SWAP(Q$I4) SWAP(Q$Q10)
This function operates the T gate on a conformable input matrix or a vector.
T(n)
T(n)
n |
a vector/matrix |
A matrix or a vector after performing the T gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() T(Q$I2) T(Q$Q_minus)
init() T(Q$I2) T(Q$Q_minus)
This function operates the hermitian transpose of the T gate on a conformable input matrix or a vector.
TDagger(n)
TDagger(n)
n |
a vector/matrix |
A matrix or a vector after performing the operation of the hermitian transpose of the T gate on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() TDagger(Q$I2) TDagger(Q$Q_plus)
init() TDagger(Q$I2) TDagger(Q$Q_plus)
This function operates the Toffoli gate on a conformable input matrix or a vector.
Toffoli(n)
Toffoli(n)
n |
a vector/matrix |
A matrix or a vector after performing the Toffoli gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
init() Toffoli(Q$I8) Toffoli(Q$Q010)
init() Toffoli(Q$I8) Toffoli(Q$Q010)
This function operates the Walsh-Hadamard gate on a conformable input matrix or a vector.
Walsh(n)
Walsh(n)
n |
a vector/matrix |
A matrix or a vector after performing the Walsh-Hadamard gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://en.wikipedia.org/wiki/Hadamard_transform
init() Walsh(Q$I2) Walsh(Q$Q0)
init() Walsh(Q$I2) Walsh(Q$Q0)
This function operates the Walsh-16 gate on a conformable input matrix or a vector.
Walsh16(n)
Walsh16(n)
n |
a vector/matrix |
A matrix or a vector after performing the Walsh-16 gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://en.wikipedia.org/wiki/Hadamard_transform
init() Walsh16(Q$I16) Walsh16(Q$Q1001)
init() Walsh16(Q$I16) Walsh16(Q$Q1001)
This function operates the Walsh-32 gate on a conformable input matrix or a vector.
Walsh32(n)
Walsh32(n)
n |
a vector/matrix |
A matrix or a vector after performing the Walsh-32 gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://en.wikipedia.org/wiki/Hadamard_transform
init() Walsh32(Q$I32) Walsh32(Q$Q10011)
init() Walsh32(Q$I32) Walsh32(Q$Q10011)
This function operates the Walsh-4 gate on a conformable input matrix or a vector.
Walsh4(n)
Walsh4(n)
n |
a vector/matrix |
A matrix or a vector after performing the Walsh-4 gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://en.wikipedia.org/wiki/Hadamard_transform
init() Walsh4(Q$I4) Walsh4(Q$Q10)
init() Walsh4(Q$I4) Walsh4(Q$Q10)
This function operates the Walsh-8 gate on a conformable input matrix or vector.
Walsh8(n)
Walsh8(n)
n |
a vector/matrix |
A matrix or a vector after performing the Walsh-8 gate operation on a conformable input matrix or a vector.
https://en.wikipedia.org/wiki/Quantum_logic_gate
http://www2.optics.rochester.edu/~stroud/presentations/muthukrishnan991/LogicGates.pdf
https://arxiv.org/pdf/quant-ph/0506219.pdf
https://en.wikipedia.org/wiki/Hadamard_transform
init() Walsh8(Q$I8) Walsh8(Q$Q000)
init() Walsh8(Q$I8) Walsh8(Q$Q000)