MOAB: Mesh Oriented datABase  (version 5.4.1)
AWMetricTest Class Reference
+ Inheritance diagram for AWMetricTest:
+ Collaboration diagram for AWMetricTest:

Public Member Functions

void test_numerical_gradient_2D ()
void test_numerical_hessian_2D ()
void test_numerical_gradient_3D ()
void test_numerical_hessian_3D ()

Private Member Functions

 CPPUNIT_TEST_SUITE (AWMetricTest)
 CPPUNIT_TEST (test_numerical_gradient_2D)
 CPPUNIT_TEST (test_numerical_hessian_2D)
 CPPUNIT_TEST (test_numerical_gradient_3D)
 CPPUNIT_TEST (test_numerical_hessian_3D)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 40 of file AWMetricTest.cpp.


Member Function Documentation

Definition at line 248 of file AWMetricTest.cpp.

References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, Avals, Bvals, CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, MBMesquite::da(), GradTestMetricAbs::evaluate(), MBMesquite::AWMetric::evaluate_with_grad(), HessTestMetricAbs_2::evaluate_with_grad(), and GradTestMetricAbs::grad().

{
    GradTestMetricAbs metric;
    HessTestMetricAbs_2 metric2;
    const double Avals[] = { 1, 2, 2, 5 };
    const double Bvals[] = { -0.1, -0.15, -0.25, -0.8 };
    const MsqMatrix< 2, 2 > I( 1.0 );
    const MsqMatrix< 2, 2 > A( Avals );
    const MsqMatrix< 2, 2 > B( Bvals );

    MsqError err;
    MsqMatrix< 2, 2 > d;
    bool valid;
    double val, gval;

    MsqMatrix< 2, 2 > expected;
    for( int r = 0; r < 2; ++r )
        for( int c = 0; c < 2; ++c )
            expected( r, c ) = metric.grad( r, c );

    valid = metric.evaluate( I, A, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( I, A, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( A, I, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( A, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( I, B, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( I, B, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( B, I, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( B, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( A, B, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( A, B, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( B, A, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( B, A, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    MsqMatrix< 2, 2 > da;
    valid = metric2.evaluate_with_grad( A, I, val, da, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_grad( A, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( da, d, 1e-6 );

    valid = metric2.evaluate_with_grad( B, I, val, da, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_grad( B, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( da, d, 1e-6 );
}

Definition at line 341 of file AWMetricTest.cpp.

References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, Avals, Bvals, CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, MBMesquite::da(), GradTestMetricAbs::evaluate(), MBMesquite::AWMetric::evaluate_with_grad(), HessTestMetricAbs_2::evaluate_with_grad(), and GradTestMetricAbs::grad().

{
    GradTestMetricAbs metric;
    HessTestMetricAbs_2 metric2;
    const double Avals[] = { 1, 2, 3, 4, 1, 4, 3, 2, 1 };
    const double Bvals[] = { 0.1, 0.15, 0.05, 0.2, -0.1, -0.15, -0.05, -0.2, 2 };
    const MsqMatrix< 3, 3 > I( 1.0 );
    const MsqMatrix< 3, 3 > A( Avals );
    const MsqMatrix< 3, 3 > B( Bvals );

    MsqError err;
    MsqMatrix< 3, 3 > d;
    bool valid;
    double val, gval;

    MsqMatrix< 3, 3 > expected;
    for( int r = 0; r < 3; ++r )
        for( int c = 0; c < 3; ++c )
            expected( r, c ) = metric.grad( r, c );

    valid = metric.evaluate( I, A, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( I, A, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( A, I, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( A, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( I, B, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( I, B, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( B, I, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( B, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( A, B, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( A, B, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    valid = metric.evaluate( B, A, val, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_grad( B, A, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    ASSERT_MATRICES_EQUAL( expected, d, 1e-6 );

    MsqMatrix< 3, 3 > da;
    valid = metric2.evaluate_with_grad( A, I, val, da, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_grad( A, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( da, d, 1e-6 );

    valid = metric2.evaluate_with_grad( B, I, val, da, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_grad( B, I, gval, d, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, gval, 1e-6 );
    ASSERT_MATRICES_EQUAL( da, d, 1e-6 );
}

Definition at line 434 of file AWMetricTest.cpp.

References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, Avals, Bvals, CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, HessTestMetricAbs::evaluate_with_grad(), MBMesquite::AWMetric::evaluate_with_hess(), and HessTestMetricAbs_2::evaluate_with_hess().

{
    HessTestMetricAbs metric;
    HessTestMetricAbs_2 metric2;
    const double Avals[] = { 1, 2, 2, 5 };
    const double Bvals[] = { -0.1, -0.15, -0.25, -0.8 };
    const MsqMatrix< 2, 2 > I( 1.0 );
    const MsqMatrix< 2, 2 > A( Avals );
    const MsqMatrix< 2, 2 > B( Bvals );

    MsqError err;
    MsqMatrix< 2, 2 > g, gh;
    MsqMatrix< 2, 2 > h[6];
    bool valid;
    double val, hval;

    const double h_00[] = { 2, 0, 0, 10 };
    const double h_01[] = { 0, 0, -8, 0 };
    const double h_11[] = { 10, 0, 0, 2 };
    MsqMatrix< 2, 2 > h00( h_00 ), h01( h_01 ), h11( h_11 );

    valid = metric.evaluate_with_grad( I, A, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( I, A, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[2], 1e-6 );

    valid = metric.evaluate_with_grad( A, I, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( A, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[2], 1e-6 );

    valid = metric.evaluate_with_grad( I, B, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( I, B, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[2], 1e-6 );

    valid = metric.evaluate_with_grad( B, I, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( B, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[2], 1e-6 );

    valid = metric.evaluate_with_grad( A, B, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( A, B, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[2], 1e-6 );

    valid = metric.evaluate_with_grad( B, A, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( B, A, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[2], 1e-6 );

    MsqMatrix< 2, 2 > ah[6];
    valid = metric2.evaluate_with_hess( A, I, val, g, ah, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_hess( A, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[0], h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[1], h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[2], h[2], 1e-6 );

    valid = metric2.evaluate_with_hess( B, I, val, g, ah, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_hess( B, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[0], h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[1], h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[2], h[2], 1e-6 );
}

Definition at line 553 of file AWMetricTest.cpp.

References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, Avals, Bvals, CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, HessTestMetricAbs::evaluate_with_grad(), MBMesquite::AWMetric::evaluate_with_hess(), and HessTestMetricAbs_2::evaluate_with_hess().

{
    HessTestMetricAbs metric;
    HessTestMetricAbs_2 metric2;
    const double Avals[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    const double Bvals[] = { 0.1, 0.15, 0.05, 0.2, -0.1, -0.15, -0.05, -0.2, 2 };
    const MsqMatrix< 3, 3 > I( 1.0 );
    const MsqMatrix< 3, 3 > A( Avals );
    const MsqMatrix< 3, 3 > B( Bvals );

    MsqError err;
    MsqMatrix< 3, 3 > g, gh;
    MsqMatrix< 3, 3 > h[6];
    bool valid;
    double val, hval;

    const double h_00[] = { 2, 0, 0, 0, 10, 0, 0, 0, 10 };
    const double h_01[] = { 0, 0, 0, -8, 0, 0, 0, 0, 0 };
    const double h_02[] = { 0, 0, 0, 0, 0, 0, -8, 0, 0 };
    const double h_11[] = { 10, 0, 0, 0, 2, 0, 0, 0, 10 };
    const double h_12[] = { 0, 0, 0, 0, 0, 0, 0, -8, 0 };
    const double h_22[] = { 10, 0, 0, 0, 10, 0, 0, 0, 2 };
    MsqMatrix< 3, 3 > h00( h_00 ), h01( h_01 ), h02( h_02 ), h11( h_11 ), h12( h_12 ), h22( h_22 );

    valid = metric.evaluate_with_grad( I, A, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( I, A, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h02, h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( h12, h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( h22, h[5], 1e-6 );

    valid = metric.evaluate_with_grad( A, I, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( A, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h02, h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( h12, h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( h22, h[5], 1e-6 );

    valid = metric.evaluate_with_grad( I, B, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( I, B, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h02, h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( h12, h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( h22, h[5], 1e-6 );

    valid = metric.evaluate_with_grad( B, I, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( B, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h02, h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( h12, h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( h22, h[5], 1e-6 );

    valid = metric.evaluate_with_grad( A, B, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( A, B, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h02, h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( h12, h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( h22, h[5], 1e-6 );

    valid = metric.evaluate_with_grad( B, A, val, g, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric.evaluate_with_hess( B, A, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( h00, h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( h01, h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( h02, h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( h11, h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( h12, h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( h22, h[5], 1e-6 );

    MsqMatrix< 3, 3 > ah[6];
    valid = metric2.evaluate_with_hess( A, I, val, g, ah, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_hess( A, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[0], h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[1], h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[2], h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[3], h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[4], h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[5], h[5], 1e-6 );

    valid = metric2.evaluate_with_hess( B, I, val, g, ah, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    valid = metric2.AWMetric::evaluate_with_hess( B, I, hval, gh, h, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( valid );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( val, hval, 1e-6 );
    ASSERT_MATRICES_EQUAL( g, gh, 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[0], h[0], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[1], h[1], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[2], h[2], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[3], h[3], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[4], h[4], 1e-6 );
    ASSERT_MATRICES_EQUAL( ah[5], h[5], 1e-6 );
}

List of all members.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines