acqdp.circuit package

Submodules

acqdp.circuit.circuit module

acqdp.circuit.circuit.INDENT = ' '

The unit of indentation used for Operation.tree_string().

class acqdp.circuit.circuit.Operation(name='GenOp')[source]

Bases: object

Base class for quantum opertations.

By itself, it can represent a generic quantum operation, although one would not be able to do much with it. Usually, one should use ImmutableOperation (or more commonly, one of its subclasses) for simple quantum operations with an explicit tensor representation, and Circuit for quantum operations better represented as a composition of simpler operations. (Technically an ImmutableOperation can represent a complex operation by using a TensorNetwork as the data, but that would be an uncommon use case.)

Variables

name (str, optional) – Name of the quantum operation. Defaults to “GenOp”.

tree_string(indent=0)[source]

Return an indented string that describes the operation.

This is mainly used for visualization of Circuit instances. Notably, the returned string should not include the name of the operation, which would already be included by default in the tree string of the “parent” operation.

It is fine to return an empty string, but otherwise, the string should be indented with indent copies of the string INDENT, and terminated with a newline.

Parameters

indent (int, optional) – The amount of indent needed. Defaults to 0.

__mul__(other)[source]

Return two operations in parallel as a quantum circuit.

The resulting Circuit will have a number of qubits \(n\) equal to the total number of qubits in both operands, indexed by integers from 0 to \(n-1\). The qubits are ordered naturally, i.e., qubits in the left operand come first, and within both operands the original qubit orders are preserved.

Note that this function will regard both operands as atomic operations: No attempt is made to “expand” the operands even if one or both of them are themselves Circuit instances.

__or__(other)[source]

Return the concatenation of two operations as a quantum circuit.

The left operand will happen first. Note that this ordering convention is different from how the result would be represented as a product of matrices. For example, ZeroState | HGate | ZGate will result in the state \(ZH|0\rangle\).

If the left operand is a Circuit instance, then the qubit names in it will be preserved, and the same will apply to the right operand if it is a Circuit instance too; otherwise qubits in the right operand will be indexed by integers from 0. The qubit names will determine how the two circuits are connected.

If the left operand is not a Circuit instance, then the qubits in both operands will be indexed by integers from 0, and the circuits will be connected correspondingly.

property tensor_pure

Convert the operation into a tensor network representing the action of the operation in the pure state picture.

Examples of tensor representations in the pure state picture include state vectors of pure states, and unitary matrices of unitary gates.

Raises an error if the operation is not pure.

property tensor_density

Convert the operation into a tensor network representing the action of the operation in the density matrix picture.

Examples of tensor representations in the density matrix picture include density matrices of general quantum states, and Choi matrices of quantum operations. As a special case, when the operation is pure, the tensor network returned by tensor_density will consist of two disjoint components, one being the tensor network returned by tensor_pure and the other being its adjoint.

property tensor_control

Convert a controlled operation into a tensor network in the pure state picture, but with only one open edge for each controlling qubit.

A qubit in an operation can be regarded as a controlling qubit if its value in the computational basis is never changed by the operation. As such, its input wire and output wire can be represented by the same edge in a tensor network, thus simplifying the tensor network. In other words, the tensor_pure for a controlled operation will be a block diagonal matrix, and its tensor_control will be a more compact representation of the same matrix.

As a special case, if the operation is a diagonal gate, then every qubit can be regarded as a controlling qubit. See Diagonal.

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

class acqdp.circuit.circuit.ImmutableOperation(data: numpy.ndarray, shape: List[str], name='ImOp')[source]

Bases: acqdp.circuit.circuit.Operation

Class for quantum operations with explicit tensor representations. The operation is not supposed to be modified.

Parameters

data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – A tensor representation of the operation. For this base class, it will be the tensor returned by tensor_density. This means that for an operation with \(n\) input qubits and \(m\) output qubits, the tensor should be of rank \(2(n+m)\). A derived class of this may use different representation more suitable for a specific class of operations.

Variables
  • shape (List[str]) – A list of strings describing the input and output qubits of the quantum operation, with each string describing a qubit involved. For this base class, each string should be one of “i”, “o” or “io”, indicating whether each qubit is an input qubit, an output qubit, or both.

  • name (str, optional) – Name of the quantum operation. Defaults to “ImOp”.

process(data)[source]

