hqs_spin_mapper.linear_algebraic_schrieffer_wolff

Routines for the linear algebraic type Schrieffer-Wolff transformation in C++.

Functions

compute_generator_from_krylov_solver(*args, ...)

Overloaded function.

compute_generator_from_pseudo_inverse(*args, ...)

Overloaded function.

construct_liouvilliain(*args, **kwargs)

Overloaded function.

extract_block_offdiagonal_hamiltonian(*args, ...)

Overloaded function.

get_fermion_spinful_expression(*args, **kwargs)

Overloaded function.

get_target_vector_representation(*args, **kwargs)

Overloaded function.

get_transformed_hamiltonian(*args, **kwargs)

Overloaded function.

initialize_operator_vector_space(*args, **kwargs)

Overloaded function.

linear_algebraic_schrieffer_wolff(*args, ...)

Overloaded function.

schrieffer_wolff(*args, **kwargs)

Overloaded function.

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.compute_generator_from_krylov_solver(*args, **kwargs)

Overloaded function.

  1. compute_generator_from_krylov_solver(liouvilliain: scipy.sparse.csc_matrix[numpy.float64], prefactors: list[float], threshold_: float, max_dimension_: int, convergence_limit_: float) -> numpy.ndarray[numpy.float64[m, 1]]

Calculate the generator of the Schrieffer-Wolff transformation from the pseudo inverse of the Liouvilliain

Args:

liouvilliain (TpSpMatrix_csr): Sparse matrix representation of the Liouvilliain [H_0, .] prefactors (List[float64]): Prefactors of the block-offdiagonal Hamiltonian in the operators vector space threshold_ (float64): Threshold below which to cut the singular values max_dimension_ (int): Maximum dimension of the vector space convergence_limit_ (float64): Accuracy at which to stop the Gram-Schmidt procedure

Returns:

TpVector: Generator of the transformation

  1. compute_generator_from_krylov_solver(liouvilliain: scipy.sparse.csc_matrix[numpy.complex128], prefactors: list[complex], threshold_: float, max_dimension_: int, convergence_limit_: float) -> numpy.ndarray[numpy.complex128[m, 1]]

Calculate the generator of the Schrieffer-Wolff transformation from the pseudo inverse of the Liouvilliain

Args:

liouvilliain (TpSpMatrix_csr): Sparse matrix representation of the Liouvilliain [H_0, .] prefactors (List[np.complex]): Prefactors of the block-offdiagonal Hamiltonian in the operators vector space threshold_ (float64): Threshold below which to cut the singular values max_dimension_ (int): Maximum dimension of the vector space convergence_limit_ (float64): Accuracy at which to stop the Gram-Schmidt procedure

Returns:

TpVector: Generator of the transformation

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.compute_generator_from_pseudo_inverse(*args, **kwargs)

Overloaded function.

  1. compute_generator_from_pseudo_inverse(liouvilliain: scipy.sparse.csc_matrix[numpy.float64], prefactors: list[float], initial_dimension: int) -> numpy.ndarray[numpy.float64[m, 1]]

Calculate the generator of the Schrieffer-Wolff transformation from the pseudo inverse of the Liouvilliain

Args:

liouvilliain (TpSpMatrix_csr): Sparse matrix representation of the Liouvilliain [H_0, .] prefactors (List[float64]): Prefactors of the block-offdiagonal Hamiltonian in the operators vector space initial_dimension (int): Initial dimension of the vector space

Returns:

TpVector: Generator of the transformation

  1. compute_generator_from_pseudo_inverse(liouvilliain: scipy.sparse.csc_matrix[numpy.complex128], prefactors: list[complex], initial_dimension: int) -> numpy.ndarray[numpy.complex128[m, 1]]

Calculate the generator of the Schrieffer-Wolff transformation from the pseudo inverse of the Liouvilliain

Args:

liouvilliain (TpSpMatrix_csr): Sparse matrix representation of the Liouvilliain [H_0, .] prefactors (List[float64]): Prefactors of the block-offdiagonal Hamiltonian in the operators vector space initial_dimension (int): Initial dimension of the vector space

Returns:

TpVector: Generator of the transformation

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.construct_liouvilliain(*args, **kwargs)

