|
|||||||||
| 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.Vect
|
+--edu.buffalo.fs7.mathlib.Braket
Class representing a mathematical bra or ket object as introduced by the Dirac notation. The basis chosen for this object is the canonical z-axis basis.
It is derived from the class Vect and is the most important object for quantum computations.
The components of the braket are not created before they are actually needed in a computation.
Complex.times_(Complex).,
BinaryOp| Field Summary | |
protected boolean |
bra
holds whether the braket is a bra or a ket. |
int |
n
holds the number of qubits. |
| Fields inherited from class edu.buffalo.fs7.mathlib.Vect |
data, dimension, transpose |
| Fields inherited from class edu.buffalo.fs7.mathlib.MathObject |
mathlib |
| Constructor Summary | |
Braket(int n)
constructs an empty ket vector with n qubits and dimension 2^n. |
|
Braket(int state,
int n)
constructs a basis ket. |
|
Braket(MathObject o)
clone constructor |
|
| Method Summary | |
java.lang.Object |
clone()
clone method |
boolean |
equals(MathObject o)
equality predicate. |
static java.lang.String |
getBasisString(int basisState,
int n,
boolean bra)
static method to obtain the string representation of a basis braket. |
boolean |
isBra()
|
static Braket |
parseBraket(java.lang.String str)
parses a braket object from a given string. |
static Braket |
parseBraket(Vect v)
creates a braket object from a Vect object. |
java.lang.String |
toParseableString()
returns a parsable string representation of the braket. |
java.lang.String |
toString()
This method expands the braket in its basis states. |
java.lang.String |
toString(int length)
This method expands the braket in its basis states. |
void |
transpose()
transposes the braket. bra -> ket", ket -> bra". |
| Methods inherited from class edu.buffalo.fs7.mathlib.Vect |
conjugate, getElement, negative, parseVector |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public int n
protected boolean bra
| Constructor Detail |
public Braket(MathObject o)
Vect.Vect(MathObject)public Braket(int n)
n - number of qubits
public Braket(int state,
int n)
state - 0<= state < 2^nn - number of qubits| Method Detail |
public java.lang.Object clone()
clone in class Vectedu.buffalo.fs7.mathlib.VectVect.Vect(MathObject)public boolean isBra()
public static Braket parseBraket(Vect v)
throws java.lang.IllegalArgumentException
v - a vect object
public static Braket parseBraket(java.lang.String str)
throws java.lang.NumberFormatException,
java.lang.IllegalArgumentException
str - string to parsepublic void transpose()
transpose in class VectVect.conjugate()public boolean equals(MathObject o)
equals in class Vect
public static java.lang.String getBasisString(int basisState,
int n,
boolean bra)
basisState - the number of the basisState (0 <= basisState < 2^n)n - the number of qubits (the length of the binary representation)bra - determines whether the state is given as bra or kettoString()public java.lang.String toString()
toString in class VecttoString(int),
getBasisString(int,int,boolean)public java.lang.String toString(int length)
length - length of the string after which it is truncatedtoString()public java.lang.String toParseableString()
toParseableString in class Vectedu.buffalo.fs7.mathlib.Vect
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||