Convert the input data into an appropriately shaped tensor, and initialize the operation with this tensor.

A derived class that uses a different tensor representation of the operation should override this function in order to do shape checking and initialization correctly.

Parameters

data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The data parameter passed to ImmutableOperation.__init__().

classmethod operation_from_kraus(shape, kraus, name='ImOp_Kraus')[source]

Construct a quantum operation from its Kraus operator representation.

Parameters
  • shape (List[str]) – The shape of the operation, in the same format as the shape attribute of ImmutableOperation.

  • kraus (List[acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray]) – The list of Kraus operators.

  • name (str, optional) – Name of the resulting quantum operation. Defaults to “ImOp_Kraus”.

Returns

A quantum operation constructed from the given Kraus operator representation.

Return type

ImmutableOperation

property is_pure

Return True if the operation is a pure operation.

Pure operations include pure states, isometries, projections and their combinations.

Note that currently this function determines whether an operation is pure solely based on the class of the operation, without inspecting the actual data. For example, if a quantum state s is initialized with s = State(num_qubits, data), then s.is_pure will always be False and s.tensor_pure will always raise an error, even if data is actually the density matrix of a pure state.

class acqdp.circuit.circuit.State(num_qubits, data: numpy.ndarray, name='State')[source]

Bases: acqdp.circuit.circuit.ImmutableOperation

Class for simple quantum states.

Quantum states are regarded as a special case of quantum operations where there is no input qubit, and each qubit is an output qubit.

Parameters
  • num_qubits (int) – Number of qubits in the state.

  • data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The density matrix representation of the state.

Variables

name (str, optional) – Name of the quantum state. Defaults to “State”.

class acqdp.circuit.circuit.Measurement(num_qubits, data: numpy.ndarray, name='Meas')[source]

Bases: acqdp.circuit.circuit.ImmutableOperation

Class for simple (destructive) measurements.

Destructive measurements are regarded as a special case of quantum operations where each qubit is an input qubit, and there is no output qubit. Such a measurement maps an arbitrary quantum state to a number.

Parameters
  • num_qubits (int) – Number of qubits measured.

  • data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The POVM (positive operator-valued measure) representation of the measurement.

Variables

name (str, optional) – Name of the quantum state. Defaults to “Meas”.

class acqdp.circuit.circuit.Channel(num_qubits, data: numpy.ndarray, name='Channel')[source]

Bases: acqdp.circuit.circuit.ImmutableOperation

Class for simple quantum channels.

This class is used for the common case where the input and output Hilbert spaces are the same, i.e., each qubit is both an input qubit and an output qubit. For channels that do not satisfy this constraint, please use ImmutableOperation directly.

Parameters
  • num_qubits (int) – Number of qubits the channel operates on.

  • data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The tensor representation of the channel in the density matrix picture.

Variables

name (str, optional) – Name of the quantum operation. Defaults to “Channel”.

class acqdp.circuit.circuit.PureOperation(data: numpy.ndarray, shape: List[str], name='PureOp', self_adjoint=False)[source]

Bases: acqdp.circuit.circuit.ImmutableOperation

Class for simple pure quantum operations.

Parameters

data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The tensor representation of the operation in the pure state picture. It will be the tensor returned by tensor_pure. This means that for an operation with \(n\) input qubits and \(m\) output qubits, the tensor should be of rank \(n+m\), i.e., half the rank of the tensor in the density matrix picture.

Variables
  • shape (List[str]) – The shape of the operation, in the same format as the shape attribute of ImmutableOperation.

  • name (str, optional) – Name of the quantum operation. Defaults to “PureOp”.

  • self_adjoint (bool, optional) – Whether the operation is self-adjoint. Defaults to False.

set_adjoint_op(adjoint_op)[source]

Set the known adjoint of the operation.

Usually, the adjoint of a pure operation is constructed on demand by calculating the tensor_pure of the operation, then constructing a new PureOperation object, which can be an inefficient process. By setting the adjoint of a operation to a known value, one can bypass this procedure. Note that, for efficiency, there is no check that adjoint_op is actually the adjoint of self.

The adjoint of adjoint_op is also set to self so there is no need to use this function twice.

Parameters

adjoint_op (PureOperation) – The known adjoint of self.

process(data)[source]

Convert the input data into an appropriately shaped tensor, and initialize the operation with this tensor.

A derived class that uses a different tensor representation of the operation should override this function in order to do shape checking and initialization correctly.

