PAOFLOW.topology.pfaffian#

pfaffian — Numerical computation of the Pfaffian for skew-symmetric matrices.

This module is a verbatim inclusion of the reference implementation by M. Wimmer [1], adapted for use as a PAOFLOW sub-module. It provides efficient routines for computing the Pfaffian and for reducing a skew-symmetric matrix to tridiagonal form.

Background#

For a \(2n \times 2n\) skew-symmetric matrix \(A = -A^T\), the Pfaffian is defined by

\[\operatorname{pf}(A) = \frac{1}{2^n n!} \sum_{\sigma \in S_{2n}} \operatorname{sgn}(\sigma) \prod_{i=1}^{n} a_{\sigma(2i-1),\sigma(2i)}\]

and satisfies \(\operatorname{pf}(A)^2 = \det(A)\). For odd-dimensional matrices the Pfaffian is defined to be zero.

In PAOFLOW the Pfaffian is used to compute the \(\mathbb{Z}_2\) topological invariant (time-reversal polarisation) as part of the topology() workflow.

Algorithms#

Three independent algorithms are implemented, providing cross-validation and flexibility for different use cases:

Parlett–Reid (default, method=’P’) — pfaffian_LTL()

Reduces \(A\) to block-tridiagonal form via the \(P A P^T = L T L^T\) decomposition (skew_LTL()) with column pivoting. Runs in \(O(n^3)\) time and is numerically stable for both real and complex matrices.

Householder tridiagonalisation (method=’H’) — pfaffian_householder()

Reduces \(A\) to skew-symmetric tridiagonal form via successive Householder reflections (householder_real() or householder_complex()). The Pfaffian is accumulated as the product of the super-diagonal elements of the tridiagonal factor. Also \(O(n^3)\).

Schur decomposition (real only) — pfaffian_schur()

Uses scipy.linalg.schur to reduce \(A\) to real Schur form \(A = Z T Z^T\); the Pfaffian is \(\det(Z)\prod_i t_{2i-1,2i}\). Does not exploit skew-symmetry but delegates to a LAPACK FORTRAN routine, making it only slightly slower than pfaffian_LTL() in practice.

Matrix-reduction utilities#

skew_tridiagonalize()

Orthogonal/unitary tridiagonalisation \(A = Q T Q^T\) via Householder reflections; optionally returns \(Q\).

skew_LTL()

Unit-lower-triangular factorisation \(P A P^T = L T L^T\) with partial pivoting; optionally returns \(L\) and the permutation matrix \(P\).

Householder primitives#

householder_real(), householder_complex()

Compute a Householder vector \(v\) and scalar \(\tau\) such that \((I - \tau v v^T) x = \alpha e_1\) for real and complex input vectors, respectively.

Reference#

Functions#

householder_real(x)

(v, tau, alpha) = householder_real(x)

householder_complex(x)

(v, tau, alpha) = householder_real(x)

skew_tridiagonalize(A[, overwrite_a, calc_q])

T, Q = skew_tridiagonalize(A, overwrite_a, calc_q=True)

skew_LTL(A[, overwrite_a, calc_L, calc_P])

T, L, P = skew_LTL(A, overwrite_a, calc_q=True)

pfaffian(A[, overwrite_a, method])

pfaffian(A, overwrite_a=False, method='P')

pfaffian_LTL(A[, overwrite_a])

pfaffian_LTL(A, overwrite_a=False)

pfaffian_householder(A[, overwrite_a])

pfaffian(A, overwrite_a=False)

pfaffian_schur(A[, overwrite_a])

Calculate Pfaffian of a real antisymmetric matrix using

Module Contents#

PAOFLOW.topology.pfaffian.householder_real(x)[source]#

(v, tau, alpha) = householder_real(x)

Compute a Householder transformation such that (1-tau v v^T) x = alpha e_1 where x and v a real vectors, tau is 0 or 2, and alpha a real number (e_1 is the first unit vector)

PAOFLOW.topology.pfaffian.householder_complex(x)[source]#

(v, tau, alpha) = householder_real(x)

Compute a Householder transformation such that (1-tau v v^T) x = alpha e_1 where x and v a complex vectors, tau is 0 or 2, and alpha a complex number (e_1 is the first unit vector)

PAOFLOW.topology.pfaffian.skew_tridiagonalize(A, overwrite_a=False, calc_q=True)[source]#

T, Q = skew_tridiagonalize(A, overwrite_a, calc_q=True)

or

T = skew_tridiagonalize(A, overwrite_a, calc_q=False)

Bring a real or complex skew-symmetric matrix (A=-A^T) into tridiagonal form T (with zero diagonal) with a orthogonal (real case) or unitary (complex case) matrix U such that A = Q T Q^T (Note that Q^T and not Q^dagger also in the complex case)

A is overwritten if overwrite_a=True (default: False), and Q only calculated if calc_q=True (default: True)

PAOFLOW.topology.pfaffian.skew_LTL(A, overwrite_a=False, calc_L=True, calc_P=True)[source]#

T, L, P = skew_LTL(A, overwrite_a, calc_q=True)

Bring a real or complex skew-symmetric matrix (A=-A^T) into tridiagonal form T (with zero diagonal) with a lower unit triangular matrix L such that P A P^T= L T L^T

A is overwritten if overwrite_a=True (default: False), L and P only calculated if calc_L=True or calc_P=True, respectively (default: True).

PAOFLOW.topology.pfaffian.pfaffian(A, overwrite_a=False, method='P')[source]#

pfaffian(A, overwrite_a=False, method=’P’)

Compute the Pfaffian of a real or complex skew-symmetric matrix A (A=-A^T). If overwrite_a=True, the matrix A is overwritten in the process. This function uses either the Parlett-Reid algorithm (method=’P’, default), or the Householder tridiagonalization (method=’H’)

PAOFLOW.topology.pfaffian.pfaffian_LTL(A, overwrite_a=False)[source]#

pfaffian_LTL(A, overwrite_a=False)

Compute the Pfaffian of a real or complex skew-symmetric matrix A (A=-A^T). If overwrite_a=True, the matrix A is overwritten in the process. This function uses the Parlett-Reid algorithm.

PAOFLOW.topology.pfaffian.pfaffian_householder(A, overwrite_a=False)[source]#

pfaffian(A, overwrite_a=False)

Compute the Pfaffian of a real or complex skew-symmetric matrix A (A=-A^T). If overwrite_a=True, the matrix A is overwritten in the process. This function uses the Householder tridiagonalization.

Note that the function pfaffian_schur() can also be used in the real case. That function does not make use of the skew-symmetry and is only slightly slower than pfaffian_householder().

PAOFLOW.topology.pfaffian.pfaffian_schur(A, overwrite_a=False)[source]#

Calculate Pfaffian of a real antisymmetric matrix using the Schur decomposition. (Hessenberg would in principle be faster, but scipy-0.8 messed up the performance for scipy.linalg.hessenberg()).

This function does not make use of the skew-symmetry of the matrix A, but uses a LAPACK routine that is coded in FORTRAN and hence faster than python. As a consequence, pfaffian_schur is only slightly slower than pfaffian().