pygsti.tools.matrixtools#
Matrix related utility functions
Functions
|
Construct an approximate logarithm of superoperator matrix m that is real and near the target_logm. |
|
|
|
Raise a ValueError if mx is not an orthogonal projector, per |
|
Returns the ith standard basis vector in dimension dim. |
|
Compute the norms of the columns of a matrix. |
|
Checks whether a matrix contains orthogonal columns. |
|
Checks whether a matrix contains orthogonal columns. |
|
Comparison function for complex numbers that compares real part, then imaginary part. |
|
Computes the "kite" corresponding to a list of eigenvalues. |
|
Accelerated summation of several CSR-format sparse matrices. |
|
Computation of the summation of several CSR-format sparse matrices. |
|
Precomputes quantities allowing fast computation of linear combinations of CSR sparse matrices. |
|
Precomputes the indices needed to sum a set of CSR sparse matrices. |
|
|
|
|
|
Multiplies v by an exponentiated matrix. |
|
Computes "prepared" meta-info about matrix a, to be used in expm_multiply_fast. |
|
Returns "prepared" meta-info about operation op, which is assumed to be traceless (so no shift is needed). |
|
Find a matrix R such that u_inv R u0 is diagonal AND log(R) has no projection onto the commutant of G0. |
|
If adjoint=False, then return m.T.conj() @ m, computed in a more efficient way. |
|
Computes the indices of the linearly-independent columns in a matrix. |
|
Return the orthogonal projector onto range(mx), for mx proportional to a projector. |
|
Compute the partity of x. |
|
TODO: docstring |
|
Test whether mx is a hermitian matrix. |
|
Test whether mx is a positive-definite matrix. |
|
Test whether mx is an orthogonal projector, i.e. Hermitian and idempotent. |
|
Test whether mx is a valid density matrix (hermitian, positive-definite, and unit trace). |
|
TODO: docstring |
|
Compute the matrix s = sign(m). |
|
Matches the elements of two vectors, a and b by minimizing the weight between them. |
|
Matches the elements of a and b, whose elements are assumed to either real or one-half of a conjugate pair. |
|
Generate a "pretty-format" string for a matrix. |
|
Generate a "pretty-format" string for a complex-valued matrix. |
|
Get the base memory object for numpy array a. |
|
Construct the logarithm of superoperator matrix m that is near the identity. |
|
Computes the nullspace of a matrix, and tries to return a "nice" basis for it. |
|
Returns the Schatten 1-norm of a matrix |
|
The Hermitian 1-to-1 norm of a superoperator represented in the standard basis. |
|
Normalizes the columns of a matrix. |
|
Compute the nullspace of a matrix. |
|
Compute the nullspace of a matrix using the QR decomposition. |
Return the matrix "pinv_m" so m @ pinvm and pinv_m @ m are orthogonal projectors onto subspaces of dimension rank(m). |
|
|
m_fixed and m have the same number of rows. |
GCD algorithm to produce prime factors of n |
|
|
Print matrix in pretty format. |
|
Project mx onto the complement of kite, so mx is zero everywhere on the kite. |
|
Project mx onto kite, so mx is zero everywhere except on the kite. |
|
Generates a random Hermitian matrix |
|
Construct a real logarithm of real matrix m. |
|
Get the frobenius norm of a matrix or vector, a, when it is either a dense array or a sparse matrix. |
|
Computes the 1-norm of the dense or sparse matrix a. |
|
Scale each column of a matrix by a given value. |
|
Change the signs of the columns of Q and rows of R to follow a convention. |
|
Similar to numpy.eig, but returns sorted output. |
|
Checks whether two Scipy sparse matrices are (almost) equal. |
Computes the 1-norm of the scipy sparse matrix a. |
|
|
|
|
Compute the scaling factor required to turn a scalar multiple of a unitary matrix to a unitary matrix. |
|
TODO: docstring |
|
Construct the logarithm of superoperator matrix m. |
|
Stacks the columns of a matrix to return a vector |
|
Fills a dense array with the super-ket representation of a computational basis state. |
|
Construct the dense operator or superoperator representation of a computational basis state. |
Classes
A representation of the identity operator on any and all vector spaces. |
|
|