Skip to content

matrix space

numerical range

numqi.matrix_space.get_matrix_numerical_range(matA, num_point=100)

get the numerical range of a square matrix A, A could be complex

\[W(A)=\left\{ x^{\dagger}Ax:x\in\mathbb{C}^{n},\lVert x\rVert_{2}=1\right\}\]

see arxiv-link appendix A

Parameters:

Name Type Description Default
matA ndarray

a square matrix, could be complex

required
num_point int

number of points to sample the numerical range

100

Returns:

Name Type Description
ret ndarray

a 1d array of length num_point, dtype is complex, the numerical range of matA

numqi.matrix_space.get_matrix_numerical_range_along_direction(matA, alpha, kind='max')

get the numerical range of a square matrix A along a direction alpha

\[W^{\alpha}\left(A\right)=\left\{ x\in\mathbb{R}:xe^{i\alpha}\in W\left(A\right)\right\}\]

This function might give wrong results especially when the numerical range is not smooth, In that case, a warning will be printed.

see arxiv-link appendix A

Parameters:

Name Type Description Default
matA ndarray

a square matrix, could be complex

required
alpha float

the direction to sample the numerical range, in radian

required
kind str

'max' or 'min', the maximum or minimum value along the direction

'max'

Returns:

Name Type Description
maximum float

the maximum value along the direction \(e^{i\alpha}\)

EVC ndarray

the eigenvector corresponding to the maximum value

numqi.matrix_space.get_real_bipartite_numerical_range(mat, kind='min', method='eigen')

get the real bipartite numerical range of a square matrix A

\[B\in\mathbb{R}^{mn\times mn},W^{x+iy}\left(B\right)=W^{\arctan y/x}\left(\frac{xB+iyB^{\Gamma}}{\sqrt{x^{2}+y^{2}}}\right)\]

where \(W^{\arctan y/x}(A)\) is the numerical range of \(A\) along the direction \(e^{i\arctan y/x}\), see numqi.matrix_space.get_matrix_numerical_range_along_direction()

see arxiv-link

Parameters:

Name Type Description Default
mat ndarray

4-dimensional numpy array of shape (dimA,dimB,dimA,dimB), must be real

required
kind str

'min' or 'max', the boundary of numerical range to compute

'min'
method str

'rotation' or 'eigen'. If 'rotation': use numqi.matrix_space.get_matrix_numerical_range_along_direction() to compute the numerical range. 'rotation' method might give wrong results, especially when numerical range is not smooth.

If 'eigen': (see theorem 2 in arxiv-link) use the eigenvalue decomposition to compute the numerical range. the matrix mat must be symmetric.

Two methods usually give the same output and one might be faster (TODO benchmark)

'eigen'

Returns:

Name Type Description
ret float

the boundary of the real bipartite numerical range

numqi.matrix_space.get_joint_algebraic_numerical_range(op_list, direction, return_info=False, use_tqdm=True)

get the joint algebraic numerical range (JANR) of a list of operators along a direction

\[ L(A_{1},A_{2},\cdots,A_{r})=\left\{ a\in\mathbb{C}^{r}:\rho\in\mathbb{C}^{d\times d},\rho\succeq0,\mathrm{Tr}[\rho]=1,a_{i}=\mathrm{Tr}[A_{i}\rho]\right\} \]
\[ \max\;\beta \]
\[ s.t.\;\begin{cases} \rho\succeq 0\\ \mathrm{Tr}[\rho]=1\\ \mathrm{Tr}[\rho A_{i}]=\beta\hat{n}_{i} & i=1,\cdots,m \end{cases} \]

Parameters:

Name Type Description Default
op_list list

a list of operators, each operator is a 2d numpy array

required
direction ndarrray

the boundary along the direction will be calculated, if 2d, then each row is a direction

required
return_info bool

if True, then return the boundary and the boundary's normal vector

False
use_tqdm bool

if True, then use tqdm to show the progress

True

Returns:

Name Type Description
beta ndarray

the distance from the origin to the boundary along the direction. If direction is 2d, then beta is 1d array.

boundary ndarray

the boundary along the direction. only returned if return_info is True

normal_vector ndarray

the normal vector of the boundary. only returned if return_info is True