diff options
Diffstat (limited to 'least_squares.cpp')
-rw-r--r-- | least_squares.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/least_squares.cpp b/least_squares.cpp index 49100b4..c0134d8 100644 --- a/least_squares.cpp +++ b/least_squares.cpp @@ -117,8 +117,8 @@ public: auto [H, ∂H, ∂∂H] = H_∂H_∂∂H(x); Vector ∇H = makeTangent(∂H, x); - Matrix HessH = ∂∂H - (∂H * x.transpose() + x.dot(∂H) * Matrix::Identity(N, N) - + (∂∂H * x) * x.transpose()) / (Real)N + 2.0 * x * x.transpose(); + Matrix HessH = ∂∂H + (2 * x - (∂H + ∂∂H * x) / N) * x.transpose() + - (x.dot(∂H) / N) * Matrix::Identity(N, N); return {H, ∇H, HessH}; } |