Skip to content

geope.lie.pauli_projector¤

geope.lie.pauli_projector.project_omegas(x, basis, dim) ¤

Project a batch of matrices onto a Lie algebra basis.

Computes the trace inner product of each matrix in x with each basis element, normalised by the Hilbert-space dimension.

Parameters:

Name Type Description Default
x Array

Array of matrices to project, with shape (N, d, d).

required
basis Array

Basis tensor Array of shape (K, d, d).

required
dim int

Hilbert-space dimension \(d\).

required

Returns:

Type Description
Array

Real Array of shape (N, K) of projected coefficients.

geope.lie.pauli_projector.get_project_omegas_fn(basis) ¤

Create a partial projection function with a fixed basis.

Parameters:

Name Type Description Default
basis Basis

A Basis instance whose matrices and dimension are bound.

required

Returns:

Type Description
Callable[[Array], Array]

A Callable[[Array], Array] that accepts an array of

Callable[[Array], Array]

matrices and returns the projected coefficients.

geope.lie.pauli_projector.get_kron_chain(n) ¤

Build a JIT-compiled Kronecker product chain function.

Constructs the four single-qubit Pauli matrices and returns a function that builds an \(n\)-qubit Pauli string via iterated Kronecker products.

Parameters:

Name Type Description Default
n int

Number of qubits.

required

Returns:

Type Description
Callable[[Array], Array]

A JIT-compiled Callable[[Array], Array] that accepts a

Callable[[Array], Array]

combination index array of length n (values 0–3) and

Callable[[Array], Array]

returns the corresponding (2^n, 2^n) Pauli matrix.

geope.lie.pauli_projector.get_project_omegas_fn_otf(basis, batch_size=None) ¤

Create an on-the-fly omega projection function.

Instead of storing the full basis in memory, Pauli strings are constructed on the fly via Kronecker products. Useful when the number of qubits exceeds 5.

Parameters:

Name Type Description Default
basis Basis

A Basis instance (only basis.n is used).

required
batch_size int | None

Optional number of batches to split the Pauli combinations into. If None, a single vmap is used.

None

Returns:

Type Description
Callable[[Array], Array]

A vmapped Callable[[Array], Array] that accepts a batch

Callable[[Array], Array]

of matrices and returns projected coefficients.