diff options
Diffstat (limited to 'intern/libmv/libmv/numeric/function_derivative_test.cc')
-rw-r--r-- | intern/libmv/libmv/numeric/function_derivative_test.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/intern/libmv/libmv/numeric/function_derivative_test.cc b/intern/libmv/libmv/numeric/function_derivative_test.cc index 8d976d3e9a0..defeedaa8a4 100644 --- a/intern/libmv/libmv/numeric/function_derivative_test.cc +++ b/intern/libmv/libmv/numeric/function_derivative_test.cc @@ -18,9 +18,9 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. -#include "testing/testing.h" -#include "libmv/numeric/numeric.h" #include "libmv/numeric/function_derivative.h" +#include "libmv/numeric/numeric.h" +#include "testing/testing.h" using namespace libmv; @@ -30,22 +30,22 @@ class F { public: typedef Vec2 FMatrixType; typedef Vec3 XMatrixType; - Vec2 operator()(const Vec3 &x) const { + Vec2 operator()(const Vec3& x) const { Vec2 fx; - fx << 0.19*x(0) + 0.19*x(1)*x(1) + x(2), - 3*sin(x(0)) + 2*cos(x(1)); + fx << 0.19 * x(0) + 0.19 * x(1) * x(1) + x(2), + 3 * sin(x(0)) + 2 * cos(x(1)); return fx; } - Mat23 J(const Vec3 &x) const { + Mat23 J(const Vec3& x) const { Mat23 jacobian; - jacobian << 0.19, 2*0.19*x(1), 1.0, - 3*cos(x(0)), -2*sin(x(1)), 0; + jacobian << 0.19, 2 * 0.19 * x(1), 1.0, 3 * cos(x(0)), -2 * sin(x(1)), 0; return jacobian; } }; TEST(FunctionDerivative, SimpleCase) { - Vec3 x; x << 0.76026643, 0.01799744, 0.55192142; + Vec3 x; + x << 0.76026643, 0.01799744, 0.55192142; F f; NumericJacobian<F, CENTRAL> J(f); EXPECT_MATRIX_NEAR(f.J(x), J(x), 1e-8); |