Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Allocators

Instructions for creating quantum/combinatorial objects (models, samples) and vectors in registers.

Model Allocators

CodeMnemonicArgumentsStack EffectRegister EffectDescription
0x40BQMXreg: Register\([\ldots, n] \to [\ldots]\)writePop \(n\). Allocate a binary QUBO model with variable domain \(\{0, 1\}\).
0x41SQMXreg: Register\([\ldots, n] \to [\ldots]\)writePop \(n\). Allocate a spin Ising model with variable domain \(\{-1, 1\}\).
0x42XQMXreg: Register\([\ldots, n, k] \to [\ldots]\)writePop \(k\), then \(n\). Allocate a discrete (chromatic) model with signed centered variable domain \(\{-k, -(k{-}1), \ldots, k{-}2, k{-}1\}\). Errors with InvalidDiscreteK when \(k < 2\).

All model allocators create an XqmxModel with empty linear and quadratic coefficient maps. The parameter \(n\) determines the number of variables.

Sample Allocators

CodeMnemonicArgumentsStack EffectRegister EffectDescription
0x43BSMXreg: Register\([\ldots, n] \to [\ldots]\)writePop \(n\). Allocate a binary sample with \(\text{values} = [0; n]\).
0x44SSMXreg: Register\([\ldots, n] \to [\ldots]\)writePop \(n\). Allocate a spin sample with \(\text{values} = [-1; n]\) (spin-down default).
0x45XSMXreg: Register\([\ldots, n, k] \to [\ldots]\)writePop \(k\), then \(n\). Allocate a discrete sample with signed centered domain \(\{-k, -(k{-}1), \ldots, k{-}2, k{-}1\}\) and \(\text{values} = [0; n]\). Errors with InvalidDiscreteK when \(k < 2\).

Samples hold a vector of variable assignments. The default value depends on the domain: \(0\) for binary and discrete, \(-1\) for spin. Because the discrete domain is symmetric around zero (\(\{-k, \ldots, k{-}1\}\)), the default \(0\) is always in-domain.

Vec Allocators

CodeMnemonicArgumentsStack EffectRegister EffectDescription
0x4AVECreg: Register\([\ldots] \to [\ldots]\)writeCreate an empty integer vec. Identical to VECI at runtime.
0x4BVECIreg: Register\([\ldots] \to [\ldots]\)writeCreate an empty VecInt.
0x4CVECXreg: Register\([\ldots] \to [\ldots]\)writeCreate an empty VecXqmx (vector of models).

Domain Types

DomainVariable valuesCreated by
Binary\(\{0, 1\}\)BQMX, BSMX
Spin\(\{-1, 1\}\)SQMX, SSMX
Discrete(\(k\))\(\{-k, -(k{-}1), \ldots, k{-}2, k{-}1\}\) (requires \(k \ge 2\))XQMX, XSMX