Inverse Participation Ratio (quanguru.QuantumToolbox.IPR)#

Contains functions to calculate delocalisation measure (Inverse participation ratio, shortly IPR) in various cases.

Functions#

iprKet(basis, ket)

Calculates inverse participation ratio \(1/(\sum_{i}|c_{i,k}|^{4})\) of a ket \(|k\rangle = \sum_{i}c_{i,k}|i\rangle\) in a given basis \(\{|i\rangle\}\).

iprKetNB(ket)

Calculates the IPR \(1/\sum_{i}|c_{i,k}|^{4}\) of a ket \(|k\rangle := \begin{bmatrix} c_{1,k} \\ \vdots \\ c_{i,k} \\ \vdots \\c_{\mathcal{D},k} \end{bmatrix}_{\mathcal{D}\times 1}\) by using each entry \(c_{i,k}\) as a complex amplitude.

Function Name

Docstrings

Examples

Unit Tests

Tutorials

iprKet

      ✅

    ✅

    ❌

    ❌

iprKetNB

      ✅

    ✅

    ❌

    ❌

iprKet(basis: List[spmatrix | ndarray], ket: spmatrix | ndarray) float[source]#

Calculates inverse participation ratio \(1/(\sum_{i}|c_{i,k}|^{4})\) of a ket \(|k\rangle = \sum_{i}c_{i,k}|i\rangle\) in a given basis \(\{|i\rangle\}\). The complex probability amplitudes satisfy \(\sum_{i}|c_{i,k}|^{2} = 1\), therefore IPR = 1 is perfectly localised, and IPR = \(1/\mathcal{D}\) is uniformly localised in \(\mathcal{D}\) dimensional space.

Parameters:
  • basis (matrixList) – a ket state

  • ket (Matrix) – a complete basis

Returns:

inverse participation ratio

Return type:

float

Examples

>>> completeBasis = completeBasis(dimension=2)
>>> state0 = normalise(0.2*basis(2, 0) + 0.8*basis(2,1))
>>> iprKet(completeBasis, state0)
1.1245136186770428
>>> state1 = normalise(0.5*basis(2, 0) + 0.5*basis(2,1))
>>> iprKet(completeBasis, state1)
2.000000000000001
>>> state2 = basis(2,1)
>>> iprKet(completeBasis, state2)
1.0
iprKetNB(ket: spmatrix | ndarray) float[source]#

Calculates the IPR \(1/\sum_{i}|c_{i,k}|^{4}\) of a ket \(|k\rangle := \begin{bmatrix} c_{1,k} \\ \vdots \\ c_{i,k} \\ \vdots \\c_{\mathcal{D},k} \end{bmatrix}_{\mathcal{D}\times 1}\) by using each entry \(c_{i,k}\) as a complex amplitude.

Parameters:

ket (Matrix) – a ket state

Returns:

inverse participation ratio

Return type:

float

Examples

>>> state0 = normalise(0.2*basis(2, 0) + 0.8*basis(2,1))
>>> iprKetNB(state0)
1.1245136186770428
>>> state1 = normalise(0.5*basis(2, 0) + 0.5*basis(2,1))
>>> iprKetNB(state1)
2.000000000000001
>>> state2 = basis(2,1)
>>> iprKetNB(state2)
1.0
>>> state3 = basis(2,0)
>>> iprKetNB(state3)
1.0
iprMatrix(mat1: spmatrix | ndarray, mat2: spmatrix | ndarray) float[source]#

Calculates the IPR between two matrices \(1/\sum_{n, m}|\langle \psi_{n}|\Phi_{m}\rangle|^{4}\) where \(\langle \psi_{n}|\) is the nth eigenvector of the first matrix and :math:|Phi_{m}rangle` is the mth eigenvector of the second matrix :param mat1: a matrix (typically a unitary or hamiltonian) :type mat1: Matrix :param mat2: a matrix (typically a unitary or hamiltonian) :type mat2: Matrix

Returns:

inverse participation ratio

Return type:

float