qcheff.iswt.iswt

Module Contents

Classes

ExactIterativeSWT

Interface for the state machine encoding the iterative SWT algorithm.

NPADScipySparse

NPAD algorithm implemented with SciPy sparse matrices.

NPADCupySparse

NPAD algorithm implemented with CuPy sparse matrices.

API

class ExactIterativeSWT

Interface for the state machine encoding the iterative SWT algorithm.

H: qcheff.operators.OperatorMatrix

None

givens_sparse_backend_: types.ModuleType | None

None

copy: dataclasses.InitVar[bool]

‘field(…)’

abstractmethod givens_rotation_matrix(i: int, j: int) qcheff.operators.qcheff_sparse_array

Returns a sparse Givens rotation matrix for the coupling (i,j).

Parameters

i : int The first index of the coupling. j : int The second index of the coupling.

Returns

qcheff_sparse_array The sparse Givens rotation matrix.

unitary_transformation(U: qcheff.operators.qcheff_array) None

Apply a unitary transformation U to the Hamiltonian.

Parameters

U : qcheff_array The unitary transformation matrix.

eliminate_couplings(couplings: qcheff.operators.qcheff_dense_array) None

Eliminate the coupling between levels i and j using a Givens Rotation.

Parameters

couplings : qcheff_dense_array The array of couplings to eliminate.

eliminate_coupling(i: int, j: int) None

Eliminate the coupling between levels i and j using a Givens Rotation.

Parameters

i : int The first index of the coupling. j : int The second index of the coupling.

largest_couplings(n: int = 1)

Mark the largest coupling in the Hamiltonian.

Parameters

n : int, optional The number of largest couplings to return. Defaults to 1.

Returns

tuple The indices (i,j) of the largest coupling in the Hamiltonian.

class NPADScipySparse

Bases: qcheff.iswt.iswt.ExactIterativeSWT

NPAD algorithm implemented with SciPy sparse matrices.

Parameters

H : OperatorMatrix The Hamiltonian to be transformed.

Attributes

H : OperatorMatrix The Hamiltonian to be transformed.

Methods

givens_rotation_matrix(i, j) Returns a sparse Givens rotation matrix for the coupling (i,j). largest_couplings(n=1, levels=None) Mark the largest coupling in the Hamiltonian.

givens_rotation_matrix(i: int, j: int) qcheff.operators.qcheff_sparse_array

Returns a sparse Givens rotation matrix for the coupling (i,j).

Parameters

i : int The first index of the coupling. j : int The second index of the coupling.

Returns

qcheff_sparse_array The sparse Givens rotation matrix.

largest_couplings(n: int = 1, levels=None)

Mark the largest coupling in the Hamiltonian.

Parameters

n : int, optional The number of largest couplings to return. Defaults to 1. levels : array_like, optional The levels to consider when calculating the largest couplings.

Yields

tuple A tuple containing the indices (i,j) of the largest coupling and the Hamiltonian.

class NPADCupySparse

Bases: qcheff.iswt.iswt.ExactIterativeSWT

NPAD algorithm implemented with CuPy sparse matrices.

Parameters

H : OperatorMatrix The Hamiltonian to be transformed.

Attributes

H : OperatorMatrix The Hamiltonian to be transformed.

Methods

givens_rotation_matrix(i, j) Returns a sparse Givens rotation matrix for the coupling (i,j). largest_couplings(n=1, levels=None) Mark the largest coupling in the Hamiltonian.

givens_rotation_matrix(i: int, j: int) qcheff.operators.qcheff_sparse_array

Returns a sparse Givens rotation matrix for the coupling (i,j).

Parameters

i : int The first index of the coupling. j : int The second index of the coupling.

Returns

qcheff_sparse_array The sparse Givens rotation matrix.

largest_couplings(n: int = 1, levels=None)

Mark the largest coupling in the Hamiltonian.

Parameters

n : int, optional The number of largest couplings to return. Defaults to 1. levels : array_like, optional The levels to consider when calculating the largest couplings.

Yields

tuple A tuple containing the indices (i,j) of the largest coupling and the Hamiltonian.