Tutorial overview
Numbers before abstraction
What LAMBDA solves
Least squares gives real-valued ambiguity estimates, but carrier-phase ambiguities are integers. LAMBDA uses their covariance to search for the integer vector that best fits the complete statistical model.
Teaching pattern
Formula -> values -> arithmetic -> result
The same compact sequence repeats through every numerical checkpoint.
Float ambiguities
Estimate real-valued ambiguities and covariance
Integer least squares
Define the covariance-weighted search
Decorrelate
Transform into a search-friendly integer space
Search
Find the two best integer candidates
Back-transform
Return candidates to the original order
Compare
Rank candidates and report diagnostics
1. Carrier-phase ambiguity
Why ambiguity fixing matters
A carrier-phase ambiguity is an unknown whole number of carrier cycles. The physical truth belongs to the integers, but measurement noise and least-squares estimation first produce a real-valued float estimate.
2. Real Qelora input
Float ambiguities and their covariance
Float ambiguity vector
a1 = 1.23 cycles: a real-valued estimate, not yet a fixed integer.
a2 = 5.78 cycles: a real-valued estimate, not yet a fixed integer.
a3 = -2.41 cycles: a real-valued estimate, not yet a fixed integer.
Covariance matrix
Diagonal cells
Variances describe each ambiguity's precision. Smaller values generally indicate tighter precision.
Off-diagonal cells
Covariances describe statistical dependence. Non-zero values mean the ambiguity estimates are related.
sigma 1 (cycles)
sigma 2 (cycles)
sigma 3 (cycles)
3. Objective and intuition
The integer least-squares problem
Float estimate
a-hat is the real-valued least-squares result.
Integer candidate
n is one possible vector on the integer lattice.
Covariance weight
Qaa inverse accounts for precision and correlation.
Scalar score
The smallest weighted squared distance ranks best.

Why ordinary rounding can fail
Correlation tilts the distance geometry
The covariance-weighted closest point can differ from the coordinate-by-coordinate rounded point.
Keep the two examples separate
In the real three-ambiguity example below, simple rounding happens to give [1, 6, -2], the same best candidate. This 2D diagram only explains why rounding is unreliable in the general correlated case.
4. Reduction output
Read the L^T D L decomposition
These are the final reduction outputs reported by Qelora's native MLAMBDA trace for this lesson.
Check the reconstruction
Multiply D by L
Multiply L^T by the intermediate product
5. Integer transformation
Decorrelation with the Z-transformation
- Every entry is an integer.
- Determinant +/-1 preserves the integer lattice.
- The mapping is reversible in the integer domain.
What happens in this dataset
Here Z is a permutation matrix. It mainly reorders ambiguity components, so this example does not show a dramatic decorrelation. The diagrams explain the general purpose conceptually.


6. Matrix-vector multiplication
Transform the float ambiguities
Row-by-row arithmetic
Result
z_hat = [5.78, -2.41, 1.23]
The values are reordered to [5.78, -2.41, 1.23]. In a more complex case, the integer transformation also reduces correlations.
7. Two-stage matrix multiplication
Transform the covariance matrix
Compute the intermediate matrix M = Z^T Qaa
Multiply M by Z
Result
Qz is the reordered covariance
Because Z is a permutation in this particular lesson, Qz largely reorders Qaa. General LAMBDA reductions can produce a much more search-friendly covariance.
8. Ellipsoidal search
Search in decorrelated z-space
Best candidate
z1 = [6, -2, 1]
Squared norm: 4.369536082474228
Second-best candidate
z2 = [6, -3, 1]
Squared norm: 9.905618556701022

