Reference

Core Functions

quantum_mereology.partition(H, DA, verbose=False, maxiter=1000, x0=None)View on GitHub

Partition a Hamiltonian into two subsystems.

Parameters

Hnumpy.ndarray

Hamiltonian matrix to partition.

DAint

Dimension of subsystem A.

verbosebool, optional

Whether to display optimization progress, by default False.

maxiterint, optional

Maximum number of iterations for optimization, by default 1000.

x0numpy.ndarray, optional

Initial guess for optimization parameters, by default None.

Returns

PartitionResult namedtuple containing: - U: Unitary matrix that partition H - EA: Eigenvalues of subsystem A - EB: Eigenvalues of subsystem B - Eint: Interaction term

Notes

The Hamiltonian must be a square matrix with dimension divisible by DA.

quantum_mereology.localize(H, taus, maxiter=200, verbose=False, x0=None)View on GitHub

Find a unitary transformation that maps H to a linear combination of pauli strings taus.

Parameters

Hnumpy.ndarray

The Hamiltonian matrix to localize.

tauslist of scipy.sparse.coo_matrix

List of Pauli strings in sparse format.

maxiterint, optional

Maximum number of iterations for the optimization. Default is 200.

verbosebool, optional

Whether to print progress during optimization. Default is False.

x0numpy.ndarray, optional

Initial guess for the optimization parameters.

Returns

LocalizeResult

A named tuple containing: - U: A unitary matrix that localizes H - Hloc: The localized Hamiltonian: a linear combination of taus - h: The coefficients of Hloc in the taus basis

Notes

This function attempts to find a unitary transformation that makes the Hamiltonian as local as possible by constructing a linear combination of taus that has the same eigenvalues as H. Ref : https://www.pnas.org/doi/abs/10.1073/pnas.2308006120

Random Matrices

quantum_mereology.GOE(D)View on GitHub

Generates a random matrix from the Gaussian Orthogonal Ensemble (GOE).

Parameters:

Dint

Dimension of the square matrix.

Returns:

H : ndarray

quantum_mereology.GUE(D)View on GitHub

Generates a random matrix from the Gaussian Unitary Ensemble (GUE).

Parameters:

Dint

Dimension of the square matrix.

Returns:

H : ndarray

Pauli strings

quantum_mereology.local1(N, dtype='float64')View on GitHub

Generate a list of 1-local Pauli strings of N qubits.

Parameters

Nint

Number of qubits.

dtypestr, optional

Data type for the operators. Use ‘complex128’ for complex operators, ‘float64’ for real operators. Default is ‘float64’.

Returns

list

List of 1-local Pauli string operators as sparse matrices.

Notes

If dtype=’float64’, complex strings (those with a Y operator) are excluded.

quantum_mereology.local2(N, dtype='float64')View on GitHub

Generate a list of 2-local Pauli strings of N qubits.

Parameters

Nint

Number of qubits.

dtypestr, optional

Data type for the operators. Use ‘complex128’ for complex operators, ‘float64’ for real operators. Default is ‘float64’.

Returns

list

List of 2-local Pauli string operators as sparse matrices.

Notes

If dtype=’float64’, complex strings (those with a single Y operator) are excluded.

quantum_mereology.buildH(taus, h)View on GitHub

Build a Hamiltonian from a list of pauli strings and coefficients. Return sum_i h_i * tau_i

Parameters

tauslist

List of operators (as scipy.sparse.coo_matrix).

harray_like

Coefficients for each operator.

Returns

numpy.ndarray

The Hamiltonian matrix constructed as the weighted sum of operators.

Notes

This function efficiently computes the Hamiltonian as: H = sum_i h_i * tau_i where h_i are the coefficients and tau_i are the operators.