|
|||||||||
| 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.Operator
|
+--edu.buffalo.fs7.mathlib.BinaryOp
This class represents a binary operator of the form '+', '-', '*' or '/'. It has all the specialized routines for different arguments build in. For fast quantum simulations it has static functions specialized in applying gates to qubits given as ket vectors. In contrast to the normal operations, the specialized gate methods do not copy the argument, but the result is written into the argument object.
The binary operator is identified by the Tokenizer class and executed by the Parse class.
Tokenizer,
Parse,
Braket| Field Summary | |
protected char |
data
identifies the operator |
| Fields inherited from class edu.buffalo.fs7.mathlib.MathObject |
mathlib |
| Constructor Summary | |
BinaryOp(char c)
creates a binary operator according to the char given. |
|
| Method Summary | |
MathObject |
apply(Complex s1,
Complex s2)
Complex-Complex operations (+,-,*,/) |
MathObject |
apply(Complex s1,
Matrix m2)
complex-matrix operations (*) |
MathObject |
apply(Complex s1,
Vect v2)
Complex-Vector operations (*) |
MathObject |
apply(Gate g1,
Vect v2)
gate-vector operations (*) |
MathObject |
apply(MathObject s1,
MathObject s2)
this is the generic apply method. |
MathObject |
apply(Matrix m1,
Complex s2)
matrix-complex operations (*,/) |
MathObject |
apply(Matrix m1,
Matrix m2)
matrix-matrix operations (+,-,*,#) |
MathObject |
apply(Matrix m1,
Vect v2)
matrix-vector operations (*) |
MathObject |
apply(Vect v1,
Vect v2)
Vector-Vector operation (+,-,*,#) |
static void |
implicitApply(Gate g1,
Braket v2,
Matrix error)
this method dispatches gate operation to specialized methods. |
static void |
implicitApply2x2(Gate g1,
Braket v2,
Matrix error)
this method applies a general unitary 2x2 matrix onto the corresponding subspace as specified by the Gate argument to the ket given by v2. |
static void |
implicitApply2x2a(Gate g1,
Braket v2)
this method is a optimized version to apply a unitary 2x2 matrix with zeros of the counter diagonal onto the corresponding subspace as specified by the Gate argument to the ket given by v2. |
static void |
implicitApply2x2b(Gate g1,
Braket v2)
this method is a optimized version to apply a unitary 2x2 matrix with zero diagonal onto the corresponding subspace as specified by the Gate argument to the ket given by v2. |
static void |
implicitApplyNxN(Gate g1,
Braket v2)
this method applies a general unitary NxN matrix onto the corresponding subspace as specified by the Gate argument to the ket given by v2. |
static void |
implicitApplyNxNo(Gate g1,
Braket v2)
this method is an optimized method for applying a general unitary NxN matrix onto the corresponding subspace as specified by the Gate argument to the ket given by v2. |
static int |
pow(int base,
int exp)
integer power funtion base^exp |
boolean |
precedence(BinaryOp b)
decides whether the current operator precedes the operator given as a parameter. |
java.lang.String |
toString()
returns the string representation of the binary operator |
| Methods inherited from class edu.buffalo.fs7.mathlib.MathObject |
clone, toParseableString |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected char data
| Constructor Detail |
public BinaryOp(char c)
| Method Detail |
public MathObject apply(MathObject s1,
MathObject s2)
s1 - left hand side arguments2 - right hand side argument
public MathObject apply(Complex s1,
Complex s2)
public MathObject apply(Complex s1,
Vect v2)
public MathObject apply(Vect v1,
Vect v2)
public MathObject apply(Matrix m1,
Matrix m2)
public MathObject apply(Complex s1,
Matrix m2)
public MathObject apply(Matrix m1,
Complex s2)
public MathObject apply(Matrix m1,
Vect v2)
public static int pow(int base,
int exp)
base - exp -
public MathObject apply(Gate g1,
Vect v2)
public static void implicitApply(Gate g1,
Braket v2,
Matrix error)
g1 - gate to be appliedv2 - ket vectorerror - 2x2 matrix or nullMeasurement.partialMeasurement(Braket, int),
implicitApply2x2(Gate, Braket, Matrix),
implicitApply2x2a(Gate, Braket),
implicitApply2x2b(Gate, Braket),
implicitApplyNxN(Gate, Braket),
implicitApplyNxNo(Gate, Braket)
public static void implicitApply2x2(Gate g1,
Braket v2,
Matrix error)
implicitApply2x2a(Gate, Braket)
public static void implicitApply2x2a(Gate g1,
Braket v2)
implicitApply2x2(Gate, Braket, Matrix),
implicitApply2x2b(Gate, Braket)
public static void implicitApply2x2b(Gate g1,
Braket v2)
implicitApply2x2(Gate, Braket, Matrix),
implicitApply2x2a(Gate, Braket)
public static void implicitApplyNxN(Gate g1,
Braket v2)
implicitApply2x2(Gate, Braket, Matrix),
implicitApplyNxNo(Gate, Braket)
public static void implicitApplyNxNo(Gate g1,
Braket v2)
implicitApply2x2(Gate, Braket, Matrix),
implicitApplyNxN(Gate, Braket)public boolean precedence(BinaryOp b)
b - a binary operator to compare withpublic 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 | ||||||||