Model declarations and capability reports ========================================== Shared definitions: :doc:`../theory/models` and :doc:`../theory/finite-m`. ModelSpec ---------- .. autoclass:: hcphases.ModelSpec :members: g, h, to_json, canonical_json, canonical_hash :undoc-members: An immutable homogeneous higher-degree model declaration. ``d`` Number of spatial axes. Must be an integer at least two. ``p`` Degree of cells carrying physical qudits; integer with ``1<=p=2`` is the modulus. ``x_harmonics`` and ``z_harmonics`` are optional maps from integer n in 1,...,N-1 to finite coefficients of X^n and Z^n. Values can be real numbers, complex numbers, or ``[real, imaginary]`` pairs. Omitted maps or entries are zero. Within each map require coefficient[N-n]=conj(coefficient[n]); self-inverse indices must be real. Complex or negative Hermitian declarations do not imply an available positive Monte Carlo target. The immutable normalized maps store sorted integer indices and real/imaginary pairs. ``coefficient(basis,n)`` uses basis ``"x"`` or ``"z"`` and returns a complex coefficient, or zero for an absent index. Invalid basis labels raise. Use physical harmonic indices 1,...,N-1. ``to_json`` encodes the complete stored maps as lists, not constructor-style dictionaries. BinaryFields ------------- .. autoclass:: hcphases.BinaryFields :members: to_sources, to_json :undoc-members: ``g,h`` are finite nonnegative real values for the coefficients in -gX-hZ. ``to_sources`` returns ``UniformSources(2, x_harmonics={1:g}, z_harmonics={1:h})``. There is only one nontrivial binary harmonic, so no additional conjugate term or factor of two is added. ``to_json`` returns ``{"g":g,"h":h}``. Basis-dependent execution support is checked separately. TrotterSpec ------------ .. autoclass:: hcphases.TrotterSpec :members: delta_tau, to_json :undoc-members: ``slices`` is a positive integer M. ``scheme`` must be ``"ordered_v1"``. ``delta_tau(model)`` returns 1/(T*M). The represented trace is Tr[(exp(-delta*H_z) exp(-delta*H_x))^M]. The constructor does not make a continuum-error claim. ``to_json`` records slices and scheme. UnsupportedRequest ------------------- .. autoexception:: hcphases.UnsupportedRequest A ValueError subclass for unsupported public requests. Numerical and storage validation can also raise other ValueError subclasses. Catch the public base exception appropriate to your application and retain its message. Catching an error is not permission to alter a model silently. capabilities ------------- .. autofunction:: hcphases.capabilities ``model`` must be a higher-degree ``ModelSpec``. ``observables`` is an iterable of supported declarations, empty by default. Optional ``representation`` enables finite-M spin/face counts. It returns a JSON-compatible dictionary: * ``model_domain_supported`` and ``execution_supported``: support flags; the latter also includes the release switch. * ``reasons``: explicit model/observable problems. * ``basis_groups``: requested count, support, reasons and measurement-model interpretation for Z and X. * ``backend``, ``topology``, ``periodic``, ``release_status`` and ``release_reason``. * ``finite_m``: scheme, slices, source spin count and counts per basis model. The method does not allocate production arrays or draw random samples. It does not perform every later schema, numerical or live-resource admission check. An empty observable list is useful for inspection but cannot be passed to ``plan`` as a runnable request. A ``VertexModel`` requires the separate vertex interface; it is not accepted here.