Overloaded function.

  1. construct_liouvilliain(vector_space: lattice_functions.Fermions.IndexSpinful, h0: lattice_functions.Fermions.ExpressionSpinful, spins: set[int], initial_dimension: int, number_bath_operators_for_contraction: int, _vector_space_cap: int, rdm1_uu: Optional[numpy.ndarray[numpy.float64[m, 1], flags.writeable]] = None, rdm1_dd: Optional[numpy.ndarray[numpy.float64[m, 1], flags.writeable]] = None, rdm1_ud: Optional[numpy.ndarray[numpy.float64[m, 1], flags.writeable]] = None) -> tuple[scipy.sparse.csc_matrix[numpy.float64], int, int]

Construct a sparse matrix representation of the Liouvilliain [H_0, .]

Args:

vector_space (FermionsSpinfulIndex): Index of the operator vector space h0 (ExpressionSpinful): Block-diagonal Hamiltonian spins (Set[int]): Set containing the indices of the spin-orbitals initial_dimension (int): Initial dimension of the vector space number_bath_operators_for_contraction (int): Number of bath operators necessary for contraction _vector_space_cap (int): Limit for the size of the vector space rdm1_uu (Optional[np.array]): 1RDM for spin up-up electrons rdm1_dd (Optional[np.array]): 1RDM for spin down-down electrons rdm1_ud (Optional[np.array]): 1RDM for spin up-down electrons

Returns:

TpSpMatrix_csr: Liouvilliain int: Number of rows int: Number of columns

  1. construct_liouvilliain(vector_space: lattice_functions.Fermions.IndexSpinful, h0: lattice_functions.Fermions.ExpressionSpinful_complex, spins: set[int], initial_dimension: int, number_bath_operators_for_contraction: int, _vector_space_cap: int, rdm1_uu: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None, rdm1_dd: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None, rdm1_ud: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None) -> tuple[scipy.sparse.csc_matrix[numpy.complex128], int, int]

Construct a sparse matrix representation of the Liouvilliain [H_0, .]

Args:

vector_space (FermionsSpinfulIndex): Index of the operator vector space h0 (ExpressionSpinful): Block-diagonal Hamiltonian spins (Set[int]): Set containing the indices of the spin-orbitals initial_dimension (int): Initial dimension of the vector space number_bath_operators_for_contraction (int): Number of bath operators necessary for contraction _vector_space_cap (int): Limit for the size of the vector space rdm1_uu (Optional[np.array]): 1RDM for spin up-up electrons rdm1_dd (Optional[np.array]): 1RDM for spin down-down electrons rdm1_ud (Optional[np.array]): 1RDM for spin up-down electrons

Returns:

TpSpMatrix_csr: Liouvilliain int: Number of rows int: Number of columns

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.extract_block_offdiagonal_hamiltonian(*args, **kwargs)

Overloaded function.

  1. extract_block_offdiagonal_hamiltonian(original_hamiltonian: lattice_functions.Fermions.ExpressionSpinful, spins: set[int], prefactor_cutoff: float) -> lattice_functions.Fermions.ExpressionSpinful

Separate the Hamiltonian into block-diagonal and block-offdiagonal component

Args:

original_hamiltonian (ExpressionSpinful): Expression for the full Hamiltonian that is to be transformed spins (Set[int]): Set containing the indices of the spin-orbitals prefactor_cutoff (float64): Discard terms from the Hamiltonian with prefactor smaller than this cutoff

Returns:

ExpressionSpinful: Block-offdiagonal component of the Hamiltonian

  1. extract_block_offdiagonal_hamiltonian(original_hamiltonian: lattice_functions.Fermions.ExpressionSpinful_complex, spins: set[int], prefactor_cutoff: float) -> lattice_functions.Fermions.ExpressionSpinful_complex

Separate the Hamiltonian into block-diagonal and block-offdiagonal component

Args:

original_hamiltonian (ExpressionSpinful): Expression for the full Hamiltonian that is to be transformed spins (Set[int]): Set containing the indices of the spin-orbitals prefactor_cutoff (float64): Discard terms from the Hamiltonian with prefactor smaller than this cutoff

Returns:

ExpressionSpinful: Block-offdiagonal component of the Hamiltonian

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.get_fermion_spinful_expression(*args, **kwargs)

Overloaded function.

  1. get_fermion_spinful_expression(H0_uu: numpy.ndarray[numpy.float64[m, n], flags.writeable], H0_dd: numpy.ndarray[numpy.float64[m, n], flags.writeable], H0_ud: numpy.ndarray[numpy.float64[m, n], flags.writeable], HU: numpy.ndarray[numpy.float64[m, 1], flags.writeable], spins: set[int]) -> lattice_functions.Fermions.ExpressionSpinful

Return the ExpressionSpinful corresponding to the Hamiltonian

Args:

H0_uu (np.ndarray): Quadratic Hamiltonian for spin-up, spin-up, H0_dd (np.ndarray): Quadratic Hamiltonian for spin-down, spin-down, H0_ud (np.ndarray): Quadratic Hamiltonian for spin-up, spin-down”, HU (np.ndarray): Density-density terms as a flattened vector spins (Set[int]): Set of spin site indices

Returns:

ExpressionSpinful: ExpressionSpinful for the original Hamiltonian

  1. get_fermion_spinful_expression(H0_uu: numpy.ndarray[numpy.complex128[m, n], flags.writeable], H0_dd: numpy.ndarray[numpy.complex128[m, n], flags.writeable], H0_ud: numpy.ndarray[numpy.complex128[m, n], flags.writeable], HU: numpy.ndarray[numpy.complex128[m, 1], flags.writeable], spins: set[int]) -> lattice_functions.Fermions.ExpressionSpinful_complex

Return the ExpressionSpinful corresponding to the Hamiltonian

Args:

H0_uu (np.ndarray): Quadratic Hamiltonian for spin-up, spin-up, H0_dd (np.ndarray): Quadratic Hamiltonian for spin-down, spin-down, H0_ud (np.ndarray): Quadratic Hamiltonian for spin-up, spin-down”, HU (np.ndarray): Density-density terms as a flattened vector spins (Set[int]): Set of spin site indices

Returns:

ExpressionSpinful: ExpressionSpinful for the original Hamiltonian

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.get_target_vector_representation(*args, **kwargs)

Overloaded function.

  1. get_target_vector_representation(prefactors: list[float], size: int) -> numpy.ndarray[numpy.float64[m, 1]]

Return vector representation of the block-offdiagonal Hamiltonian in the operator vector space

Args:

prefactor (List[float64]): Prefactors of the block-offdiagonal Hamiltonian in the operators vector space size (int): Length of the vector

Returns:

TpVector: Vector representation of the block-offdiagonal Hamiltonian

  1. get_target_vector_representation(prefactors: list[complex], size: int) -> numpy.ndarray[numpy.complex128[m, 1]]

Return vector representation of the block-offdiagonal Hamiltonian in the operator vector space

Args:

prefactor (List[np.complex]): Prefactors of the block-offdiagonal Hamiltonian in the operators vector space size (int): Length of the vector

Returns:

TpVector: Vector representation of the block-offdiagonal Hamiltonian

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.get_transformed_hamiltonian(*args, **kwargs)

Overloaded function.

  1. get_transformed_hamiltonian(vector_space: lattice_functions.Fermions.IndexSpinful, h0: lattice_functions.Fermions.ExpressionSpinful, liouvilliain: scipy.sparse.csc_matrix[numpy.float64], generator: numpy.ndarray[numpy.float64[m, 1]], prefactors: list[float], precision: float, initial_dimension: int, number_cols: int) -> lattice_functions.Fermions.ExpressionSpinful

Return Schrieffer-Wolff transformation of the Hamiltonian

Args:

vector_space (FermionsSpinfulIndex): Index of the operator vector space h0 (ExpressionSpinful): Block-offdiagonal Hamiltonian component generator (TpVector): Vector representation of the generator prefactors (List[float64]): Prefactors of the block-offdiagonal Hamiltonian in the vector space precision (float64): Precision for the evaluation of the commutators initial_dimension (int): Initial dimension of the vector space number_cols (int): Number of columns of the Liouvilliain

Returns:

ExpressionSpinful: Transformed Hamiltonian ExpressionSpinful: Generator of the transformation

  1. get_transformed_hamiltonian(vector_space: lattice_functions.Fermions.IndexSpinful, h0: lattice_functions.Fermions.ExpressionSpinful_complex, liouvilliain: scipy.sparse.csc_matrix[numpy.complex128], generator: numpy.ndarray[numpy.complex128[m, 1]], prefactors: list[complex], precision: float, initial_dimension: int, number_cols: int) -> lattice_functions.Fermions.ExpressionSpinful_complex

Return Schrieffer-Wolff transformation of the Hamiltonian

Args:

