|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--edu.buffalo.fs7.mathlib.MathObject
|
+--edu.buffalo.fs7.mathlib.Argument
|
+--edu.buffalo.fs7.mathlib.Gate
Class representing a quantum gate. Since it is not feasable to save gates as unitary matrices and usually a gate only affects a small number of qubits, it is useful to introduce a more abstract description of a model. The syntax is the following:
{-:-:1:NOT:-} - this would represent a controlled NOT gate operating on the 4th of 5 qubits and beeing controlled by the 3rd. The NOT entry can be replaced by any other unitary (2x2) matrix.
The object specifying the matrix can be a variable, a MathMap producing a matrix or a matrix definition.For higher dimensional gates the notation is as follows:
{1:-:U:U} this represents a controlled U gate operating on the 3rd and 4th qubit of 4 qubits, it is controlled by the first qubit.
BinaryOp,
Braket| Field Summary | |
protected boolean |
conjugate
|
java.lang.String |
gate_descr
holds the description of the gate in string form |
int |
matrixDimension
holds the matrix dimension |
java.lang.String |
matrixName
holds the matrix name |
int |
n
holds the number of qubits |
protected boolean |
negative
|
protected boolean |
transpose
|
| Fields inherited from class edu.buffalo.fs7.mathlib.MathObject |
mathlib |
| Constructor Summary | |
Gate(int n)
here n is the number of qubits ==> the dimension of the corresponding matrix is 2^n. |
|
Gate(int n,
int matrixPos,
java.lang.String matrixName)
creates a gate for n qubits having a 2x2 matrix matrixName operating at position matrixPos |
|
Gate(MathObject o)
clone constructor |
|
Gate(java.lang.String gate_descr,
java.lang.String matrixName)
creates a gate for a given gate_descr string and matrix name |
|
| Method Summary | |
java.lang.Object |
clone()
clone method |
void |
conjugate()
complex conjugates the gate |
boolean |
equals(MathObject m1)
equality predicate |
Matrix |
getMatrix()
returns the matrix applied to the subspace |
void |
negative()
negates the gate |
static Gate |
parseGate(java.lang.String str)
parses a gate from a given string. |
java.lang.String |
toString()
return string representation of the gate |
void |
transpose()
transposes the gate |
| Methods inherited from class edu.buffalo.fs7.mathlib.MathObject |
toParseableString |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public java.lang.String gate_descr
public int matrixDimension
public java.lang.String matrixName
protected boolean transpose
protected boolean conjugate
protected boolean negative
public int n
| Constructor Detail |
public Gate(int n)
public Gate(MathObject o)
public Gate(java.lang.String gate_descr,
java.lang.String matrixName)
public Gate(int n,
int matrixPos,
java.lang.String matrixName)
| Method Detail |
public java.lang.Object clone()
clone in class MathObject
public static Gate parseGate(java.lang.String str)
throws java.lang.IllegalArgumentException
public void transpose()
public void conjugate()
public void negative()
public Matrix getMatrix()
public boolean equals(MathObject m1)
equals in class Argumentpublic java.lang.String toString()
toString in class MathObjectedu.buffalo.fs7.mathlib.MathObjectMathObject.toParseableString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||