qiskit.providers.aer.utils.NoiseTransformer
class NoiseTransformer
Transforms one quantum channel to another based on a specified criteria.
__init__
__init__()
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__ () | Initialize self. |
channel_matrix_representation (operators) | We convert the operators to a matrix by applying the channel to the four basis elements of the 2x2 matrix space representing density operators; this is standard linear algebra |
compute_P (As) | This method creates the matrix P in the f(x) = 1/2(x*P*x)+q*x representation of the objective function :param As: list of symbolic matrices repersenting the channel matrices :type As: list |
compute_channel_operation (rho, operators) | Given a quantum state’s density function rho, the effect of the channel on this state is: rho -> sum_{i=1}^n E_i * rho * E_i^dagger |
compute_q (As, C) | This method creates the vector q for the f(x) = 1/2(x*P*x)+q*x representation of the objective function :param As: list of symbolic matrices repersenting the quadratic program :type As: list :param C: matrix representing the the constant channel matrix :type C: matrix |
fidelity (channel) | Calculates channel fidelity |
flatten_matrix (m) | param mThe matrix to flatten |
generate_channel_matrices (…) | Generate symbolic channel matrices. |
generate_channel_quadratic_programming_matrices (…) | Generate matrices for quadratic program. |
get_const_matrix_from_channel (channel, symbols) | Extract the numeric constant matrix. |
get_matrix_from_channel (channel, symbol) | Extract the numeric parameter matrix. |
operator_circuit (operator) | Converts an operator representation to noise circuit. |
operator_matrix (operator) | Converts an operator representation to Kraus matrix representation |
prepare_channel_operator_list (ops_list) | Prepares a list of channel operators. |
prepare_honesty_constraint (…) | Prepares the honesty constraint. |
solve_quadratic_program (P, q) | Solve the quadratic program optimization problem. |
transform_by_given_channel (channel_matrices, …) | Transform by by quantum channels. |
transform_by_operator_list (…) | Transform input Kraus operators. |
channel_matrix_representation
channel_matrix_representation(operators)
We convert the operators to a matrix by applying the channel to the four basis elements of the 2x2 matrix space representing density operators; this is standard linear algebra
Parameters
operators (list) – The list of operators to transform into a Matrix
Returns
The matrx representation of the operators
Return type
sympy.Matrix
compute_P
compute_P(As)
This method creates the matrix P in the f(x) = 1/2(x*P*x)+q*x representation of the objective function :param As: list of symbolic matrices repersenting the channel matrices :type As: list
Returns
The matrix P for the description of the quadaric program
Return type
matrix
compute_channel_operation
static compute_channel_operation(rho, operators)
Given a quantum state’s density function rho, the effect of the channel on this state is: rho -> sum_{i=1}^n E_i * rho * E_i^dagger
Parameters
- rho (number) – Density function
- operators (list) – List of operators
Returns
The result of applying the list of operators
Return type
number
compute_q
compute_q(As, C)
This method creates the vector q for the f(x) = 1/2(x*P*x)+q*x representation of the objective function :param As: list of symbolic matrices repersenting the quadratic program :type As: list :param C: matrix representing the the constant channel matrix :type C: matrix
Returns
The vector q for the description of the quadaric program
Return type
list
fidelity
static fidelity(channel)
Calculates channel fidelity
flatten_matrix
static flatten_matrix(m)
Parameters
m (Matrix) – The matrix to flatten
Returns
A row vector repesenting the flattened matrix
Return type
list
generate_channel_matrices
generate_channel_matrices(transform_channel_operators_list)
Generate symbolic channel matrices.
Generates a list of 4x4 symbolic matrices describing the channel defined from the given operators. The identity matrix is assumed to be the first element in the list:
[(I, ), (A1, B1, ...), (A2, B2, ...), ..., (An, Bn, ...)]
E.g. for a Pauli channel, the matrices are:
[(I,), (X,), (Y,), (Z,)]
For relaxation they are:
[(I, ), (|0><0|, |0><1|), |1><0|, |1><1|)]
We consider this input to symbolically represent a channel in the following manner: define indeterminates which are meant to represent probabilities such that and .
Now consider the quantum channel defined via the Kraus operators This is the channel C symbolically represented by the operators.
Parameters
transform_channel_operators_list (list) – A list of tuples of matrices which represent Kraus operators.
Returns
A list of 4x4 complex matrices ([D1, D2, ..., Dn], E)
such that the matrix represents the operation of the channel C on the density operator. we find it easier to work with this representation of C when performing the combinatorial optimization.
Return type
list
generate_channel_quadratic_programming_matrices
generate_channel_quadratic_programming_matrices(channel, symbols)
Generate matrices for quadratic program.
Parameters
- channel (Matrix) – a 4x4 symbolic matrix
- symbols (list) – the symbols x1, …, xn which may occur in the matrix
Returns
A list of 4x4 complex matrices ([D1, D2, …, Dn], E) such that: channel == x1*D1 + … + xn*Dn + E
Return type
list
get_const_matrix_from_channel
static get_const_matrix_from_channel(channel, symbols)
Extract the numeric constant matrix.
Parameters
- channel (matrix) – a 4x4 symbolic matrix.
- symbols (list) – The full list [x1, …, xn] of symbols used in the matrix.
Returns
a 4x4 numeric matrix.
Return type
matrix
Additional Information:
Each entry of the 4x4 symbolic input channel matrix is assumed to be a polynomial of the form a1x1 + … + anxn + c. The corresponding entry in the output numeric matrix is c.
get_matrix_from_channel
static get_matrix_from_channel(channel, symbol)
Extract the numeric parameter matrix.
Parameters
- channel (matrix) – a 4x4 symbolic matrix.
- symbol (list) – a symbol xi
Returns
a 4x4 numeric matrix.
Return type
matrix
Additional Information:
Each entry of the 4x4 symbolic input channel matrix is assumed to be a polynomial of the form a1x1 + … + anxn + c. The corresponding entry in the output numeric matrix is ai.
operator_circuit
operator_circuit(operator)
Converts an operator representation to noise circuit.
Parameters
operator (operator) – operator representation. Can be a noise circuit or a matrix or a list of matrices.
Returns
The operator, converted to noise circuit representation.
Return type
List
operator_matrix
operator_matrix(operator)
Converts an operator representation to Kraus matrix representation
Parameters
operator (operator) – operator representation. Can be a noise circuit or a matrix or a list of matrices.
Returns
the operator, converted to Kraus representation.
Return type
prepare_channel_operator_list
static prepare_channel_operator_list(ops_list)
Prepares a list of channel operators.
Parameters
ops_list (List) – The list of operators to prepare
Returns
The channel operator list
Return type
List
prepare_honesty_constraint
prepare_honesty_constraint(transform_channel_operators_list)
Prepares the honesty constraint.
Parameters
- transform_channel_operators_list (list) – A list of tuples of matrices which represent
- operators. (Kraus) –
solve_quadratic_program
solve_quadratic_program(P, q)
Solve the quadratic program optimization problem.
This function solved the quadratic program to minimize the objective function f(x) = 1/2(x*P*x)+q*x subject to the additional constraints Gx <= h
Where P, q are given and G,h are computed to ensure that x represents a probability vector and subject to honesty constraints if required :param P: A matrix representing the P component of the objective function :type P: matrix :param q: A vector representing the q component of the objective function :type q: list
Returns
The solution of the quadratic program (represents probabilities)
Return type
list
Additional information:
This method is the only place in the code where we rely on the cvxpy library should we consider another library, only this method needs to change.
transform_by_given_channel
transform_by_given_channel(channel_matrices, const_channel_matrix)
Transform by by quantum channels.
This method creates objective function representing the Hilbert-Schmidt norm of the matrix (A-B) obtained as the difference of the input noise channel and the output channel we wish to determine.
This function is represented by a matrix P and a vector q, such that f(x) = 1/2(x*P*x)+q*x where x is the vector we wish to minimize, where x represents probabilities for the noise operators that construct the output channel
Parameters
- channel_matrices (list) – A list of 4x4 symbolic matrices
- const_channel_matrix (matrix) – a 4x4 constant matrix
Returns
a list of the optimal probabilities for the channel matrices, determined by the quadratic program solver
Return type
list
transform_by_operator_list
transform_by_operator_list(transform_channel_operators, noise_kraus_operators)
Transform input Kraus operators.
Allows approximating a set of input Kraus operators as in terms of a different set of Kraus matrices.
For example, setting allows approximating by a Pauli channel, and represents the relaxation channel
In the case the input is a list of transform matrices and of noise Kraus operators, the output is a list of probabilities such that:
- is a list of Kraus operators that define the output channel (which is “close” to the input channel given by .)
This channel can be thought of as choosing the operator in probability and applying this operator to the quantum state.
More generally, if the input is a list of tuples (not necessarily of the same size): then the output is still a list and now the output channel is defined by the operators:
Parameters
- noise_kraus_operators (List) – a list of matrices (Kraus operators) for the input channel.
- transform_channel_operators (List) – a list of matrices or tuples of matrices representing Kraus operators that can construct the output channel.
Returns
A list of amplitudes that define the output channel.
Return type
List