quchip.engine.excitation¶
Excitation-number structure of resolved chips.
N is the total isolated energy-level index of a product state. This module
finds the changes of N that authored operators carry, proves whether the
retained static model of a chip conserves N, and indexes product states by
N. ExcitationStructure holds these facts for one resolved system
and one approximation, and the engine’s routes read them from it.
Functions
|
Return the total energy-level changes an authored operator carries. |
|
Return the total level changes carried by a concrete operator. |
|
Return the changes of |
|
Partition the totals |
|
Total energy-level index of every C-order product state. |
|
Return the excitation structure of |
|
Return |
|
Return whether |
|
Return the largest magnitude of an entry of |
|
Return whether |
|
Return a warning when only entries far below the level spacings break conservation. |
|
Diagonalize each total-excitation block; return ascending eigenpairs. |
|
Return every level product below |
|
Count the product states of |
Classes
|
Excitation-number structure of one resolved chip under one approximation. |
|
The changes of the total excitation number |
- quchip.engine.excitation.excitation_sectors(dims)[source]¶
Total energy-level index of every C-order product state.
- quchip.engine.excitation.sector_levels(dims, total)[source]¶
Return every level product below
dimsthat sums tototal, in C order.
- quchip.engine.excitation.sector_size(dims, total)[source]¶
Count the product states of
dimswhose levels sum tototal.
- quchip.engine.excitation.excitation_classes(changes, maximum)[source]¶
Partition the totals
0..maximuminto the classes thatchangesconnect.A class holds the totals that steps
n -> n +- cwith every intermediate total in[0, maximum]connect. Unknown changes give one class.
- quchip.engine.excitation.sector_eigh(h, sectors)[source]¶
Diagonalize each total-excitation block; return ascending eigenpairs.
Eigenvectors have exact zeros outside their own sector, so round-off can neither mix sectors nor make the result depend on near-degeneracies between them. A concrete Hamiltonian is diagonalized on the host, where the differently sized blocks compile no device programs.
- quchip.engine.excitation.concrete_excitation_changes(matrix, dims, energy_vectors=None)[source]¶
Return the total level changes carried by a concrete operator.
matrixacts on a product basis whose energy-ordered states are the columns ofenergy_vectors;Nonemeans the product basis is already energy ordered.dimscounts the energy levels per subsystem. Exact nonzero comparison can add round-off weights but never omits a band. Traced payloads returnNone: their bands are not statically known.
- quchip.engine.excitation.authored_excitation_changes(operator, labels, backend, bases)[source]¶
Return the total energy-level changes an authored operator carries.
Declarations and factored algebra supply structural support. Scalar coefficients do not change it, including at zero. Constant leaves are checked in the captured energy bases at compile time. Unknown matrix support or traced energy vectors return
None. No small-entry threshold supplies a conservation proof. A product on a truncated energy basis is checked as one complete matrix.- Parameters:
operator (PhysicsExpr or backend operator) – Operator on
labelsin their authored coordinates.labels (tuple[str, ...]) – Ordered device labels supporting
operator.backend (Backend) – Backend used to materialize
operator.bases (mapping or None) – Captured basis records keyed by device label.
- quchip.engine.excitation.largest_changing_entry(operator, labels, backend, bases)[source]¶
Return the largest magnitude of an entry of
operatorthat changesN.The operator is read as one complete matrix in the captured energy bases, in its own units.
Nonemeans that a basis is missing, that the matrix would not fit in memory, or that the operator, its parameters or the energy vectors are traced.- Parameters:
operator (PhysicsExpr or backend operator) – Operator on
labelsin their authored coordinates.labels (tuple[str, ...]) – Ordered device labels supporting
operator.backend (Backend) – Backend used to materialize
operator.bases (mapping or None) – Captured basis records keyed by device label.
- quchip.engine.excitation.format_changes(changes)[source]¶
Return
changesas text, with each symmetric pair written±c.
- quchip.engine.excitation.keeps_zero_total_only(approximation)[source]¶
Return whether
approximationkeeps only the zero-total bands of ordinary interactions.Such an approximation removes every change of
Nfrom a coupling or an intrinsic two-device term. Retained terms bypass the filter.- Parameters:
approximation (Approximation) – Approximation the model is resolved with.
- quchip.engine.excitation.lowers_by_one(changes)[source]¶
Return whether
changesproves that an operator lowersNby one and does nothing else.
- class quchip.engine.excitation.ExcitationTerm(label, kind, changes, largest_entry=None)[source]¶
Bases:
objectThe changes of the total excitation number
Nthat one term carries.A change
cmaps a product state with totalNto totalN - c, so a lowering operator has the change1.- Variables:
label (str) – Label of the coupling, retained term, port, drive or collapse channel. A port pair is labeled
"upstream -> downstream"and a collapse channel"owner.name".kind (str) –
"coupling","retained","cascade"(the Hamiltonian that a port network generates for one port pair),"port","drive"or"channel".changes (frozenset of int or None) – Changes of
Nthat quchip finds for the term under the approximation, orNonewhen it cannot prove them.largest_entry (float or None) – For a coupling or retained term that changes
N, the largest magnitude in GHz of a static entry that changesN.Nonefor other terms and when the entry is traced.
- class quchip.engine.excitation.ExcitationStructure(chip, approximation, resolution)[source]¶
Bases:
objectExcitation-number structure of one resolved chip under one approximation.
Nis the total isolated energy-level index of a product state. The static model conservesNwhen every coupling, retained term and generated port pair keeps only zero changes ofN, and every port of a generated pair lowersNby one. quchip reads these changes from exact operator structure: a nonzero entry that changesNbreaks conservation however small it is, and unknown structure is not a proof. A conserving static model is block diagonal with one block for eachN, and dressed queries diagonalize only the blocks of their labels. Under an activeExcitationCutoff, each block is one class of totals that the static changes connect.Chip.excitation_structure()returns a complete record. The engine builds one record for each resolved system and approximation, and reads each fact the first time a route asks for it.- Parameters:
chip (Chip) – Chip whose static model is read.
approximation (Approximation) – Approximation that selects the static terms.
resolution (object) – Resolved local bases of
chip.
- Variables:
approximation (Approximation) – Approximation that selects the static terms.
dims (tuple of int) – Resolved level count of each device, in chip order.
cutoff (int or None) – Largest total of the chip’s active excitation cutoff, or
None.
- property changes: frozenset[int] | None¶
Changes of
Nof the static model, closed under negation and holding0, orNonewhen unknown.
- interaction_changes()[source]¶
Yield the changes of
Nof each coupling and retained term, in chip order.Each term is read once. A coupling under an approximation that keeps only zero-total bands yields
{0}.
- property terms: tuple[ExcitationTerm, ...]¶
Changes of
Nof every coupling, retained term and generated port pair.
- property ports: tuple[ExcitationTerm, ...]¶
Changes of
Nof each port of a generated pair, in the chip’s retained coordinates.
- property breaking: tuple[ExcitationTerm, ...]¶
Terms and ports that prevent a proof of conservation, empty when the static model conserves
N.
- property drives: tuple[ExcitationTerm, ...]¶
Changes of
Nof each wired control line under the approximation.
- property channels: tuple[ExcitationTerm, ...]¶
Changes of
Nof each collapse channel, ports included.
- property level_span: float | None¶
Largest spread of one device’s resolved energies in GHz, or
Nonewhen they are traced.
- classes(max_total)[source]¶
Return the classes of totals
0..max_totalthat the static changes connect.- Parameters:
max_total (int) – Largest retained total excitation number.
- sector_sizes(max_total)[source]¶
Return the number of product states with each total
0..max_total.- Parameters:
max_total (int) – Largest total excitation number.
- largest_block(max_total)[source]¶
Return the size of the largest block that dressed queries diagonalize for labels up to
max_total.A conserving chip diagonalizes one sector for each total, a chip with an active excitation cutoff one class, and any other chip its complete static model.
- Parameters:
max_total (int) – Largest total excitation number of the queried labels.
- quchip.engine.excitation.round_off_advisory(structure)[source]¶
Return a warning when only entries far below the level spacings break conservation.
Every term that breaks conservation must be a coupling or retained term whose largest entry that changes
Nis below1e-12times the largest level span of one device. The heuristic does not change the verdict, andNonemeans that it does not apply. The search stops at the first term that rules it out.- Parameters:
structure (ExcitationStructure) – Record of a chip whose static model does not conserve
N.
- quchip.engine.excitation.excitation_structure(chip, approximation, *, resolution=None, complete=False)[source]¶
Return the excitation structure of
chipunderapproximation.The record is built once for each resolved system and approximation.
- Parameters:
chip (Chip) – Chip whose static model is read.
approximation (Approximation) – Approximation that selects the static terms.
resolution (optional) – Resolved local bases to reuse.
Noneresolves the chip.complete (bool, default=False) – Evaluate every fact now and keep no reference to
chip. Such a record is not cached.
- quchip.engine.excitation.drive_excitation_changes(chip, drive, target, bases, approximation)[source]¶
Return the changes of
Nthat a delivered drive keeps underapproximation, orNone.The operator-band filter applies to a coupling drive under every approximation, so an approximation whose retained bands conserve
Nremoves every change of a coupling drive that no captured map retains.- Parameters:
chip (Chip) – Chip that owns the drive.
drive (BaseDrive) – Drive whose authored terms are read.
target (object) – Device or coupling that receives the drive.
bases (mapping) – Resolved basis records keyed by device label.
approximation (Approximation) – Approximation the model is resolved with.