Parameters

data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The data parameter passed to ImmutableOperation.__init__().

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

class acqdp.circuit.circuit.PureState(num_qubits, data: numpy.ndarray, name='PureState')[source]

Bases: acqdp.circuit.circuit.PureOperation, acqdp.circuit.circuit.State

Class for simple pure quantum states.

Parameters
  • num_qubits (int) – Number of qubits in the state.

  • data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The state vector representation of the state.

Variables

name (str, optional) – Name of the quantum state. Defaults to “PureState”.

class acqdp.circuit.circuit.PureMeas(num_qubits, data: numpy.ndarray, name='PureMeas')[source]

Bases: acqdp.circuit.circuit.PureOperation, acqdp.circuit.circuit.Measurement

Class for simple projective measurements.

Parameters
  • num_qubits (int) – Number of qubits measured.

  • data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The vector representation of the measurement. Note that it should be the complex conjugation of the state vector of the state projected onto.

Variables

name (str, optional) – Name of the quantum state. Defaults to “PureMeas”.

class acqdp.circuit.circuit.Unitary(num_qubits, data: numpy.ndarray, name='Unitary', self_adjoint=False)[source]

Bases: acqdp.circuit.circuit.PureOperation, acqdp.circuit.circuit.Channel

Class for simple unitary gates.

Parameters
  • num_qubits (int) – Number of qubits the unitary operates on.

  • data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The matrix representation of the unitary.

Variables
  • name (str, optional) – Name of the quantum state. Defaults to “Unitary”.

  • self_adjoint (bool, optional) – Whether the unitary is self-adjoint. Defaults to False.

class acqdp.circuit.circuit.ControlledOperation(data: numpy.ndarray, shape: List[str], name='C-Op', self_adjoint=False)[source]

Bases: acqdp.circuit.circuit.PureOperation

Class for simple controlled operations.

Parameters

data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The tensor representation of the controlled operation. It will be the tensor returned by tensor_control. This means that for an operation with \(k\) controlling qubits, \(n\) non-control input qubits and \(m\) non-control output qubits, the tensor should be of rank \(k+n+m\).

Variables
  • shape (List[str]) – The shape of the operation, in the same format as the shape attribute of ImmutableOperation, but in addition to “i”, “o”, and “io”, the string “c” is also allowed, which indicates a controlling qubit.

  • name (str, optional) – Name of the quantum operation. Defaults to “C-Op”.

  • self_adjoint (bool, optional) – Whether the operation is self-adjoint. Defaults to False.

process(data)[source]

Convert the input data into an appropriately shaped tensor, and initialize the operation with this tensor.

A derived class that uses a different tensor representation of the operation should override this function in order to do shape checking and initialization correctly.

Parameters

data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The data parameter passed to ImmutableOperation.__init__().

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

class acqdp.circuit.circuit.Diagonal(num_cbits, data: numpy.ndarray, name='Diag', self_adjoint=False)[source]

Bases: acqdp.circuit.circuit.ControlledOperation

Class for simple diagonal gates.

A diagonal gate can be regarded as a controlled phase shift, where every qubit is a controlling qubit.

Parameters
  • num_qubits (int) – Number of qubits the diagonal gate operates on.

  • data (acqdp.tensor_network.tensor_valued.TensorValued or np.ndarray) – The diagonal elements of the matrix representation of the gate.

Variables
  • name (str, optional) – Name of the quantum state. Defaults to “Diag”.

  • self_adjoint (bool, optional) – Whether the gate is self-adjoint. Defaults to False.

acqdp.circuit.circuit.XGate = Unitary "X"

Single-qubit Pauli X gate.

acqdp.circuit.circuit.YGate = Unitary "Y"

Single-qubit Pauli Y gate.

acqdp.circuit.circuit.ZGate = Diagonal "Z"

Single-qubit Pauli Z gate.

acqdp.circuit.circuit.HGate = Unitary "H"

Single-qubit Hadamard gate.

acqdp.circuit.circuit.TGate = Diagonal "T"

Single-qubit T gate, i.e., a \(\pi/4\) rotation around the Z axis on the Bloch sphere.

acqdp.circuit.circuit.SGate = Diagonal "S"

Single-qubit S gate, i.e., a \(\pi/2\) rotation around the Z axis on the Bloch sphere.

