aboutsummaryrefslogtreecommitdiff
path: root/experiments/hilbert_qr.cpp
diff options
context:
space:
mode:
authory-jan137 <yousefjan24000@gmail.com>2026-03-15 11:16:49 +0300
committery-jan137 <yousefjan24000@gmail.com>2026-03-15 11:16:49 +0300
commitbe01607041d2ded41e5bf39a0a8e17ffb9bcc296 (patch)
tree12857bb0c9c360fecc23534a1c4185d0b27972e5 /experiments/hilbert_qr.cpp
parentb11123e1cd710c135d9924f263ab1808cd96c8c2 (diff)
Add QR iteration and cleanup
Diffstat (limited to 'experiments/hilbert_qr.cpp')
-rw-r--r--experiments/hilbert_qr.cpp17
1 files changed, 0 insertions, 17 deletions
diff --git a/experiments/hilbert_qr.cpp b/experiments/hilbert_qr.cpp
index 9209a30..218b35c 100644
--- a/experiments/hilbert_qr.cpp
+++ b/experiments/hilbert_qr.cpp
@@ -1,9 +1,3 @@
-// Experiment: QR methods on Hilbert matrices
-//
-// The Hilbert matrix H[i][j] = 1/(i+j+1) is the canonical ill-conditioned
-// dense matrix. Its condition number grows roughly as (3.5 * e)^n / sqrt(n),
-// reaching ~10^13 at n=10 and ~10^18 at n=14.
-//
// We compare classical GS, modified GS, and Householder QR on:
// - reconstruction error ||A - QR||_F
// - orthogonality error ||Q^T Q - I||_F
@@ -68,9 +62,6 @@ double orthogonality_error(const QRResult& qr) {
return std::sqrt(err);
}
-// ---------------------------------------------------------------------------
-// Timing
-// ---------------------------------------------------------------------------
using Clock = std::chrono::high_resolution_clock;
using Seconds = std::chrono::duration<double>;
@@ -88,10 +79,6 @@ double min_time(Fn fn, int trials = 5) {
return best;
}
-// ---------------------------------------------------------------------------
-// Run one method on one size, return {recon, ortho, time} or nullopt on failure
-// ---------------------------------------------------------------------------
-
using QRFn = std::function<QRResult(const Matrix&)>;
struct Result { double recon, ortho, time_s; };
@@ -110,10 +97,6 @@ std::optional<Result> measure(const Matrix& A, QRFn fn) {
}
}
-// ---------------------------------------------------------------------------
-// Pretty printing
-// ---------------------------------------------------------------------------
-
void print_row(const std::string& method, std::optional<Result> r) {
std::cout << std::left << std::setw(16) << method;
if (!r) {