vector_space (FermionsSpinfulIndex): Index of the operator vector space h0 (ExpressionSpinful): Block-offdiagonal Hamiltonian component generator (TpVector): Vector representation of the generator prefactors (List[np.complex]): Prefactors of the block-offdiagonal Hamiltonian in the vector space precision (float64): Precision for the evaluation of the commutators initial_dimension (int): Initial dimension of the vector space number_cols (int): Number of columns of the Liouvilliain

Returns:

ExpressionSpinful: Transformed Hamiltonian ExpressionSpinful: Generator of the transformation

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.initialize_operator_vector_space(*args, **kwargs)

Overloaded function.

  1. initialize_operator_vector_space(v: lattice_functions.Fermions.ExpressionSpinful, spins: set[int]) -> tuple[lattice_functions.Fermions.IndexSpinful, list[float]]

Initialize the operator vector space with the unique (identity-expanded) operators in v

Args:

v (ExpressionSpinful): Block-offdiagonal component of the Hamiltonian spins (Set[int]): Set containing the indices of the spin-orbitals

Returns:

FermionsSpinfulIndex: Index of the operator vector space List[float64]: Prefactors of v in the vector space

  1. initialize_operator_vector_space(v: lattice_functions.Fermions.ExpressionSpinful_complex, spins: set[int]) -> tuple[lattice_functions.Fermions.IndexSpinful, list[complex]]

Initialize the operator vector space with the unique (identity-expanded) operators in v

Args:

v (ExpressionSpinful): Block-offdiagonal component of the Hamiltonian spins (Set[int]): Set containing the indices of the spin-orbitals

Returns:

FermionsSpinfulIndex: Index of the operator vector space List[np.complex]: Prefactors of v in the vector space

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.linear_algebraic_schrieffer_wolff(*args, **kwargs)

Overloaded function.

  1. linear_algebraic_schrieffer_wolff(hamiltonian: lattice_functions.Fermions.ExpressionSpinful, spins: set[int], prefactor_cutoff: float, number_bath_operators_for_contraction: int, _vector_space_cap: int, _max_krylov_space_dimension: int, rdm1_uu: Optional[numpy.ndarray[numpy.float64[m, n], flags.writeable]] = None, rdm1_dd: Optional[numpy.ndarray[numpy.float64[m, n], flags.writeable]] = None, rdm1_ud: Optional[numpy.ndarray[numpy.float64[m, n], flags.writeable]] = None) -> tuple[lattice_functions.Fermions.ExpressionSpinful, lattice_functions.Fermions.ExpressionSpinful]

Perform Schrieffer-Wolff transformation

Args:

hamiltonian (ExpressionSpinful): Complete Hamiltonian of the system spins (Set[int]): Set of spin site indices prefactor_cutoff (float64): Cutoff for the prefactors below which terms are discarded number_bath_operators_for_contraction (int): Number of bath operators necessary for contraction _vector_space_cap (int): Limit for the size of the vector space _max_krylov_space_dimension (int): Maximum size of the Krylov subspace of the solver rdm1_uu (Optional[np.array]): 1RDM for spin up-up electrons rdm1_dd (Optional[np.array]): 1RDM for spin down-down electrons rdm1_ud (Optional[np.array]): 1RDM for spin up-down electrons

Returns:

ExpressionSpinful: Transformed Hamiltonian ExpressionSpinful: Generator of the transformation

  1. linear_algebraic_schrieffer_wolff(hamiltonian: lattice_functions.Fermions.ExpressionSpinful_complex, spins: set[int], prefactor_cutoff: float, number_bath_operators_for_contraction: int, _vector_space_cap: int, _max_krylov_space_dimension: int, rdm1_uu: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None, rdm1_dd: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None, rdm1_ud: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None) -> tuple[lattice_functions.Fermions.ExpressionSpinful_complex, lattice_functions.Fermions.ExpressionSpinful_complex]

Perform Schrieffer-Wolff transformation

Args:

hamiltonian (ExpressionSpinful): Complete Hamiltonian of the system spins (Set[int]): Set of spin site indices prefactor_cutoff (float64): Cutoff for the prefactors below which terms are discarded number_bath_operators_for_contraction (int): Number of bath operators necessary for contraction _vector_space_cap (int): Limit for the size of the vector space _max_krylov_space_dimension (int): Maximum size of the Krylov subspace of the solver rdm1_uu (Optional[np.array]): 1RDM for spin up-up electrons rdm1_dd (Optional[np.array]): 1RDM for spin down-down electrons rdm1_ud (Optional[np.array]): 1RDM for spin up-down electrons

