pygsti.baseobjs.basis.default_basis_for_udims

pygsti.baseobjs.basis.default_basis_for_udims#

default_basis_for_udims(udims)#

Pick a default basis spec for a system whose per-qudit Hilbert-space dimensions are given by udims.

Qubits (dimension 2) get ‘pp’ – the entrenched pyGSTi convention, and one that downstream code special-cases – and every other dimension gets ‘gm’, which is valid for all d. Note that a dimension-4 entry means a single ququart (and hence ‘gm’); callers who mean two qubits should pass [2, 2], not [4].

Returns a basis-name string when every qudit has the same dimension, because a name is dimension-agnostic and resolves correctly at every downstream use site (e.g. when a single-qudit sub-op needs the per-qudit basis rather than the full product basis). Only genuinely mixed-dimension systems return an explicit TensorProdBasis.

Parameters:

udims (Sequence[int])