9. Return to original ambiguity order
Back-transform both candidates
Candidate 1
Best candidate
n1 = [1, 6, -2]
The permutation restores the candidate to the original ambiguity ordering.
Candidate 2
Second candidate
n2 = [1, 6, -3]
The permutation restores the candidate to the original ambiguity ordering.
10. Candidate ranking
Compute both squared norms step by step
Covariance inverse used by both calculations
Candidate 1: n1 = [1, 6, -2]
Compute d1 = a_hat - n1
Compute u1 = Qaa^-1 d1
Compute s1 = d1^T u1
(0.23 x 6.185567) + (-0.22 x -1.742268) + (-0.41 x -6.252577) = 4.369536082474228
Smaller score / best
s1 = 4.369536082474228
This candidate fits the float estimate and covariance model better.
Candidate 2: n2 = [1, 6, -3]
Compute d2 = a_hat - n2
Compute u2 = Qaa^-1 d2
Compute s2 = d2^T u2
(0.23 x 7.216495) + (-0.22 x -5.865979) + (0.59 x 11.78866) = 9.905618556701022
Larger score / rejected after comparison
s2 = 9.905618556701022
This candidate remains mathematically valid, but ranks behind candidate 1.
11. Estimation is not validation
Compare candidates and interpret the ratio
Best integer candidate
n1 = [1, 6, -2]
s1 = 4.369536082474228
Rejected relative to candidate 1
n2 = [1, 6, -3]
s2 = 9.905618556701022
The ratio measures how much worse the second candidate scores relative to the best. It is a diagnostic, not automatic proof of an acceptable fix.
Formatted ratio
2.27
Full precision: 2.266972596114143
LAMBDA estimation and ambiguity validation are separate stages
LAMBDA identifies integer candidates. Acceptance requires a chosen validation policy and may include the ratio diagnostic, residual behavior, success or failure-rate criteria, application requirements, and other quality controls. There is no single universal ratio threshold that should be hardcoded for every GNSS scenario.
12. Start-to-finish checkpoint
Complete worked numerical example
Input
a_hat = [1.23, 5.78, -2.41]
Reduction
L, D, and unimodular Z from native MLAMBDA
Transform
z_hat = [5.78, -2.41, 1.23]
Search
z1 = [6, -2, 1], z2 = [6, -3, 1]
Back-transform
n1 = [1, 6, -2], n2 = [1, 6, -3]
Metric
s1 = 4.369536, s2 = 9.905619
Diagnostic
ratio = 2.266972596114143
Estimator result
[1, 6, -2]
Best integer candidate from the LAMBDA estimator, not an unconditional validated fix.
13. Real Qelora implementation
Theory and production kernel
Theory
P.J.G. Teunissen's LAMBDA method provides the integer least-squares and ambiguity decorrelation foundation.
Practical implementation
Qelora uses a local native kernel compatible with the RTKLIB-style MLAMBDA implementation.
Trace consistency
api_matches_native_trace = true
The public API returned the same candidates, norms, and Z matrix exposed by the native trace.
Execution path
Python API
Input validation
Native MLAMBDA kernel
Reduction
Integer search
Back-transform
Candidates + metrics
result = lambda_solve(a_hat, Q_aa, n_candidates=2)
result.candidates
result.squared_norms
result.ratioThe native kernel publishes L, D, Z, z, search candidates, original-domain candidates, squared norms, and status. The tutorial does not invent unavailable internal per-line C trace details.
14. References
Theory and implementation sources
LAMBDA theory
P.J.G. Teunissen, “The least-squares ambiguity decorrelation adjustment: a method for fast GPS integer ambiguity estimation,” Journal of Geodesy, 1995.
Read the original LAMBDA paperQelora implementation
The practical solver is an RTKLIB-style MLAMBDA native kernel wrapped by Qelora's Python API. It is compatible with that implementation family, not claimed as a line-by-line rendering of the 1995 paper.
15. What to remember
The estimator is complete; validation is the next decision
- Carrier-phase ambiguities are integers, while least squares first gives float estimates.
- Covariance describes both precision and dependence.
- LAMBDA solves a covariance-weighted integer least-squares problem.
- An integer unimodular Z transformation preserves the lattice while making search easier.
- Candidates are searched in z-space and transformed back to the original ambiguity order.
- Squared norms rank candidates; validation decides whether a fix is safe to use.

