summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2024-04-22 12:05:31 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2024-04-22 12:05:31 +0200
commit9f5c65e5cd2f9ac69848a30fc848511e7493eee3 (patch)
treee06204c13bb82f1b8f0165fc81b73a12a9da27fe
parent9d4c8399b99f7c7aaec361fd91642d909749ef80 (diff)
downloadcode-9f5c65e5cd2f9ac69848a30fc848511e7493eee3.tar.gz
code-9f5c65e5cd2f9ac69848a30fc848511e7493eee3.tar.bz2
code-9f5c65e5cd2f9ac69848a30fc848511e7493eee3.zip
Reordered declarations.
-rw-r--r--least_squares.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/least_squares.cpp b/least_squares.cpp
index a4ee727..125557e 100644
--- a/least_squares.cpp
+++ b/least_squares.cpp
@@ -118,8 +118,8 @@ public:
Vector gradientAscent(const QuadraticModel& M, const Vector& x₀, Real ε = 1e-13) {
Vector xₜ = x₀;
- Real α = 1;
Real Hₜ = M.H(x₀);
+ Real α = 1;
Real m;
Vector ∇H;
@@ -127,8 +127,8 @@ Vector gradientAscent(const QuadraticModel& M, const Vector& x₀, Real ε = 1e-
∇H = M.∇H(xₜ), m = ∇H.squaredNorm(),
m / M.N > ε
) {
- Real Hₜ₊₁;
Vector xₜ₊₁;
+ Real Hₜ₊₁;
while(
xₜ₊₁ = normalize(xₜ + α * ∇H), Hₜ₊₁ = M.H(xₜ₊₁),