lrux.slogpf#

lrux.slogpf(A: Array, *, method: str = 'householder') SlogpfResult#

Compute the sign and (natural) logarithm of the pfaffian of an array.

Parameters:
  • A – An array with shape (…, n, n)

  • method

    The method used to compute the pfaffian. Options include

    "householder":

    Houserholder transformation, internally using jax.lax.fori_loop to balance between running and compiling time;

    "householder_for":

    Houserholder transformation, internally using jitted python for loops to reduce the running time at a cost of much longer compiling time;

    "schur":

    Schur decomposition using jax.scipy.linalg.schur, but only available on CPU and real dtypes.

    The default method is "householder".

Returns:

A NamedTuple with the following attributes. Both attribtutes have the same batch dimension as the input A.

sign:

sign(A). For a real input, it’s 1, 0, or -1. For a complex input, it’s a complex number with absolute value 1, or else 0.

logabspf:

The natural log of the absolute value of the pfaffian.

Tip

The input A is always skew-symmetrized.

Tip

This function has jax.custom_jvp defined and is backward compatible for both real and complex dtypes.