acqdp.circuit.circuit.Trace = Measurement "Tr"

The partial trace operation, defined as an measurement that maps every normalized single-qubit state to 1.

In a circuit, a partial trace operation can simulate discarding a qubit. Note that this operation is inherently not pure since discarding one part of an entangled pure state will result in a mixed state.

acqdp.circuit.circuit.IGate = Unitary "I"

Single-qubit Identity gate.

acqdp.circuit.circuit.SWAPGate = Unitary "SWAP"

Two-qubit SWAP gate.

acqdp.circuit.circuit.CZGate = Diagonal "CZ"

Two-qubit CZ gate.

acqdp.circuit.circuit.XHalfGate = Unitary "X/2"

Single-qubit \(\sqrt{X}\) gate.

acqdp.circuit.circuit.YHalfGate = Unitary "Y/2"

Single-qubit \(\sqrt{Y}\) gate.

acqdp.circuit.circuit.CNOTGate = ControlledOperation "CNOT"

Two-qubit CNOT gate.

acqdp.circuit.circuit.ZeroState = PureState "|0>"

Single-qubit state \(|0\rangle\).

acqdp.circuit.circuit.OneState = PureState "|1>"

Single-qubit state \(|1\rangle\).

acqdp.circuit.circuit.CompState = [PureState "|0>", PureState "|1>"]

List of the computational basis states, \(|0\rangle\) and \(|1\rangle\).

acqdp.circuit.circuit.PlusState = PureState "|+>"

Single-qubit state \(|+\rangle\).

acqdp.circuit.circuit.MinusState = PureState "|->"

Single-qubit state \(|-\rangle\).

acqdp.circuit.circuit.FourierState = [PureState "|+>", PureState "|->"]

List of the Hadamard basis states, \(|+\rangle\) and \(|-\rangle\).

acqdp.circuit.circuit.ZeroMeas = PureMeas "<0|"

Single-qubit measurement \(\langle 0|\), the adjoint of \(|0\rangle\).

acqdp.circuit.circuit.OneMeas = PureMeas "<1|"

Single-qubit measurement \(\langle 1|\), the adjoint of \(|1\rangle\).

acqdp.circuit.circuit.CompMeas = [PureMeas "<0|", PureMeas "<1|"]

List of the computational basis measurements, \(\langle 0|\) and \(\langle 1|\).

acqdp.circuit.circuit.PlusMeas = PureMeas "<+|"

Single-qubit measurement \(\langle +|\), the adjoint of \(|+\rangle\).

acqdp.circuit.circuit.MinusMeas = PureMeas "<-|"

Single-qubit measurement \(\langle -|\), the adjoint of \(|-\rangle\).

acqdp.circuit.circuit.FourierMeas = [PureMeas "<+|", PureMeas "<-|"]

List of the computational basis measurements, \(\langle +|\) and \(\langle -|\).

acqdp.circuit.circuit.NDCompMeas = Channel "ND"

A non-destructive computational basis measurement.

This is equivalent to acqdp.circuit.noise.Dephasing(), but with a slightly more efficient tensor network representation.

class acqdp.circuit.circuit.XRotation(angle)[source]

Bases: acqdp.circuit.circuit.Unitary

Class for X Rotation gates in the form of \(e^{i\theta X}\).

Note that, since the eigenvalues of the Pauli operator \(X\) are 1 and -1, this actually corresponds to a rotation by \(2\theta\) on the Bloch sphere. For example, XRotation(np.pi) is a global phase operation with no physical effect, equivalent to a rotation by \(2\pi\) on the Bloch sphere. On the other hand, XRotation(np.pi / 2) is equivalent to the Pauli X operator up to a global phase, i.e., a rotation by \(\pi\) around the X axis on the Bloch sphere.

Variables

angle (float) – The rotation angle \(\theta\).

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

class acqdp.circuit.circuit.ZRotation(angle)[source]

Bases: acqdp.circuit.circuit.Diagonal

Class for Z Rotation gates in the form of \(e^{i\theta Z}\).

The same note about XRotation applies here. Furthermore, note that the rotation direction is the reverse of the “natural” direction given by \(\mathop{\mathrm{diag}}(1, e^{i\theta})\), since the actual rotation is \(\mathop{\mathrm{diag}}(e^{i\theta}, e^{-i\theta})\). For example, ZRotation(-np.pi / 8) and ZRotation(-np.pi / 4) will give the T gate and the S gate respectively, up to global phases.

