Operator Terms
This module collects routines that operate on the individual terms of an operator, partitioning them based on their structure. The submodules below group related functionality.
Grouping
Please refer to Group operator terms: use the operator structure for a detailed explanation of this module’s functionality.
Assignment
Rather than always relying on the user to provide the group indices themselves, this module provides a collection of functions which determine the grouping information automatically.
Column 1 | Column 2 |
|---|---|
group_terms_by_electronic_structure(op, ...) | Groups the terms of an operator by their electronic structure. |
Analysis
Group indices carry no intrinsic meaning: the array only says which terms belong together, never why. Accordingly, none of the functions below reports whether a grouping is “correct”: each answers one narrow, stated question about an existing grouping, leaving the interpretation to you. They are provided so that an assumption a downstream consumer makes about a grouping can be checked up front, rather than being paid for on every call.
Column 1 | Column 2 |
|---|---|
group_coeff_means(op) | Returns the mean absolute coefficient magnitude of each group. |
groups_are_hermitian(op, *[, atol]) | Returns, for each group, whether the operator formed by that group's terms is Hermitian. |
groups_have_uniform_coeffs(op, *[, atol, abs]) | Returns, for each group, whether all of its coefficients are numerically equal. |
Filtering
This module provides convenience functions for removing terms from an operator that do not contribute meaningfully to a downstream computation.
Members
Column 1 | Column 2 |
|---|---|
filter_diagonal_terms(op) | Filters out the terms of an operator that are diagonal in the occupation-number basis. |
Ordering
This module provides functions to reorder the terms of an operator. While the resulting operators are mathematically identical, the term order can have significant implications on algorithm behavior at runtime, due to the term iteration order.
Group indices are a per-term tag that says nothing about where those terms sit, so the terms of one group are in general scattered throughout an operator. group_order() gathers each group into one contiguous run, which is what lets split_out_groups() locate a requested group by binary search instead of scanning every term.
Unlike canonical_order(), order_terms() has no counterpart in the C API.
Members
Column 1 | Column 2 |
|---|---|
canonical_order(op) | Returns a copy of an operator with its terms sorted into a canonical order. |
group_order(op) | Returns a copy of an operator with its terms ordered by group index. |
order_terms(op, key, *[, reverse]) | Returns a copy of an operator with its terms reordered by a user-provided key. |