Projects/Foundations/Pivot strategies and backward stability of Gaussian elimination — controlled synthetic benchmark
Level 4 · advanced · ~12 h
Pivot strategies and backward stability of Gaussian elimination — controlled synthetic benchmark
Implement partial, complete and rook pivoting for LU factorization and quantify backward error on Hilbert and Vandermonde matrices. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Prerequisites
Problem statement
- 01Implement partial, complete and rook pivoting for LU factorization and quantify backward error on Hilbert and Vandermonde matrices. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Real-world motivation
- 01Pivot choice controls growth factor and determines whether elimination is backward stable in finite precision. The controlled synthetic benchmark setting forces concrete choices about data, scale and evaluation.
Learning objectives
- 01Implement three pivoting rules
- 02Measure growth factor and residual
- 03Identify when partial pivoting fails
- 04Report relative error against the analytic ground truth alongside the baseline metrics.
Technical architecture
- 01in-place LU with row and column permutations
- 02growth-factor tracker
- 03residual and condition-number estimator
Mathematical foundations
- 01growth factor $\rho=\max_{i,j}|U_{ij}|/\max_{i,j}|A_{ij}|$
- 02backward error $\lVert PAQ-LU\rVert/(\lVert A\rVert\rho)$
Dataset and sources
- 01synthetic matrices generated with numpy.random.default_rng(42)
- 02condition numbers 1, 10, 100, 1000
Step-by-step tasks
- 01Frame the task and freeze the controlled synthetic benchmark evaluation protocol with a fixed random seed.
- 02Implementation 1: Write lu_pivot(A, rule) in NumPy
- 03Implementation 2: Track pivots in permutation vectors
- 04Implementation 3: Compare with scipy.linalg.lu_factor
- 05Verification 1: Check PAQ = LU to 1e-12 on well-conditioned inputs
- 06Verification 2: Verify determinant from the diagonal of U
- 07Run the ablation grid and report relative error against the analytic ground truth over three independent trials.
Implementation requirements
- 01Write lu_pivot(A, rule) in NumPy
- 02Track pivots in permutation vectors
- 03Compare with scipy.linalg.lu_factor
- 04Log all hyperparameters and the random seed for the controlled synthetic benchmark run.
Testing requirements
- 01Check PAQ = LU to 1e-12 on well-conditioned inputs
- 02Verify determinant from the diagonal of U
- 03Measure relative error against the analytic ground truth over at least three seeds.
Evaluation metrics
- 01relative residual
- 02growth factor
- 03pivot count
- 04relative error against the analytic ground truth
Expected outputs
- 01stability table across condition numbers
- 02heatmap of U magnitudes
Common failure modes
- 01Hilbert matrices are numerically singular well before n=15
- 02rook pivoting costs extra comparisons
- 03ill-conditioning above 1e3 makes double precision futile
Stretch goals
- 01implement iterative refinement
- 02test on totally nonnegative matrices
- 03repeat in float32 and quantify the extra error floor
Research extensions
- 01characterize growth for random sign matrices
- 02study when complete pivoting helps in practice
GitHub submission requirements
- 01A repository whose README states the controlled synthetic benchmark protocol and the exact command to reproduce it.
- 02Source for the scratch implementation, a test file, and a results table with uncertainty estimates.
- 03A two-page report explaining failures on synthetic matrices generated with numpy.random.default_rng(42) and what the ablation revealed.
Completion rubric
- 01all three pivot rules correct
- 02residual computation correct
- 03explanation of growth factor
- 04Extra credit: repeat in float32 and quantify the extra error floor
Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.