Variables

angle (float) – The rotation angle \(\theta\).

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

class acqdp.circuit.circuit.Circuit(name='Circuit')[source]

Bases: acqdp.circuit.circuit.Operation

Class for quantum circuits that can be manipulated by adding and removing operations.

Each operation in a circuit has a name that is unique within the circuit, not necessarily related to its own name attribute. Each operation also has a time step which determines the order of the operations. For applications where those do not matter, they can be kept at their default values; see append() for those default values.

A circuit is always empty when initialized.

Variables
  • name (str, optional) – Name of the quantum circuit. Defaults to “Circuit”.

  • operations_by_name (Dict[hashable, dict]) –

    A dict mapping from operation names to dicts describing operations in the circuit. Each of the latter dicts d has three entries:

    • d["operation"] is the actual Operation.

    • d["time_step"] gives the time step at which the opration happens.

    • d["qubits"] is a list of qubits indicating which qubits in the circuit the operation is applied to.

property max_time

Return the maximum time step among all operations in the circuit.

append(operation: acqdp.circuit.circuit.Operation, qubits: List[int], time_step: Optional[float] = None, name=None)None[source]

Add an operation to the circuit.

If a time step is given, the operation is inserted into the circuit at the given time. Otherwise, the operation is appended to the end of the circuit.

Parameters
  • operation (Operation) – The operation to add to the circuit.

  • qubits (list) – The qubits the operation is applied to. Qubit names can be anything as long as they are hashable and comparable with each other. Any qubits not already in the circuit are added to the circuit.

  • time_step (int or float, optional) – The time step at which the operation happens. Defaults to max_time plus one, which ensures that the operation is appended to the end of the cirucit.

  • name (hashable, optional) – The name of the operation in the circuit. By default, the name is a tuple generated from time_step and qubits, ensuring its uniqueness within the circuit.

property operations_by_time

Return an OrderedDict of dicts, which is an reorganization of operations_by_name such that c.operations_by_time[t][name]== c.operations_by_name[name], where t is the time step of the operation in question.

The returned OrderedDict in ordered by increasing time.

tree_string(indent=0)str[source]

Return an indented string that describes the operation.

This is mainly used for visualization of Circuit instances. Notably, the returned string should not include the name of the operation, which would already be included by default in the tree string of the “parent” operation.

It is fine to return an empty string, but otherwise, the string should be indented with indent copies of the string INDENT, and terminated with a newline.

Parameters

indent (int, optional) – The amount of indent needed. Defaults to 0.

property all_qubits

Return a list of all qubits in the circuit.

property shape

Return the shape of the circuit as an operation, in the same format as the shape attribute of ImmutableOperation.

Raises an ValueError if the circuit is invalid. This can happen if a qubit is used multiple times at the same time step, or if the shapes of adjacent operations on the same qubit do not fit together, such as a quantum state followed by another quantum state.

property is_valid

Return True if the circuit is valid.

See shape for ways a circuit can be invalid.

property is_pure

Return True if the operation is a pure operation.

Pure operations include pure states, isometries, projections and their combinations.

Similar to ImmutableOperation.is_pure, this does not analyze the actual action of the circuit, and only checks whether the component operations are all pure.

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

class acqdp.circuit.circuit.ControlledCircuit(circuit, name=None, conditioned_on=True)[source]

Bases: acqdp.circuit.circuit.ControlledOperation

Class for quantum circuits controlled by a single qubit.

Variables
  • circuit (Circuit) – The circuit being controlled.

  • name (str, optional) – Name of the controlled circuit. Defaults to “C-<circuit>”, where <circuit> is the name of the circuit being controlled.

  • conditioned_on (bool, optional) – Whether the circuit is applied when the controlling qubit is in the \(|1\rangle\) state or the \(|0\rangle\) state. Defaults to True, meaning that the circuit is applied when the controlling qubit is in the \(|1\rangle\) state.

tree_string(indent=0)[source]

Return an indented string that describes the operation.

This is mainly used for visualization of Circuit instances. Notably, the returned string should not include the name of the operation, which would already be included by default in the tree string of the “parent” operation.

It is fine to return an empty string, but otherwise, the string should be indented with indent copies of the string INDENT, and terminated with a newline.

Parameters

indent (int, optional) – The amount of indent needed. Defaults to 0.

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

