Skip to content

Gell-Mann matrix

numqi.gellmann

numqi.gellmann.gellmann_matrix(i, j, d)

get the Gell-Mann matrix wiki-link/Gell-Mann-matrices wiki-link/Generalizations-of-Pauli-matrices github-link/CQuIC/pysme arxiv-link/0806.1174

normalization condition: Tr(Mi Mj)=2 delta_ij

Parameters:

Name Type Description Default
i int

row indices of Gell-Mann matrix, 0<=i<d

required
j int

column indices of Gell-Mann matrix, 0<=j<d

required
d int

dimension of Gell-Mann matrix

required

Returns:

Name Type Description
ret ndarray

Gell-Mann matrix. if i<j, Pauli-X like; if i>j, Pauli-Y like; if i=j=0, identity; if i=j>0, Pauli-Z like

numqi.gellmann.all_gellmann_matrix(d, /, tensor_n=1, with_I=True)

get all Gell-Mann matrices

Parameters:

Name Type Description Default
d int

dimension of Gell-Mann matrix

required
tensor_n int

tensor product of Gell-Mann matrices

1
with_I bool

include identity matrix or not. if True, the last item is identity matrix.

True

Returns:

Name Type Description
ret ndarray

Gell-Mann matrices. Ordering: PauliX, PauliY, PauliZ, I. if tensor_n=1, shape=(d2, d, d); if tensor_n>1, shape=(d(2n), dn, dn)

numqi.gellmann.matrix_to_gellmann_basis(A)

convert a matrix to Gell-Mann basis

ordering: PauliX, PauliY, PauliZ, I

Parameters:

Name Type Description Default
A (ndarray, Tensor)

matrix, support batch, shape=(...,d,d)

required

Returns:

Name Type Description
ret (ndarray, Tensor)

vector in Gell-Mann basis, shape=(...,d**2)

numqi.gellmann.gellmann_basis_to_matrix(vec)

convert a vector in Gell-Mann basis to a matrix

ordering: PauliX, PauliY, PauliZ, I

Parameters:

Name Type Description Default
vec (ndarray, Tensor)

vector in Gell-Mann basis, shape=(...,d**2)

required

Returns:

Name Type Description
ret (ndarray, Tensor)

matrix, shape=(...,d,d)

numqi.gellmann.dm_to_gellmann_basis(dm, with_rho0=False)

convert density matrix to a vector in Gell-Mann basis

Parameters:

Name Type Description Default
dm (ndarray, Tensor)

density matrix, 2d array (support batch)

required
with_rho0 bool

include rho0 or not. if True, the last item is not included.

False

Returns:

Name Type Description
ret (ndarray, Tensor)

real vector in Gell-Mann basis, shape=(...,d**2-1) if with_rho0=False, otherwise shape=(...,d**2)

numqi.gellmann.gellmann_basis_to_dm(vec)

convert vector in Gell-Mann basis to a density matrix

Parameters:

Name Type Description Default
vec (ndarray, Tensor)

vector in Gell-Mann basis, shape=(...,d**2-1)

required

Returns:

Name Type Description
ret (ndarray, Tensor)

density matrix, shape=(...,d,d)

numqi.gellmann.dm_to_gellmann_norm(dm)

get the norm of a density matrix in Gell-Mann basis, For traceless hermitian matrix, the norm is the Frobenius norm divided by sqrt(2)

Parameters:

Name Type Description Default
dm ndarray

density matrix, 2d array (support batch)

required

Returns:

Name Type Description
ret ndarray

norm of dm

numqi.gellmann.get_density_matrix_distance2(rho, sigma)

Get the distance between two density matrices in Gell-Mann basis. Equivalent to the Frobenius distance over 2.

Parameters:

Name Type Description Default
rho ndarray

density matrix, 2d array

required
sigma ndarray

density matrix, 2d array

required

Returns:

Name Type Description
ret float

distance