Commit 9ea9e092 authored by Davis King's avatar Davis King

Added tests for the least squares code.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403928
parent 9a67ee4c
......@@ -45,6 +45,7 @@ set (tests
is_same_object.cpp
kcentroid.cpp
kernel_matrix.cpp
least_squares.cpp
linear_manifold_regularizer.cpp
lz77_buffer.cpp
map.cpp
......
This diff is collapsed.
......@@ -55,6 +55,7 @@ SRC += image.cpp
SRC += is_same_object.cpp
SRC += kcentroid.cpp
SRC += kernel_matrix.cpp
SRC += least_squares.cpp
SRC += linear_manifold_regularizer.cpp
SRC += lz77_buffer.cpp
SRC += map.cpp
......
......@@ -155,7 +155,7 @@ namespace dlib
T rosen_big ( const matrix<T,2,1>& m)
{
using std::pow;
return 0.5*(pow(rosen_big_residual(1,m),2) + pow(rosen_big_residual(2,m)));
return 0.5*(pow(rosen_big_residual(1,m),2) + pow(rosen_big_residual(2,m),2));
}
template <typename T>
......@@ -208,6 +208,25 @@ namespace dlib
}
}
template <typename T>
matrix<T,2,1> rosen_residual_derivative (int i, const matrix<T,2,1>& m)
{
const T x = m(0);
const T y = m(1);
matrix<T,2,1> d;
if (i == 1)
{
d = -20*x, 10;
}
else
{
d = -1, 0;
}
return d;
}
template <typename T>
const matrix<T,2,1> rosen_derivative ( const matrix<T,2,1>& m)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment