RiptideRiptide
Download Riptide SDKInstall Riptorch
Menu
Whitepapers · Raya · Exact geometry

Complex geometry for quantum mechanics, exactly

Complex numbers, qubit states and unitary gates written as rational geometry (quadrance, spread, Cayley parametrisations), every identity checked exactly, and an experiment that runs the same circuits exactly and in float on CPUs and GPUs.

Version
1.2 (corrected 1 December 2026: definition of spread; limitations section retitled)
Date
30 November 2026
Author
Samario Torres, Riptide
Software
Raya 0.4.0 (Riptide SDK 0.4.0) with Riptide's exact-arithmetic libraries; PyTorch 2.15.0 (CPU) and 2.9.1 (CUDA 12.8); SymPy 1.14.0; mpmath
Download PDFOpen in new tabriptidecompute.com/whitepapers/complex-geometry-quantum-mechanics

Abstract

Complex numbers with rational real and imaginary parts, the Gaussian rationals , carry most of the geometry quantum mechanics uses, exactly. This paper states that geometry in quadrance and spread. Rational points of the circle come from the Cayley parametrisation . Qubit states are rays with Gaussian-rational amplitudes, and their Born probabilities are exact rationals. The Bloch sphere is the inverse stereographic image of , reached through the Hopf map. Fidelity is a spread: is the Hermitian spread between rays, a quarter of the chord quadrance on the Bloch sphere, and the Bloch spread is the second spread polynomial of it. Gates are Cayley transforms of rational Hermitian matrices, and rotations come from rational quaternions. The complexified circle , with the point , ties the circle's rational phases to these Cayley steps. Every identity was checked exactly in Raya, 16 checks on up to 2,000 random instances each and every one passing on x86-64 and arm64, and symbolically in SymPy (23 checks).

An exact projective state-vector simulator over the Gaussian integers ran the same circuits as PyTorch complex64 and complex128: Cayley-rational rotations with H, S and CNOT, up to 4,096 layers. The exact unitarity check held at every checkpoint. Two independent exact implementations, Raya and Python, produced byte-identical states, and the Raya states were identical on Xeon and Graviton4. Exact cost is the limit: the size of each amplitude grows linearly with depth times width (115,000 bits per component at 8 qubits and 4,096 layers), so exact runs stopped at 10–14 qubits. At 10 qubits and 4,096 layers, measured exactly against the exact ray, complex64 had a fidelity error of and complex128 . Norm drift was and , and Born-probability errors were up to and . On the Xeon, the complex128 norm drift at the deepest checkpoint is predicted to within 2.1% by the exact quadrance of the rounded gate entries alone. Gate entries computed with atan, cos and sin gave 1.1–1.5 times the fidelity error of entries from one rational division, and on the Xeon 4 times the complex128 norm drift (that ratio depends on the machine's ). At 20–28 qubits on an RTX 4090 and an H100, mirror circuits returned to with spreads of to (complex128) and to (complex64). Float results were bit-identical between runs on one machine, but differed across CPUs; only some machine pairs matched (the two GPUs in complex64, and the RTX 4090 with Graviton4 in complex128 with rational entries). One cause is a that PyTorch's CPU build returned one ulp low on the Xeon. Exact simulation does not replace float simulation at scale. It is a reference that makes float errors measurable exactly.

The problem

Quantum mechanics is written with complex numbers, and most of what is computed from a state is a ratio of quadrances: a Born probability is , a fidelity is . Those are rational functions of the amplitudes. The transcendental functions come in with the gates: a rotation is usually written , and a simulator then rounds and , multiplies, rounds again, and carries the rounding through every layer.

This paper asks two questions. First, how much of the geometry of qubits can be stated exactly over the Gaussian rationals , in N. J. Wildberger's rational trigonometry (quadrance in place of distance, spread in place of angle)? Second, what does an exact state-vector simulator built on that geometry cost, and what does it show about float simulators?

Method

Quadrance and spread in the complex plane

A complex number with is a Gaussian rational. Its quadrance is

and quadrance is multiplicative, (the Brahmagupta–Fibonacci identity). For two non-zero complex numbers, carries both the dot and the cross of the two directions: . The spread between the directions of and is

a rational number in : 0 for the same direction, 1 for perpendicular directions. Multiplying by scales every quadrance by and turns every direction by the spread : complex multiplication is a rational rotation-dilation (Figure 1).

Gaussian-integer grid and its image under multiplication by 2 + i
Figure 1. Multiplication by turns the Gaussian-integer grid by the spread and scales every quadrance by ; the unit square becomes a square of area 5.

Rational points on the circle

The line through with slope meets the unit circle again at

This Cayley (stereographic) parametrisation is a bijection between and the rational points of the circle (Figures 2–3).

187 rational points on the unit circle, larger dots for smaller denominators
Figure 2. The rational points of the unit circle with denominator up to 170, from Cayley parameters . Every point satisfies exactly.
Lines from −1 with rational slopes t meeting the circle at rational points
Figure 3. The Cayley parametrisation: the line through with slope meets the circle again at ; the inverse is . Composition is the tangent addition law, again rational:

Turning times multiplies the spread by a spread polynomial, with , and (Figure 4). A rational point other than has infinite order (its angle is an irrational fraction of a turn, by Niven's theorem), so its powers never close up and fill the circle densely (Figure 5).

Spread polynomials S1 to S5 on [0,1] with exact rational points
Figure 4. Spread polynomials : the spread after turning times, as a polynomial in the spread of one turn. Dots are exact rational points from .
Powers of (3+4i)/5 scattered around the circle and their denominator bits growing linearly
Figure 5. Powers of never return to 1; the denominator of is exactly .

Möbius maps with rational coefficients

A Möbius map with and sends to itself, composes by matrix multiplication, and keeps the cross-ratio exactly. The Cayley transform sends the rational points of the real line to rational points of the unit circle and the upper half plane into the unit disc (Figures 6–7).

A rational grid in the upper half plane and its image under the Cayley transform inside the unit disc
Figure 6. The Cayley transform on a rational grid: lines become circles, Gaussian-rational points (black) stay Gaussian-rational, and the real line goes to the unit circle.
A square grid and its image under a Möbius map with Gaussian-rational coefficients
Figure 7. on a square grid. The coefficients are Gaussian rationals, so maps to itself; its two fixed points (stars) involve a square root.

Qubits as rays

A qubit state is a ray in : the vector up to a non-zero complex scalar. With nothing needs normalising. The Born probabilities are quotients of quadrances,

exact rationals for every Gaussian-rational state (Figure 8). For example has and .

Heat map of P(0) = 1/(1 + Q(z)) over the z-plane with exact values at Gaussian integers
Figure 8. For the ray the Born probability is ; labels are the exact values at Gaussian integers.

The Bloch sphere and the Hopf map

The Hopf map sends a ray to its Bloch vector,

and the identity puts every Gaussian-rational state exactly on the unit sphere. Writing , it is the inverse stereographic projection

so the rational points of the Bloch sphere are exactly the images of (Figures 9–10). The example above lands on . The fibre over a Bloch point is the circle of states with ; on a rational fibre the rational points are the multiples by Cayley points , and the Hopf map is constant on them exactly (Figures 11–12). The state , with on the nose, lies over .

Several thousand rational points on the Bloch sphere
Figure 9. Rational points of the Bloch sphere: the Bloch vectors of Gaussian-rational qubit states, each exactly on the unit sphere.
A grid in the z-plane and its image as circles on the sphere
Figure 10. Inverse stereographic projection takes the ratio to the Bloch vector; grid lines become circles through $
Linked circles in space, each with dots marking rational states
Figure 11. Hopf fibres over ten rational Bloch points, drawn by stereographic projection of into space. Dots are exact rational states on each fibre (multiples by Cayley points ).
A base point on the sphere and its fibre circle with rational points
Figure 12. The fibre over : every rational multiple of is again exactly on and over the same point.

Fidelity is a spread

For two vectors the fidelity of their rays is

and is the Hermitian spread between the rays: the same formula as Wildberger's spread , with the Hermitian product in place of the dot product. It is the Fubini–Study geometry of projective Hilbert space stated without an angle (for readers used to angles, is what the Fubini–Study distance gives as ). The complex Lagrange identity writes it as a sum of quadrances of minors (an area over the product of two quadrances),

which is also the numerically stable way to compute it: no cancellation between two numbers near 1.

On a qubit, with Bloch vectors :

The infidelity is a quarter of the chord quadrance on the Bloch sphere, and the spread between the Bloch vectors is the second spread polynomial of the spread between the rays: the Bloch angle is twice the Fubini–Study angle (Figures 13–14). For and : , , and the Bloch spread is .

Two scatter plots: 1 − F against chord quadrance on a line, and Bloch spread against 4s(1 − s) on a parabola
Figure 13. 400 random pairs of Gaussian-rational qubit states: equals a quarter of the chord quadrance, and the spread between the Bloch vectors equals , exactly for every pair.
Bloch sphere with two state vectors, the chord between them and the great-circle arc
Figure 14. The worked example: , , Bloch spread .

Unitaries without transcendental functions

For a Hermitian matrix with entries in , the Cayley transform

is unitary with entries in ; is always invertible (its eigenvalues are ), the map inverts as , and every unitary without the eigenvalue arises this way exactly once. It is the Crank–Nicolson step of the Schrödinger equation. For one qubit and ( a Pauli matrix, ):

which is with : the rotation's cosine and sine are a rational point of the circle, and no angle is ever formed. . The Bloch vector turns by the rational rotation with cosine and sine , , and stays exactly on the sphere (Figure 15).

Two Bloch spheres: a dense orbit of one rational rotation, and a path of 60 random rational gates
Figure 15. Left: 160 steps of the Z gate with , a rational rotation of infinite order. Right: 60 random X/Y/Z Cayley gates; every point is exactly on the sphere while denominators grow.

Pauli algebra and rational quaternions

The Pauli matrices have Gaussian-integer entries and . The map is multiplicative, so a quaternion with rational coefficients gives

and the rotation of with has rational entries (Euler–Rodrigues), with and exactly. Every rational rotation of comes from a rational quaternion. Euler's four-square identity makes composition exact (Figure 16).

Two multiplication tables: quaternion units 1, i, j, k and Pauli matrices I, X, Y, Z
Figure 16. The Hamilton and Pauli multiplication tables; both are exact over the Gaussian integers, and is multiplicative. The ray picture removes the remaining normalisation: and act on rays identically.

How dense the rational unitaries are, and what they miss

Rational points are dense on the circle, on and on , so any rotation can be approximated by a rational one. What cannot be done is to hit most named gates exactly over : the Hadamard gate and the T gate need (their entries lie in , the ring of exact Clifford+T synthesis), and apart from rotations by 60°, 90°, 120° and 180° (Niven's theorem) no rational rotation has a rational angle in degrees. Two measurements quantify the approximation (Figures 17–18): the best Cayley-rational stand-in for the T gate as the denominator grows, and the nearest rational unit quaternion of bounded height for random targets on .

Log-log plot of worst and median nearest spread falling with height M
Figure 17. Nearest rational unit quaternion to 4,000 random points of , by height (integer quaternions with ; the numbers are how many rotations are available). The median spread falls roughly like .
Spread to the T gate falling exponentially with the bits of the Cayley denominator
Figure 18. Best Cayley-rational Z rotation for the T gate as the denominator grows: about 21 decimal digits of spread at a 35-bit denominator ().

The complexified circle

Keep the circle's equation and its rational parametrisation, and let the numbers be complex rationals instead of rationals: that simple step is the right entry point for quantum mechanics. The circle becomes the complex circle

and the same formulas , with , , give points of it. For example, take : then , and

with exactly. Drawn this way, a point of the complex circle is a pair of points in two complex planes side by side (Figure 19); the whole curve is a surface in four real dimensions.

The coordinate makes the structure visible. Since , the complex circle is the hyperbola with , and

is the Cayley parametrisation again. For the example, and . Real gives : those are the phases of quantum mechanics, as rational points. Complex with gives (here ): with the Cayley transform above, so the upper half plane of parameters goes into the unit disc (Figure 20). In operator form this is the Cayley step with a generator that is not Hermitian: a contraction, the exact-arithmetic version of a decaying (imaginary-time) step. The quantum state space itself is a different complexification of the circle: the Hermitian sphere in (a 3-sphere), not the bilinear . The two meet exactly in the real circle: subtracting the real part of from leaves , which forces .

The real circle with the point (4/5, 3/5), and the z- and w-planes with 501 points of the complex circle and the point for t = 1 + i
Figure 19. The complex circle over , drawn as two planes: each point is a pair in two planes side by side. The large dots are : . Blue ticks are the real circle on the real axes.
Parameter plane with the upper half shaded, and the u-plane with points inside the unit disc
Figure 20. In the coordinate the complex circle is . Real lands on (rational phases); lands strictly inside the unit disc. The example has .

The exact simulator

The simulator keeps the state as a ray of Gaussian integers: integer vectors for , up to a scalar. Each gate acts by its small integer numerator matrix:

  • the Cayley rotation with , , on axis X, Y or Z;
  • as (its is a scalar on the ray, so it never enters the arithmetic);
  • and CNOT, which only permute and negate integers.

The quadrance is carried separately as an exact integer, multiplied by per rotation and by 2 per . At every checkpoint the simulator recomputes from the vector and compares it with : equality is an exact unitarity check, and it held at every checkpoint of every run. The integer content (gcd of all components) is divided out at checkpoints. Born probabilities are , exact rationals.

Two independent implementations were written, one in Raya and one in Python. Both write each checkpoint state as hexadecimal integers, so they can be compared byte for byte.

Circuits

A layer on qubits is: a Cayley rotation on every qubit (axis and drawn from , scales from 5 to 34), then on about a quarter of the qubits and on another quarter, then a CNOT ladder on alternating pairs. The circuits come from a fixed SplitMix64 seed and are prefix-consistent, so one run produces every checkpoint (1, 2, 3, 4, 6, 8, …, 3,072, 4,096 layers). Every simulator reads the same circuit.

The float simulators and how their error is measured

The float side is PyTorch state-vector simulation in complex64 and complex128, the same circuits, on CPUs and GPUs. Gate entries are built two ways: rational (the entries and , one correctly rounded division in the working precision) and trig (the textbook route: , then and by PyTorch in the working precision on the device). uses PyTorch's in the working precision (correctly rounded on Graviton4, one ulp low on the Xeon; see Results). Nothing renormalises the state.

Every float number is an exact dyadic rational, so the error of a float state against the exact ray can itself be computed exactly, with integers only:

  • fidelity error: the Hermitian spread between the exact ray and the float state , an exact rational;
  • probability error: , reading Born probabilities off the float state as a float user would;
  • norm drift: .

At 16–28 qubits no exact reference is feasible, so three references that need none are used: norm drift (summed in double-double, exact products and compensated sums, so the measurement adds no error); mirror circuits (the circuit, then its exact inverse with and , whose exact output is , so the spread from it is , computed without cancellation); and the spread between the complex64 and complex128 states of the same run. Bit identity is checked with the SHA-256 of the raw state bytes.

Machines and software

Exact runs on Intel Xeon and AWS Graviton4 CPUs, single-threaded; float runs with PyTorch on the same CPUs and on an RTX 4090 and an H100. The full machine list and versions are under Reproduction notes.

Results

Every identity, exactly

Table 1. Exact checks in Raya (2,000 random instances per check where not stated) and the largest float64 residual of the same formula. All 16 checks passed on every instance, on Xeon 8488C and on Graviton4, with identical float residuals on both.
checkstatementexactfloat64 residual
C12,000 / 2,0005.7e-16
C2; spread in , turning-invariant2,000 / 2,0004.9e-16
C3 on the unit circle, , inverse ; Riptide's rational-quantum library agrees2,000 / 2,0003.3e-16
C4 (float side via atan, cos, sin)1,997 / 1,9978.7e-16
C5, (float side )500 / 5002.9e-15
C6Möbius maps over keep cross-ratios; composition; Cayley transform2,000 / 2,0004.1e-14
C7inverse stereographic projection on , and back2,000 / 2,0002.2e-16
C8Hopf map on , constant on rational fibres, = stereographic image of 2,000 / 2,0002.2e-16
C9Born rule , 2,000 / 2,0000
C10, , Bloch spread 2,000 / 2,0006.6e-13
C11 = Lagrange sum of minor quadrances (dims 2, 3, 4, 5, 8); unitarily invariant1,000 / 1,0001.9e-14
C12Cayley transform unitary, invertible, (dims 2–4); single-qubit closed form300 / 300 (+600 / 600)1.9e-15
C13Pauli products 9 / 90
C14quaternions: , multiplicative, rational orthogonal, conjugation2,000 / 2,0002.2e-16
C15a Cayley spin stepper from Riptide's rational-quantum library: 30 Cayley steps keep and exactly40 / 400
C16complexified circle over , , , ; the example 2,000 / 2,0002.8e-14

The float column is the same formula evaluated in binary64. Most residuals are a few units of rounding. Two are larger, and both come from cancellation: C10 computes by subtracting two numbers near 1 (6.6e-13 relative), and C6 compares cross-ratios after a Möbius map (4.1e-14). The Lagrange form of in C11 avoids that cancellation. SymPy checked 23 statements symbolically (22 identities and the evaluation of Wildberger's example), including the general Cayley transform, Euler's four-square identity, the cross-ratio invariance and the three complexified-circle identities.

What exact simulation costs

Log-log lines of bits per amplitude against depth for 2 to 14 qubits, all straight with slope 1
Figure 21. Size of the exact state: bits of the largest Gaussian-integer component after dividing out the content, against depth. The growth is linear in depth and roughly linear in the number of qubits. The half-angle form needs half the bits.
Log-log lines of wall time against depth, Raya solid and Python dashed
Figure 22. Wall time of the exact simulators, one core each. Cost per layer grows with times the bits, so total time grows like .
Table 2. Exact runs, one core each, Xeon 8488C (Raya: time cap 2.5 h checked between checkpoints; Python: 2–8 qubits to 1,024 layers on the first Xeon, 10–14 qubits on the second with a 1.8 h cap). "Bits" is the largest component of the Gaussian-integer ray at the last checkpoint. The unitarity check held at every checkpoint of every run.
qubitsRaya: deepest checkpointtimePython: deepest checkpointtimebits per component
24,0961.0 s1,024< 0.1 s27,891
44,09612 s1,0240.2 s56,792
64,0961.7 min1,0241.0 s85,551
84,09612 min1,0247.1 s114,841
104,09678 min4,09610.5 min143,373
122,048 (cap)1.9 h4,09663 min172,483
141,024 (cap)2.6 h2,048 (cap)1.5 h100,701 at 2,048

Three things show up in these runs. The state grows by about 3.5 bits per qubit per layer (35 bits per layer at 10 qubits): one rotation per qubit multiplies each amplitude by a numerator of size (5–34), and little cancels (about 15% below the no-cancellation estimate). Dividing out the integer content at checkpoints removed about 5% of the bits. The projective half-angle form, the numerator of the half rotation, gives the same rays with half the bits. Its matrix, though, is rational only up to the scale .

Python's integers were 6 times faster than Raya's for this workload: 7.1 s against 44.7 s for 8 qubits at 1,024 layers (see the next section). Both implementations produced byte-identical states at every common checkpoint. All 24 checkpoints of the 10-qubit run match between Raya on the Xeon and Python on the second Xeon; all 100 state files written by both implementations on the Xeon match; and all 60 state files written by Raya on both the Xeon and Graviton4 match.

Float simulators against the exact answer

Two log-log panels of exact spread against depth for 4 to 10 qubits, complex64 near 1e-11 and complex128 near 1e-28 at 4,096 layers
Figure 23. Fidelity error of PyTorch's float state against the exact ray, computed exactly from the float bits (Xeon CPU, rational gate entries).
Two log-log panels of the largest Born-probability error against depth
Figure 24. Largest error of a Born probability read off the float state as , against the exact .
Table 3. 10 qubits, main circuit, errors computed exactly against the exact ray. "Spread" is between the float and exact rays; "probability" is the largest ; "drift" is . Rational = gate entries from one division; trig = from atan, cos, sin.
machinetype, gatesspread at 1,024spread at 4,096probability at 4,096drift at 4,096
Xeon 8488Ccomplex64, rational1.80e-117.46e-118.59e-07+1.48e-04
Xeon 8488Ccomplex64, trig2.17e-118.22e-116.77e-07−1.14e-04
Xeon 8488Ccomplex128, rational6.77e-292.65e-283.70e-15−6.86e-13
Xeon 8488Ccomplex128, trig9.97e-293.86e-281.55e-14−2.79e-12
Graviton4complex128, rational6.60e-292.68e-281.41e-14+2.53e-12
RTX 4090complex64, rational1.80e-117.25e-117.17e-07+1.36e-04
RTX 4090complex128, rational6.60e-292.68e-281.41e-14+2.53e-12
H100complex64, trig2.06e-118.00e-112.22e-06+4.01e-04
H100complex128, rational6.50e-292.52e-283.75e-15−6.83e-13
H100complex128, trig8.43e-293.36e-281.28e-14−2.30e-12
Two panels of median and min–max band of exact spread over 8 seeds against depth
Figure 25. The same measurement over 8 independent circuits (seeds 1–8) at 6 and 10 qubits: the spread of the error across circuits is narrow (max/median ≤ 1.3 at 4,096 layers).

The fidelity error grows linearly with depth: about per layer for complex64 and per layer for complex128 at 10 qubits. That is the signature of independent rounding errors adding up in amplitude like a random walk, since a spread is a squared quantity. Over the 8 seeds at 10 qubits and 4,096 layers the median was (complex64) and (complex128), and no seed was more than 1.3 times the median. In plain numbers, complex128 keeps the direction of the state to about 14 significant digits after 4,096 layers. For circuits like these it is accurate, and exact arithmetic adds no accuracy that matters for physics. What exact arithmetic adds is the ability to measure that error at all, exactly.

Norm drift is a far larger error than the fidelity error: against for complex64. The float state keeps its direction (its ray) much better than its length. Reading probabilities as , the projective Born rule, removes the drift term.

Ratio of trig-gate to rational-gate spread error against depth, mostly between 1 and 1.5
Figure 26. Spread error with gate entries from atan, cos and sin, divided by the error with entries from one rational division (Xeon CPU).

Gate entries built the textbook way, and , carry one or two ulps of error on some entries. Entries from the rational division are correctly rounded every time. Over 8 seeds at 10 qubits and 4,096 layers, the trig entries gave a 1.13× (complex64) and 1.45× (complex128) larger fidelity error, and on the Xeon a 4× larger complex128 norm drift and Born-probability error. On Graviton4 and the RTX 4090 the drift ratio reverses (0.17× and 0.36× at 10 qubits), because their errs in the other direction and partly cancels the trig entries' quadrance error. The rotation is the same in both cases; the only difference is where its cosine and sine come from.

Why the norm drifts

Two log-log panels of norm drift against depth for 10, 20, 24 and 28 qubits on four machines
Figure 27. Norm drift with depth on the Xeon, Graviton4, RTX 4090 and H100, measured in double-double so the measurement adds no error.
Measured drift as dots and predicted drift as lines; for complex128 they agree closely at depth
Figure 28. Prediction from the gates alone. A rotation with float entries multiplies the state's quadrance by exactly , and by . The product of those exact quadrances, minus 1, predicts the complex128 drift to within 2.1% at the deepest checkpoint of every modelled run (Xeon); at shallow depths, where the drift is tiny, it is less accurate.

Every float rotation in these simulators has the form , and exactly. So each gate scales the state's quadrance by the exact rational of its rounded entries, and scales it by with the rounded . Multiplying those exact quadrances, and modelling no other rounding, predicts the measured complex128 drift to within 2.1% at the deepest checkpoint (4,096 layers, or 1,024 at 20 qubits) of all 11 modelled complex128 runs, all on the Xeon: the drift comes from gates that are slightly non-unitary, not from the arithmetic of applying them. For complex64 the same model is right in sign and order of magnitude (0.66–1.81× the measurement), because float32 accumulation adds rounding of the same size.

This also explains why the complex128 drift had opposite signs on different machines. PyTorch 2.15.0's CPU build returned on the Xeon 8488C, one ulp below the correctly rounded value. On Graviton4 it returned the correctly rounded . The exact quadrance of one is on the Xeon and on Graviton4. With about a quarter of the qubits receiving in every layer, that one ulp sets the sign and most of the size of the complex128 drift. The GPU pods built their gate entries on their own host CPUs. From the sign and size of the drift, the H100 pod matched the Xeon value; the bit-identity results below show the RTX 4090 pod matched Graviton4. The host CPU model was not recorded.

16 to 28 qubits: references without an exact state

Table 4. Same circuits, rational gate entries, on the GPUs. Spread between the complex64 and complex128 rays of the same run (complex128 as the reference), norm drift, and the time for both precisions together.
qubitslayersspread c64 vs c128drift c64drift c128, RTX 4090 / H100time RTX 4090time H100
204,0961.42e-102.72e-04+5.06e-12 / −1.40e-1225 s15 s
241,0244.25e-118.14e-05+1.51e-12 / −4.43e-13129 s48 s
265122.30e-114.56e-05+8.11e-13 / −2.42e-13294 s114 s
282561.23e-112.69e-05+4.41e-13 / −1.10e-13683 s289 s
Log-log lines of the spread between complex64 and complex128 states against depth for 10 to 28 qubits
Figure 29. Where no exact state is feasible, complex128 is the reference for complex64. At 10 qubits and 4,096 layers the spread between the two equals the exact spread of complex64 to 10 digits (), because complex128's own error is about of it in spread (about in amplitude).
Log-log lines of spread from the all-zero state against forward depth for 20, 24 and 28 qubits
Figure 30. Mirror circuits: layers, then their exact inverse. The exact answer is ; the remaining weight elsewhere is the rounding error.

Mirror circuits gave a reference at every size. At 28 qubits with 64 forward and 64 inverse layers, the weight off was in complex64 and in complex128, the same on both GPUs. At 20 qubits and 1,024 + 1,024 layers it was and . These numbers grow linearly with depth and only slowly with width, as the exact comparison at 4–10 qubits does. That supports extrapolating the small exact comparisons to the large float runs.

Bit identity

Four matrices of equal or different marks between runs and machines
Figure 31. SHA-256 of the raw float state after the last layer. Repeated runs on one machine reproduced their bytes; across machines most pairs differ (blue blocks: pairs that matched).

Repeating a run on the same machine gave the same bytes every time, on the three machines where runs were repeated (Xeon, RTX 4090, H100). Across machines the float states differed. In complex64 the two GPUs agreed with each other but not with either CPU, and the two CPUs disagreed with each other. In complex128 with rational gate entries the RTX 4090 agreed with Graviton4, and the H100 with neither (with trig entries all four differed): that is the difference above, together with differences in how products and sums are fused. The exact states had one answer everywhere: the same bytes from Raya on Xeon and Graviton4 and from Python.

Limitations and next steps

The limits of these results, each with its cause and, where one is planned, the next step.

  • Exact simulation is far slower than float simulation. The size of each of the amplitudes grows linearly with depth × width, and the work per layer grows with the state size, so total cost grows like . The exact runs reached 10–14 qubits and a few thousand layers in hours; the float runs at 28 qubits and 256 layers took 5 minutes on an H100. Cause: the number of digits an exact ray needs, measured in Figure 21. Exact arithmetic is a reference and a measuring instrument in this paper, not a faster way to simulate.
  • Raya's big-integer arithmetic was 6 times slower than CPython's on the exact simulator (7.1 s against 44.7 s, 8 qubits × 1,024 layers), so the deepest 12- and 14-qubit runs came from the Python implementation. Cause: under investigation.
  • **Not every gate is rational over .** and T need . is kept exact by carrying its as a scalar on the ray, which is legitimate because only rays are physical. A T gate needs the cyclotomic field (, the ring of exact Clifford+T synthesis), or a rational approximation (Figure 18). Rotations by named angles such as π/8 are approximations in this gate set; the rotations used are exact at their own rational parameters.
  • Exact is not more accurate physics. For these circuits complex128 keeps the direction of the state to about 14 digits after 4,096 layers. Exact arithmetic gives reference answers and exact error measurements; it does not change physical predictions at this level.
  • One family of circuits. Random Cayley-rational rotations with H, S and CNOT ladders: 8 seeds for the spread of errors, one seed elsewhere. Circuits with near-cancelling amplitudes, mid-circuit measurement or noise were not tested.
  • Plain PyTorch state vectors as the float baseline, written for this study (one kernel per gate, no fusion). Production simulators such as cuStateVec or Qiskit Aer were not measured; their rounding will differ in detail.
  • The GPU pods' host CPUs were not recorded, so which each pod used is inferred from the drift and the bit-identity results, not observed.

Reproduction notes

  • Circuits. A SplitMix64 generator with seed 20261130 (seeds 1–8 for the sweep) draws, per layer, one Cayley rotation per qubit (axis X, Y or Z; from ), then H on about a quarter of the qubits and S on another quarter, then CNOTs on pairs on even layers and on odd layers. Qubit is bit of the basis index.
  • Exact side. Gaussian-integer state vectors with the gate numerators above; the quadrance carried separately and compared with at every checkpoint; integer content divided out at checkpoints. Any arbitrary-precision integer library reproduces the states byte for byte.
  • Float side. PyTorch state vectors with the gate entries described in Method, no renormalisation; norm sums in double-double; mirror circuits with and . Errors against the exact ray computed with integers from the float bits.
  • Machines. EC2 instances over SSM only, each with a hard auto-terminate; RunPod pods with a time and dollar watchdog. Every machine was terminated when its lane finished.

Machines and software

Table 5. Machines. Exact simulators ran single-threaded, one process per configuration; float runs used PyTorch's own threading (8 threads on the Xeon, 4 on Graviton4).
machineused for
Intel Xeon Platinum 8488C, 32 vCPURaya + Python exact runs, PyTorch 2.15.0 CPU float runs, SymPy, density, analysis and figures
AWS Graviton4, 4 vCPURaya exact runs and float runs for cross-architecture identity
Intel Xeon and AWS Graviton4 (a second pair)8-seed sweep, Python exact frontier at 12–14 qubits, gate-entry check
NVIDIA GeForce RTX 4090 24 GB, driver 595.112.07PyTorch 2.9.1 (CUDA 12.8) float runs, 4–28 qubits
NVIDIA H100 80GB HBM3, driver 595.112.07PyTorch 2.9.1 (CUDA 12.8) float runs, 4–28 qubits

Software: Raya 0.4.0 (Riptide SDK 0.4.0) with Riptide's exact-arithmetic libraries; Python 3.12 with PyTorch 2.15.0 (the +cpu wheel on x86-64, the +cu132 wheel run on the CPU on Graviton4), NumPy 2.5.5, SymPy 1.14.0 and mpmath; PyTorch 2.9.1+cu128 on the GPU pods. Every machine was rented for this work and terminated afterwards; the total cost was about $10 (EC2 about $7.8, RunPod $1.90).

References

  • N. J. Wildberger, Divine Proportions: Rational Trigonometry to Universal Geometry, Wild Egg, 2005.

Date and version

Version 1.2, 30 November 2026. All measurements from 30 November 2026. Updated 1 December 2026: limitations section retitled.

Working with Riptide

Riptide works with a small number of teams. Each engagement starts with 4 weeks inside your systems, learning how your models, data and infrastructure work. Only then does Riptide apply its software to them. Contact samario@riptidecompute.com or riptidecompute.com/evaluate.