edu.buffalo.fs7.mathlib
Class Measurement

java.lang.Object
  |
  +--edu.buffalo.fs7.mathlib.MathObject
        |
        +--edu.buffalo.fs7.mathlib.MathMap
              |
              +--edu.buffalo.fs7.mathlib.Measurement
All Implemented Interfaces:
java.lang.Cloneable

public class Measurement
extends MathMap

class representing the process of measurement. It implements a full measurement as well as a partial measurement of one qubit. The full measurement is implemented as a MathMap since and the partial measurement can be accessed with a gate of the notation {-:!:-:-:-:-}, which would measure the second qubit and renormalize the state. This class also provides a method to give the probability distribution of the state vector.

See Also:
BinaryOp

Fields inherited from class edu.buffalo.fs7.mathlib.MathObject
mathlib
 
Constructor Summary
Measurement()
          create a measurement map for a full measurement
 
Method Summary
 MathObject apply(MathObject o)
          applying a full measurement to a ket vector
 double getLastProbability()
          saves the probability of the latest measurement outcome
static java.util.Vector getPhaseDistribution(Braket q, int[] qubits)
          returns the real and imaginary parts of a register of qubits
static java.util.Vector getProbDistribution(Braket q, int[] qubits)
          returns the probability distribution for the outcome of a particular basis ket when performing a measurement without actually performing a measurement.
static void partialMeasurement(Braket q, int qubit)
          performing a partial measurement to the qubit given.
 java.lang.String toString()
          string representation of the measurement map
 
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
 

Constructor Detail

Measurement

public Measurement()
create a measurement map for a full measurement
Method Detail

apply

public MathObject apply(MathObject o)
applying a full measurement to a ket vector
Overrides:
apply in class MathMap

partialMeasurement

public static void partialMeasurement(Braket q,
                                      int qubit)
performing a partial measurement to the qubit given. It renormalizes the ket vector afterwards.
See Also:
BinaryOp.implicitApply(Gate, Braket, Matrix)

getProbDistribution

public static java.util.Vector getProbDistribution(Braket q,
                                                   int[] qubits)
returns the probability distribution for the outcome of a particular basis ket when performing a measurement without actually performing a measurement. The array qubits specifies which qubits are considered.

getPhaseDistribution

public static java.util.Vector getPhaseDistribution(Braket q,
                                                    int[] qubits)
returns the real and imaginary parts of a register of qubits

getLastProbability

public double getLastProbability()
saves the probability of the latest measurement outcome

toString

public java.lang.String toString()
string representation of the measurement map
Overrides:
toString in class MathObject
Following copied from class: edu.buffalo.fs7.mathlib.MathObject
See Also:
MathObject.toParseableString()