MOAB: Mesh Oriented datABase  (version 5.2.1)
StdDevTemplateTest.cpp File Reference

Unit tests for StdDevTemplate and VarianceTemplate. More...

#include "Mesquite.hpp"
#include "StdDevTemplate.hpp"
#include "VarianceTemplate.hpp"
#include "MsqError.hpp"
#include "PatchData.hpp"
#include "ObjectiveFunctionTests.hpp"
#include "MsqHessian.hpp"
+ Include dependency graph for StdDevTemplateTest.cpp:

Go to the source code of this file.

Classes

class  StdDevTemplateTest

Functions

 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (StdDevTemplateTest,"StdDevTemplateTest")
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (StdDevTemplateTest,"Unit")
static double std_dev_sqr (const double *array, unsigned len)

Variables

const double EPSILON = 1e-4

Detailed Description

Unit tests for StdDevTemplate and VarianceTemplate.

Author:
Jason Kraftcheck

Definition in file StdDevTemplateTest.cpp.


Function Documentation

CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ( StdDevTemplateTest  ,
"StdDevTemplateTest"   
)
static double std_dev_sqr ( const double *  array,
unsigned  len 
) [static]

Definition at line 403 of file StdDevTemplateTest.cpp.

References moab::sum().

Referenced by StdDevTemplateTest::test_evaluate(), and StdDevTemplateTest::test_evaluate_sqr().

{
    double sum = 0, sqr_sum = 0;
    for( size_t i = 0; i < len; ++i )
    {
        sum += array[i];
        sqr_sum += array[i] * array[i];
    }

    return sqr_sum / len - ( sum / len ) * ( sum / len );
}

Variable Documentation

const double EPSILON = 1e-4

Definition at line 43 of file StdDevTemplateTest.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines