Cove - A Practical Quantum Computer Programming Framework
QuantumRegister Class
NamespacesCove.LocalSimulationQuantumRegister
A quantum register is a collection of qubits.
Declaration Syntax
C#Visual BasicVisual C++
public class QuantumRegister : IQuantumRegister, 
	ICoveObject, IEnumerable<IQuantumRegister>, IEnumerable
Public Class QuantumRegister _
	Implements IQuantumRegister, ICoveObject, IEnumerable(Of IQuantumRegister),  _
	IEnumerable
public ref class QuantumRegister : IQuantumRegister, 
	ICoveObject, IEnumerable<IQuantumRegister^>, IEnumerable
Members
All MembersConstructorsMethodsFields



IconMemberDescription
QuantumRegister()()()
Default constructor, create a register of a single qubit

QuantumRegister(Int32)
Construct a quantum register with a specific number of qubits.

QuantumRegister(array<Boolean>[]()[])
Create a new quantum register where each qubit is set to the bool specified in the array. Qubit x will be set to element x in InitialQubitValues.

ApplyOperation(IQuantumOperation)
Apply a generic operation to the register.

ApplyOperation(ComplexMatrix)
Apply a generic operation to the register.

ApplyOperation(IQuantumOperation, array<Int32>[]()[])
Apply a generic operation to the specified qubits.

ApplyOperationAll(IQubitOperation)
Apply the single qubit operation to all qubits in the register.

ApplyOperations(IEnumerable<(Of <(IQuantumOperation>)>))
Apply a series of operations to the quantum register. If any of the operations are invalid and an exception is thrown then the state of the register is not altered.

CloneForSlice()()()
This copies over all the necessary members of the existing register into a new one so that slice operations only have to worry about manipulating the exposed qubits. Also makes the expansion of the QuantumRegister class easier since any copying for slicing can be put here.

CorrectOperationMatrix(ComplexMatrix)
Correct an operation matrix so it takes into account the actual number of qubits in the register.

EliminateDuplicateReferences()()()
It is possible to create a register with references to the same qubit. This goes through and eliminates duplicate references, leaving the reference at the lowest index.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
GetAppliedIndices(List<(Of <(Int32>)>))
Get how the exposed indices in the register match up to the target indices in the operation. The result can be used in matrix expansion and reordering.

GetCompleteRegister()()()
Slices can be used to obtain subsets of a register. This method returns a register that contains the whole set of qubits that have been included in this register. This register will contain the qubits in their original order, regardless of slices.

GetEnumerator()()()
Enumerator to return a single qubit register for each qubit in the register.

GetHashCode()()()
Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from Object.)
GetIncludedBinaryRepresentation(List<(Of <(Int32>)>), Int32)
Get the binary representation of the exposed qubits that would be operated on by an operation.

GetIndexes(Int32, Int32)
Get an array of indexes. This can be used when passing indexes to methods that apply operations

GetIndexes()()()
Get an array of indexes. This can be used when passing indexes to methods that apply operations

GetLength()()()
Get the length of the quantum register. Note that due to slicing this length may be smaller than all the qubits actually contained in the register.

GetLocation()()()
Returns the location of the quantum resource.

GetNotIncludedBinaryRepresentation(Int32)
Get the binrary representations of the indices that are not included in Value.

GetPlaceInMask(Int64, Int32)
Get the place (0 based) in the mask that the current TestBit is at. Example, if bit mask is 0x0A and test bit is 3 then return 1. This is because 0x0A = 0000 1010 and bit 3 (0x08) is set to true and is in place 1 (0 based).

GetQuantumFourierTransformOperations()()()
Get the operations that apply the Quantum Fourier Transform. These are then applied in order for the normal QFT, or reversed and applied for the inverse QFT. Thus the application of (inverse) QFT is merely the application of these operations.

GetState()()()
Expose the state of the system. This is a deep copy of the state, so there is no need to worry about inadvertently altering the state. This is protected so user subclasses can access the state and internal so that unit tests can access it.

GetTotalLength()()()
Slicing may result in a subset of the register being exposed. This gets the total length of the register, which includes qubits that may be hidden through slicing.

GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
InsertQubits(Int32, IQuantumRegister)
Insert a quantum register into this one.

InsertQubits(Int32, array<IQuantumRegister>[]()[])
Insert quantum registers into this one.

InsertQubits(Int32, IQubit)
Insert a single qubit into the register.

InsertQubits(Int32, array<IQubit>[]()[])
Insert multiple qubits to the register.

InsertQubits(Int32, Int32)
Insert qubits into an arbitrary location in the register.

InsertQubits(Int32, Int32, Boolean)
Insert qubits into an arbitrary location in the register.

InsertQubitsAtBeginning(IQuantumRegister)
Add another register to the beginning of this one.

InsertQubitsAtBeginning(array<IQuantumRegister>[]()[])
Append a set of registers to the beginning of this register, in the same order as the array.

InsertQubitsAtBeginning(IQubit)
Add a single qubit to the beginning of the register.

InsertQubitsAtBeginning(array<IQubit>[]()[])
Add a series of qubits to the beginning of the register, in the same order as specified in the array.

InsertQubitsAtBeginning(Int32)
Insert a number of qubits at the beginning of the register. All other qubits are shifted to higher indexes.

InsertQubitsAtBeginning(Int32, Boolean)
Insert a number of qubits at the beginning of the register. All other qubits are shifted to higher indexes.

InsertQubitsAtEnd(IQuantumRegister)
Append another register to this one.

InsertQubitsAtEnd(array<IQuantumRegister>[]()[])
Append a set of registers to this register, in the same order as the array.

InsertQubitsAtEnd(IQubit)
Append a single qubit to the register.

InsertQubitsAtEnd(Int32)
Append a specific number of qubits to the register.

InsertQubitsAtEnd(Int32, Boolean)
Append a specific number of qubits to the register, initialized to the specified value.

IsStateInPartialCollapse(Int64, Int64, Int64)
Does the current state (State) match the collapsed value in the measuring mask? Example: Measuring mask is XX11X1, Collapsed value is 011 (3 bits in measuring mask). So if State is in the form XX01X1 then true is returned.

IsValidState()()()
Checks to make sure the register is in a valid state: all entries in the matrix representing the state must have the squares of their values total 1.0.

MAXIMUM_QUBITS_IN_REGISTER
The maximum number of qubits allowed in a single register.

Measure()()()
Perform a measurement on the quantum register, collapsing to an absolute state.

Measure(ClassicalResult)
Measure the quantum register and put the results in ReturnValue. A user can subclass ClassicalResult with their own class and pass that in if needed.

Measure(IEnumerable<(Of <(Int32>)>))
Measure a set of qubits in the register.

Measure(IEnumerable<(Of <(Int32>)>), ClassicalResult)
Measure a set of qubits in the register. A user can subclass ClassicalResult with their own class and pass that in if needed.

Measure(Int32)
Measure one qubit in the register.

Measure(Int32, ClassicalResult)
Measure one qubit in the register.. A user can subclass ClassicalResult with their own class and pass that in if needed.

MemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
NarrowFromBitMask(Int64, Int64)
Narrow a value based on a bit mask. Basically all the bits in the value that are in the bit mask are squezed into a value. Example if the bit mask is 1011 and the value is 1000 then it will return 0100. (because there is a gap in the bit mask so it shifts it over one.

NotExposedBinaryDiffers(List<(Of <(Int32>)>), Int32, Int32)
Do the binary representations of FirstValue and SecondValue differ in the positions that are not exposed?

OperationCNot()()()
Apply the CNot operation to the register. (Must be a 2 qubit register.) The first qubit is the control and the second is the target.

OperationCNot(Int32, Int32)
Apply the CNot operation to the register.

OperationCNot(array<Int32>[]()[])
Apply the CNot operation to the register. (Must be a 2 qubit register.) The first qubit is the control and the second is the target.

OperationControlledU(IQubitOperation, Int32)
Perform the TargetOperation on all qubits except the qubit at ControlIndex if the qubit at ControlIndex is |1>. Else there is no change in the register. This arbitrary application of a single qubit operator to n qubits in a register based on a control qubit is called ControlU.

OperationControlledU(IQubitOperation, Int32, array<Int32>[]()[])
Perform the TargetOperation on the qubits at TargetIndexes if ControlIndex is |1>.

OperationFredkin()()()
Perform the Fredkin operation (controlled swap).

OperationFredkin(Int32, Int32, Int32)
Perform the Fredkin operation (controlled swap).

OperationFredkin(array<Int32>[]()[])
Perform the Fredkin operation (controlled swap).

OperationHadamard()()()
Perform the Hadamard (square root of Not) operation on a qubit.

OperationHadamard(Int32)
Apply the Hadamard (square root of Not) operation to the specified qubit.

OperationHadamard(array<Int32>[]()[])
Perform the Hadamard (square root of Not) operation to the specified qubits.

OperationHadamardAll()()()
Apply the Hadamard (square root of Not) operation to all the qubits in the register.

OperationIdentity()()()
Apply the identity operation to a qubit.

OperationIdentity(Int32)
Apply the identity operation to the qubit at the specified index.

OperationIdentity(array<Int32>[]()[])
Apply the identity operation to the qubits at the specified indexes.

OperationIdentityAll()()()
Apply the identity operation to all the qubits in the register.

OperationInverseQuantumFourierTransform()()()
Perform the inverse Quantum Fourier Transform on the register.

OperationNot()()()
Apply the Not (X gate) operation to the qubit.

OperationNot(Int32)
Apply the Not (X gate) operation to the qubit at the specified index.

OperationNot(array<Int32>[]()[])
Apply the Not (X gate) operation to the qubits at the specified indexes.

OperationNotAll()()()
Apply the Not (X gate) operation to all the qubits in the register.

OperationQuantumFourierTransform()()()
Apply the Quantum Fourier Transformation (QFT) to the register.

OperationSGate()()()
Apply the S gate (phase gate) to the qubit.

OperationSGate(Int32)
Apply the S gate (phase gate) to the qubit at the specified index.

OperationSGate(array<Int32>[]()[])
Apply the S gate (phase gate) to the qubits at the indexes specified.

OperationSGateAll()()()
Apply the S gate (phase gate) operation to all the qubits in the register.

OperationSwap()()()
Apply the swap operation to the qubits in the register.

OperationSwap(Int32, Int32)
Perform the swap operation on the two qubits specified.

OperationSwap(array<Int32>[]()[])
Perform the swap operation on the qubits specified.

OperationTGate()()()
Perform the T gate (pi/8 phase gate) operation on the qubit.

OperationTGate(Int32)
Perform the T gate (pi/8 phase gate) operation on the qubit at the specified index.

OperationTGate(array<Int32>[]()[])
Perform the T gate (pi/8 phase gate) operation on the qubits at the specified indexes.

OperationTGateAll()()()
Apply the T gate (pi/8 phase gate) operation to all the qubits in the register.

OperationToffoli()()()
Apply the Toffoli (controlled controlled not) operation to the register. The lowest two indexes are the control and the highest is the target.

OperationToffoli(Int32, Int32, Int32)
Apply the Toffoli (controlled controlled not) operation to the register.

OperationToffoli(array<Int32>[]()[])
Perform the Toffoli (controlled controlled not) operation to the register.

OperationYGate()()()
Perform the Y gate operation to the qubit.

OperationYGate(Int32)
Perform the Y gate operation to the qubit at the specified index.

OperationYGate(array<Int32>[]()[])
Perform the Y gate operation to the qubits at the specified indexes.

OperationYGateAll()()()
Perform the Y gate operation to all the qubits in the register.

OperationZGate()()()
Perform the Z gate operation to the qubit in the register.

OperationZGate(Int32)
Perform the Z gate operation to the qubit at the specified index.

OperationZGate(array<Int32>[]()[])
Perform the Z gate operation to the qubits at the specified indexes.

OperationZGateAll()()()
Apply the Z gate operation to all the qubits in a register.

PeekAtEntireState()()()
Gets the complex matrix that represents the entire state of the register that is being tracked, which may be more than is currently exposed. Use PeekAtVisibleState() to see the state only the qubits currently exposed by this registerThis method is specific to this simulation and cannot be done on a true quantum computer. As such, this method is only recommended for learning purposes.

PeekAtVisibleState()()()
Get the complex matrix that represents the state of the qubits exposed by this register. Use PeekAtEntireState() to see the state of all qubits that are part of the register, which may be more than exposed. This method is specific to this simulation and cannot be done on a true quantum computer. As such, this method is only recommended for learning purposes.

SetAllQubitsTo(Boolean)
Set all the qubits of the register to the specified value.

SetLabelOne(String)
Change the label of 1

SetLabels(String, String)
Set both the label for |0> and label for |1> in one call

SetLabelZero(String)
Change the label of 0

SetLocation(String)
Set the location of the quantum resource. Note that this resets the state of all of the qubits.

SetQubit(Int32, Boolean)
Set a qubit to a particular state.

SetQubits(Int32, ClassicalResult)
Set the qubits starting at StartingIndex to the classical result SetTo.

SetQubits(ClassicalResult)
Set the qubits starting at StartingIndex to the classical result SetTo.

SetQubits(array<Int32>[]()[], Boolean)
Set the specified qubits to the value specified.

SetQubits(array<Boolean>[]()[])
Set qubits based on the boolean values given.

Slice(Int32, Int32)
Returns a slice (subset) of the quantum register.

Slice(Int32, Int32, IQuantumOperation)
Slice (subset) a quantum register and perform an operation on the slice.

Slice(Int32, Int32, IEnumerable<(Of <(IQuantumOperation>)>))
Slice (subset) a quantum register and perform operations on the slice.

SliceFrom(Int32)
Returns a slice (subset) of the register from StartIndex to the end.

SliceFrom(Int32, IQuantumOperation)
Returns a slice (subset) of the register from StartIndex to the end, then has the operation applied to it.

SliceFrom(Int32, IEnumerable<(Of <(IQuantumOperation>)>))
Returns a slice (subset) of the register from StartIndex to the end, then has the operations applied to it.

SliceReorder(IEnumerable<(Of <(Int32>)>))
Reorder the qubits in any arbitrary order. NewIndexes is an array of integers that must equal the length of this register. The qubit at each index in that array will be moved to the value in the array. Example: the register this is called on contains 3 qubits, indexed 0 - 2. If the array {2, 0, 1} is passed then: the qubit at index 0 will be moved to index 2; the qubit at index 1 will be moved to index 0; the qubit at index 2 will be moved to index 1.

SliceReverse(Int32, Int32)
Returns a slice (subset) of the quantum register, but the ordering of the qubits in the returned register are reversed.

SliceReverse()()()
Returns a quantum register with the qubits reversed.

SliceReverse(Int32, Int32, IQuantumOperation)
Returns a slice (subset) of the quantum register, but the ordering of the qubits in the returned register are reversed then have the specified operation applied.

SliceReverse(IQuantumOperation)
Returns a quantum register with the qubits reversed, then the operation applied.

SliceReverse(Int32, Int32, IEnumerable<(Of <(IQuantumOperation>)>))
Returns a slice (subset) of the quantum register, but the ordering of the qubits in the returned register are reversed then have the specified operations applied.

SliceReverse(IEnumerable<(Of <(IQuantumOperation>)>))
Returns a quantum register with the qubits reversed, then the operations applied.

SliceSubset(IEnumerable<(Of <(Int32>)>))
Returns a slice (subset) of the quantum register containing the qubits specified in Indexes, and in that order.

SliceSubset(IEnumerable<(Of <(Int32>)>), IQuantumOperation)
Returns a slice (subset) of the quantum register containing the qubits specified in Indexes, and in that order. The operation is then applied to the slice.

SliceSubset(IEnumerable<(Of <(Int32>)>), IEnumerable<(Of <(IQuantumOperation>)>))
Returns a slice (subset) of the quantum register containing the qubits specified in Indexes, and in that order. The specified operations are then applied.

SliceTo(Int32)
Returns a slice (subset) of the register from the beginning to EndIndex.

SliceTo(Int32, IQuantumOperation)
Returns a slice (subset) of the register from the beginning to EndIndex, then has the operation applied to it.

SliceTo(Int32, List<(Of <(IQuantumOperation>)>))
Returns a slice (subset) of the register from the beginning to EndIndex, then has the operations applied to it.

ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
VerifyValidState()()()
Throw an exception if the state of the register is invalid, do nothing otherwise.

Inheritance Hierarchy
Object
QuantumRegister

Assembly: Cove.LocalSimulation (Module: Cove.LocalSimulation) Version: 1.0.0.0 (1.0.0.0)