pfapack.pfaffian module¶
A package for computing Pfaffians
-
pfapack.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)
-
pfapack.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)
-
pfapack.pfaffian.
pfaffian
(A, overwrite_a=False, method='P')[source]¶ 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’)
-
pfapack.pfaffian.
pfaffian_LTL
(A, overwrite_a=False)[source]¶ 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.
-
pfapack.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().
-
pfapack.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().
-
pfapack.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).
-
pfapack.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)