property is_valid

Return True if the circuit is valid.

See Circuit.shape for ways a circuit can be invalid.

acqdp.circuit.circuit.Controlled(operation, name=None, conditioned_on=True)[source]

Return a controlled version of the given operation.

When the given operation is not applied, the identity gate is applied, which means the operation must have the same input and output qubits. The operation also needs to be pure in order for quantum control to be well-defined, which means it must be a unitary. However, it can be either an ImmutableOperation or a Circuit.

Parameters
  • operation (Operation) – The quantum operation being controlled.

  • name (str, optional) – Name of the resulting controlled operation. Defaults to “C-<operation>”, where <operation> is the operation being controlled.

  • conditioned_on (bool, optional) – Whether the operation is applied when the controlling qubit is in the \(|1\rangle\) state or the \(|0\rangle\) state. Defaults to True, meaning that the operation is applied when the controlling qubit is in the \(|1\rangle\) state.

class acqdp.circuit.circuit.SuperPosition(operations, coefs=None, name='SuperPos')[source]

Bases: acqdp.circuit.circuit.Operation

Class for a superposition of multiple pure operations.

Variables
  • operations (List[Operation]) – A list of operations in the superposition.

  • coefs (List[float], optional) – A list of coefficients, corresponding to each of the component operations. By default, all the coefficients are 1.

  • name (str, optional) – Name of the superposition operation. Defaults to “SuperPos”.

property is_pure

Return True if the operation is a pure operation.

A SuperPosition object is always pure.

adjoint()[source]

Return the adjoint of a quantum operation.

~op is an alias of op.adjoint().

acqdp.circuit.circuit.XXRotation(angle)[source]

Return a two-qubit XX rotation gate in the form of \(e^{i\theta(X\otimes X)}\), also known as an Ising gate.

Parameters

angle (float) – The rotation angle \(\theta\).

acqdp.circuit.circuit.ZZRotation(angle)[source]

Return a two-qubit ZZ rotation gate in the form of \(e^{i\theta(Z\otimes Z)}\).

Parameters

angle (float) – The rotation angle \(\theta\).

acqdp.circuit.converter module

class acqdp.circuit.converter.Converter[source]

Bases: object

Generic converter class, with method mapping a circuit to a tensor network.

classmethod convert_pure(operation: acqdp.circuit.circuit.Operation) → acqdp.tensor_network.tensor_valued.TensorValued[source]

Do a pure conversion for noiseless circuit described as a Operation object to a tensor network as a TensorValued object.

Parameters

operation (Operation.) – the noisy circuit to convert.

Returns

TensorValued – the tensor network to describe the input noisy circuit.

classmethod convert_control(operation: acqdp.circuit.circuit.PureOperation) → acqdp.tensor_network.tensor_valued.TensorValued[source]

Do a control conversion for noisy circuit described as a Operation object to a tensor network as a TensorValued object.

Parameters

operation (Operation.) – the noisy circuit to convert.

Returns

TensorValued – the tensor network to describe the input noisy circuit.

classmethod convert_density(operation: acqdp.circuit.circuit.Operation) → acqdp.tensor_network.tensor_valued.TensorValued[source]

Do a density conversion for noisy circuit described as a Operation object to a tensor network as a TensorValued object.

Parameters

operation (Operation.) – the noisy circuit to convert.

Returns

TensorValued – the tensor network to describe the input noisy circuit.

acqdp.circuit.noise module

acqdp.circuit.noise.Depolarization(px=0.25, py=None, pz=None)[source]

Single-qubit depolarizing channel.

Parameters
  • px (float.) – One of the three parameters to describe the single-qubit depolarizing channel.

  • py (float.) – One of the three parameters to describe the single-qubit depolarizing channel.

  • pz (float.) – One of the three parameters to describe the single-qubit depolarizing channel.

Returns

Mixture – the single-qubit depolarizing channel.

acqdp.circuit.noise.Dephasing(pz=0.5)[source]

Single-qubit dephasing channel, also called the phase-damping channel.

Parameters

pz (float.) – The parameter to describe the single-qubit dephasing channel.

Returns

Mixture – the single-qubit dephasing channel with given parameter.

acqdp.circuit.noise.AmplitudeDampling(p=0.1)[source]
acqdp.circuit.noise.add_noise(circuit, noise_channel)[source]

Module contents