public class QuantumGate extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
String |
axis
The axis of rotation, if this gate represents a qubit rotation.
|
FunctionParser |
function
the parsed function for the function evaluation gate Uf.
|
String |
name
specifies the name of this quantum gate.
|
int |
phiAsPartOfPi
rotation angle, as the integral part n of π.
|
int[] |
qubits
specifies the index of qubits on which the gate operates.
|
boolean |
yRegister
specifies if the gate operates on the y-register.
|
Constructor and Description |
---|
QuantumGate(String name,
int[] qubits,
boolean yRegister)
Constructs a generic quantum gate.
|
QuantumGate(String name,
int[] qubits,
FunctionParser function,
boolean yRegister)
Constructor for a quantum gate evaluating a function.
|
QuantumGate(String name,
int[] qubits,
String axis,
int phiAsPartOfPi,
boolean yRegister)
Constructor for a rotation operation.
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
Returns the name of this quantum gate.
|
int[] |
getQubits()
Returns an array of the indices of the qubits on which this gate operates.
|
static boolean |
isValid(String name)
Checks whether the specified string represents a valid quantum gate.
|
public String name
public int[] qubits
public boolean yRegister
public FunctionParser function
public String axis
public int phiAsPartOfPi
public QuantumGate(String name, int[] qubits, boolean yRegister)
name
- the name of the quantum gate; possible values are determined by
Circuit.gatelist
qubits
- array representing the state of the qubitsyRegister
- flag indicating whether the gate applies to the y-registerIllegalArgumentException
- if the gate name is unknownpublic QuantumGate(String name, int[] qubits, FunctionParser function, boolean yRegister)
name
- the name of the quantum gate; possible values are determined by
Circuit.gatelist
qubits
- array representing the state of the qubitsfunction
- the function to be evaluatedyRegister
- flag indicating whether the gate applies to the y-registerIllegalArgumentException
- if the gate name is unknown or the function is nullpublic QuantumGate(String name, int[] qubits, String axis, int phiAsPartOfPi, boolean yRegister)
name
- the name of the quantum gate; possible values are determined by
Circuit.gatelist
qubits
- array representing the state of the qubitsaxis
- the axis of rotation, i.e., "x", "y", or "z"phiAsPartOfPi
- rotation angle, as the integral part n of π;
more accurately, n = π/φ where φ
is the rotation angle in radians.yRegister
- indicates whether this gate belngs to the y-registerIllegalArgumentException
- if the gate name is unknownpublic String getName()
public int[] getQubits()
public static boolean isValid(String name)
name
- the name to be checkedtrue
if and only if the name represents a valid quantum gate