summaryrefslogtreecommitdiff
path: root/least_squares.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2024-04-02 17:55:02 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2024-04-02 17:55:02 +0200
commited7f5a872db4e5fa9f115e4d196567678fcb6711 (patch)
tree1a78caa3e689bf5a6948bc4957d6683d1f5c2d66 /least_squares.cpp
parent92c319247fae9d8be3f3291d6fa64266224ef61c (diff)
downloadcode-ed7f5a872db4e5fa9f115e4d196567678fcb6711.tar.gz
code-ed7f5a872db4e5fa9f115e4d196567678fcb6711.tar.bz2
code-ed7f5a872db4e5fa9f115e4d196567678fcb6711.zip
Changed convention to match Fyodorov.
Diffstat (limited to 'least_squares.cpp')
-rw-r--r--least_squares.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/least_squares.cpp b/least_squares.cpp
index 28397ec..f667e28 100644
--- a/least_squares.cpp
+++ b/least_squares.cpp
@@ -97,7 +97,7 @@ public:
std::tuple<Real, Vector, Matrix> hamGradHess(const Vector& x) const {
auto [H, dH, ddH] = HdHddH(x);
- Vector gradH = dH - dH.dot(x) * x / N;
+ Vector gradH = dH - dH.dot(x) * x / (Real)N;
Matrix hessH = ddH - (dH * x.transpose() + x.dot(dH) * Matrix::Identity(N, N) + (ddH * x) * x.transpose()) / (Real)N + 2.0 * x * x.transpose();
return {H, gradH, hessH};
@@ -171,7 +171,7 @@ int main(int argc, char* argv[]) {
Rng r;
- Model<1, 2> leastSquares(N, M, r.engine(), sqrt(2) * pow(σ, 2), sqrt(2));
+ Model<1, 2> leastSquares(N, M, r.engine(), σ, 1);
Vector x = Vector::Zero(N);
x(0) = sqrt(N);