Conventions

Applicable version · ArcQML 0.1.0

On this page

Pure states and normalization

For n qubits, ArcQML represents a pure state as a complex vector of length d, where the state-space dimension is:

d=2n.d=2^n.

The pure state and its normalization condition are:

ψ=x=02n1αxx,x=02n1αx2=1.\lvert\psi\rangle =\sum_{x=0}^{2^n-1}\alpha_x\lvert x\rangle, \qquad \sum_{x=0}^{2^n-1}\lvert\alpha_x\rvert^2=1.

When importing a single state from Tensor, the framework checks the squared norm of the entire vector. Batch imports are checked row by row. To allow floating-point error, both interfaces require:

xαx211010.\left\lvert \sum_x\lvert\alpha_x\rvert^2-1 \right\rvert \le 10^{-10}.

The default constructor creates the all-zero computational basis state:

00.\lvert 0\cdots 0\rangle.

Amplitude 0 is 1; all other amplitudes are 0.

Qubit indices and binary-string display

ArcQML assigns q0 to the least significant bit of the computational basis index, q1 to the next bit, and so on. The relationship between basis states and numerical indices is:

x=qn1q1q0,x=k=0n1qk2k.\lvert x\rangle =\lvert q_{n-1}\cdots q_1q_0\rangle, \qquad x=\sum_{k=0}^{n-1}q_k2^k.

Binary strings display qubits in descending order: q[n-1] on the left and q0 on the right. In a two-qubit system, for example, internal index 1 is displayed as 01.

Two-qubit internal index Binary display q1 value q0 value
0 00 0 0
1 01 0 1
2 10 1 0
3 11 1 1

Local matrices and multi-qubit gate order

For multi-qubit gates, call arguments define the local basis order: qubits[0] is the least significant bit of the local matrix index, followed by qubits[1]. For controlled gates such as cnot, cp, crx, cry, and crz, the first qubit is the control and the second the target. Thus cnot(0, 1) uses q0 as control and q1 as target. Swap-like gates still require two valid, distinct qubit indices even though they are mathematically symmetric.

Public row-major data for a dense full unitary matrix is indexed first by the output computational basis index, then by the input index. Internally, full-unitary batch computation instead treats each computational basis input as a column-like batch state, then transposes to the public matrix layout.