Returns:

ExpressionSpinful: Transformed Hamiltonian ExpressionSpinful: Generator of the transformation

hqs_spin_mapper.linear_algebraic_schrieffer_wolff.schrieffer_wolff(*args, **kwargs)

Overloaded function.

  1. schrieffer_wolff(H0_uu: numpy.ndarray[numpy.float64[m, n], flags.writeable], H0_dd: numpy.ndarray[numpy.float64[m, n], flags.writeable], H0_ud: numpy.ndarray[numpy.float64[m, n], flags.writeable], HU: numpy.ndarray[numpy.float64[m, 1], flags.writeable], spins: set[int], prefactor_cutoff: float, number_bath_operators_for_contraction: int, _vector_space_cap: int, _max_krylov_space_dimension: int, rdm1_uu: Optional[numpy.ndarray[numpy.float64[m, n], flags.writeable]] = None, rdm1_dd: Optional[numpy.ndarray[numpy.float64[m, n], flags.writeable]] = None, rdm1_ud: Optional[numpy.ndarray[numpy.float64[m, n], flags.writeable]] = None) -> tuple[lattice_functions.Fermions.ExpressionSpinful, lattice_functions.Fermions.ExpressionSpinful]

Self-contained Schrieffer-Wolff transformation for use in separate package.

Args:

H0_uu (np.ndarray): Quadratic Hamiltonian for spin-up, spin-up, H0_dd (np.ndarray): Quadratic Hamiltonian for spin-down, spin-down, H0_ud (np.ndarray): Quadratic Hamiltonian for spin-up, spin-down”, HU (np.ndarray): Density-density terms as a flattened vector spins (Set[int]): Set of spin site indices prefactor_cutoff (float64): Cutoff for the prefactors below which terms are discarded number_bath_operators_for_contraction (int): Number of bath operators necessary for contraction _vector_space_cap (int): Limit for the size of the vector space _max_krylov_space_dimension (int): Maximum size of the Krylov subspace of the solver rdm1_uu (Optional[np.array]): 1RDM for spin up-up electrons rdm1_dd (Optional[np.array]): 1RDM for spin down-down electrons rdm1_ud (Optional[np.array]): 1RDM for spin up-down electrons

Returns:

ExpressionSpinful: Schrieffer-Wolff transformed Hamiltonian ExpressionSpinful: Generator of the transformation

  1. schrieffer_wolff(H0_uu: numpy.ndarray[numpy.complex128[m, n], flags.writeable], H0_dd: numpy.ndarray[numpy.complex128[m, n], flags.writeable], H0_ud: numpy.ndarray[numpy.complex128[m, n], flags.writeable], HU: numpy.ndarray[numpy.complex128[m, 1], flags.writeable], spins: set[int], prefactor_cutoff: float, number_bath_operators_for_contraction: int, _vector_space_cap: int, _max_krylov_space_dimension: int, rdm1_uu: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None, rdm1_dd: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None, rdm1_ud: Optional[numpy.ndarray[numpy.complex128[m, n], flags.writeable]] = None) -> tuple[lattice_functions.Fermions.ExpressionSpinful_complex, lattice_functions.Fermions.ExpressionSpinful_complex]

Self-contained Schrieffer-Wolff transformation for use in separate package.

Args:

H0_uu (np.ndarray): Quadratic Hamiltonian for spin-up, spin-up, H0_dd (np.ndarray): Quadratic Hamiltonian for spin-down, spin-down, H0_ud (np.ndarray): Quadratic Hamiltonian for spin-up, spin-down”, HU (np.ndarray): Density-density terms as a flattened vector spins (Set[int]): Set of spin site indices prefactor_cutoff (float64): Cutoff for the prefactors below which terms are discarded number_bath_operators_for_contraction (int): Number of bath operators necessary for contraction _vector_space_cap (int): Limit for the size of the vector space _max_krylov_space_dimension (int): Maximum size of the Krylov subspace of the solver rdm1_uu (Optional[np.array]): 1RDM for spin up-up electrons rdm1_dd (Optional[np.array]): 1RDM for spin down-down electrons rdm1_ud (Optional[np.array]): 1RDM for spin up-down electrons

Returns:

ExpressionSpinful: Schrieffer-Wolff transformed Hamiltonian ExpressionSpinful: Generator of the transformation