MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::AWMetric Class Reference

A metric for comparing a matrix A with a target matrix W. More...

#include <AWMetric.hpp>

+ Inheritance diagram for MBMesquite::AWMetric:

Public Member Functions

virtual MESQUITE_EXPORT ~AWMetric ()
virtual MESQUITE_EXPORT std::string get_name () const =0
virtual MESQUITE_EXPORT bool evaluate (const MsqMatrix< 2, 2 > &A, const MsqMatrix< 2, 2 > &W, double &result, MsqError &err)
 Evaluate \(\mu(A,W)\).
virtual MESQUITE_EXPORT bool evaluate (const MsqMatrix< 3, 3 > &A, const MsqMatrix< 3, 3 > &W, double &result, MsqError &err)
 Evaluate \(\mu(A,W)\).
virtual MESQUITE_EXPORT bool evaluate_with_grad (const MsqMatrix< 2, 2 > &A, const MsqMatrix< 2, 2 > &W, double &result, MsqMatrix< 2, 2 > &deriv_wrt_A, MsqError &err)
 Gradient of \(\mu(A,W)\) with respect to components of A.
virtual MESQUITE_EXPORT bool evaluate_with_grad (const MsqMatrix< 3, 3 > &A, const MsqMatrix< 3, 3 > &W, double &result, MsqMatrix< 3, 3 > &deriv_wrt_A, MsqError &err)
 Gradient of \(\mu(A,W)\) with respect to components of A.
virtual MESQUITE_EXPORT bool evaluate_with_hess (const MsqMatrix< 2, 2 > &A, const MsqMatrix< 2, 2 > &W, double &result, MsqMatrix< 2, 2 > &deriv_wrt_A, MsqMatrix< 2, 2 > second_wrt_A[3], MsqError &err)
 Hessian of \(\mu(A,W)\) with respect to components of A.
virtual MESQUITE_EXPORT bool evaluate_with_hess (const MsqMatrix< 3, 3 > &A, const MsqMatrix< 3, 3 > &W, double &result, MsqMatrix< 3, 3 > &deriv_wrt_A, MsqMatrix< 3, 3 > second_wrt_A[6], MsqError &err)
 Hessian of \(\mu(A,W)\) with respect to components of A.

Static Public Member Functions

static bool invalid_determinant (double d)

Detailed Description

A metric for comparing a matrix A with a target matrix W.

Implement a scalar function \(\mu(A,W)\) where A and W are 2x2 or 3x3 matrices.

Definition at line 49 of file AWMetric.hpp.


Constructor & Destructor Documentation

Definition at line 193 of file AWMetric.cpp.

{}

Member Function Documentation

bool MBMesquite::AWMetric::evaluate ( const MsqMatrix< 2, 2 > &  A,
const MsqMatrix< 2, 2 > &  W,
double &  result,
MsqError err 
) [virtual]
bool MBMesquite::AWMetric::evaluate ( const MsqMatrix< 3, 3 > &  A,
const MsqMatrix< 3, 3 > &  W,
double &  result,
MsqError err 
) [virtual]

Evaluate \(\mu(A,W)\).

Parameters:
A3x3 active matrix
W3x3 target matrix
resultOutput: value of function
Returns:
false if function cannot be evaluated for given A and W (e.g. division by zero, etc.), true otherwise.

Reimplemented in MBMesquite::AWMetric2D, HessTestMetricAbs_2, HessTestMetricAbs, GradTestMetricAbs, MBMesquite::AWMetricBarrier2D, MBMesquite::AWMetricNonBarrier2D, MBMesquite::AWShapeOrientNB1, MBMesquite::AWShapeSizeOrientNB1, MBMesquite::AWSizeNB1, MBMesquite::AWUntangleBeta, MBMesquite::AWSizeB1, MBMesquite::AWShapeSizeB1, and FauxAbsShapeMetric.

Definition at line 201 of file AWMetric.cpp.

{
    return false;
}
bool MBMesquite::AWMetric::evaluate_with_grad ( const MsqMatrix< 2, 2 > &  A,
const MsqMatrix< 2, 2 > &  W,
double &  result,
MsqMatrix< 2, 2 > &  deriv_wrt_A,
MsqError err 
) [virtual]

Gradient of \(\mu(A,W)\) with respect to components of A.

Parameters:
A2x2 active matrix
W2x2 target matrix
resultOutput: value of function
deriv_wrt_AOutput: partial deriviatve of \(\mu\) wrt each term of A, evaluated at passed A.

\[\left[\begin{array}{cc} \frac{\partial\mu}{\partial A_{0,0}} & \frac{\partial\mu}{\partial A_{0,1}} \\ \frac{\partial\mu}{\partial A_{1,0}} & \frac{\partial\mu}{\partial A_{1,1}} \\ \end{array}\right]\]

Returns:
false if function cannot be evaluated for given A and W (e.g. division by zero, etc.), true otherwise.

Reimplemented in HessTestMetricAbs_2, HessTestMetricAbs, MBMesquite::AWUntangleBeta, MBMesquite::AWSizeB1, MBMesquite::AWShape2DNB1, MBMesquite::AWShape2DNB2, MBMesquite::AWShapeOrientNB1, MBMesquite::AWShapeSizeOrientNB1, and MBMesquite::AWSizeNB1.

Definition at line 207 of file AWMetric.cpp.

References MBMesquite::do_numerical_gradient().

Referenced by MBMesquite::do_numerical_hessian(), MBMesquite::AWQualityMetric::evaluate_with_gradient(), TMetricTest< Metric, DIM >::grad(), TMetricTest< Metric, DIM >::num_grad(), AWMetricTest::test_numerical_gradient_2D(), and AWMetricTest::test_numerical_gradient_3D().

{
    return do_numerical_gradient( this, A, W, result, wrt_A, err );
}
bool MBMesquite::AWMetric::evaluate_with_grad ( const MsqMatrix< 3, 3 > &  A,
const MsqMatrix< 3, 3 > &  W,
double &  result,
MsqMatrix< 3, 3 > &  deriv_wrt_A,
MsqError err 
) [virtual]

Gradient of \(\mu(A,W)\) with respect to components of A.

Parameters:
A3x3 active matrix
W3x3 target matrix
resultOutput: value of function
deriv_wrt_AOutput: partial deriviatve of \(\mu\) wrt each term of A, evaluated at passed A.

\[\left[\begin{array}{ccc} \frac{\partial\mu}{\partial A_{0,0}} & \frac{\partial\mu}{\partial A_{0,1}} & \frac{\partial\mu}{\partial A_{0,2}} \\ \frac{\partial\mu}{\partial A_{1,0}} & \frac{\partial\mu}{\partial A_{1,1}} & \frac{\partial\mu}{\partial A_{1,2}} \\ \frac{\partial\mu}{\partial A_{2,0}} & \frac{\partial\mu}{\partial A_{2,1}} & \frac{\partial\mu}{\partial A_{2,2}} \end{array}\right]\]

Returns:
false if function cannot be evaluated for given A and W (e.g. division by zero, etc.), true otherwise.

Reimplemented in HessTestMetricAbs_2, HessTestMetricAbs, MBMesquite::AWShapeOrientNB1, MBMesquite::AWUntangleBeta, MBMesquite::AWShapeSizeOrientNB1, MBMesquite::AWSizeNB1, and MBMesquite::AWSizeB1.

Definition at line 213 of file AWMetric.cpp.

References MBMesquite::do_numerical_gradient().

{
    return do_numerical_gradient( this, A, W, result, wrt_A, err );
}
bool MBMesquite::AWMetric::evaluate_with_hess ( const MsqMatrix< 2, 2 > &  A,
const MsqMatrix< 2, 2 > &  W,
double &  result,
MsqMatrix< 2, 2 > &  deriv_wrt_A,
MsqMatrix< 2, 2 >  second_wrt_A[3],
MsqError err 
) [virtual]

Hessian of \(\mu(A,W)\) with respect to components of A.

Parameters:
A2x2 active matrix
W2x2 target matrix
resultOutput: value of function
deriv_wrt_AOutput: partial deriviatve of \(\mu\) wrt each term of A, evaluated at passed A.
second_wrt_AOutput: 4x4 matrix of second partial deriviatve of \(\mu\) wrt each term of A, in row-major order. The symmetric matrix is decomposed into 2x2 blocks and only the upper diagonal blocks, in row-major order, are returned.

\[\left[\begin{array}{cc|cc} \frac{\partial^{2}\mu}{\partial A_{0,0}^2} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{0,1}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{1,0}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{1,1}} \\ \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{0,1}} & \frac{\partial^{2}\mu}{\partial A_{0,1}^2} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{1,0}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{1,1}} \\ \hline & & \frac{\partial^{2}\mu}{\partial A_{1,0}^2} & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{1,1}} \\ & & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{1,1}} & \frac{\partial^{2}\mu}{\partial A_{1,1}^2} \\ \end{array}\right]\]

Returns:
false if function cannot be evaluated for given A and W (e.g. division by zero, etc.), true otherwise.

Reimplemented in HessTestMetricAbs_2, MBMesquite::AWShapeSizeOrientNB1, and MBMesquite::AWSizeNB1.

Definition at line 219 of file AWMetric.cpp.

References MBMesquite::do_numerical_hessian().

Referenced by MBMesquite::AWQualityMetric::evaluate_with_Hessian(), MBMesquite::AWQualityMetric::evaluate_with_Hessian_diagonal(), TMetricTest< Metric, DIM >::hess(), TMetricTest< Metric, DIM >::num_hess(), AWMetricTest::test_numerical_hessian_2D(), and AWMetricTest::test_numerical_hessian_3D().

{
    return do_numerical_hessian( this, A, W, result, deriv_wrt_A, hess_wrt_A, err );
}
bool MBMesquite::AWMetric::evaluate_with_hess ( const MsqMatrix< 3, 3 > &  A,
const MsqMatrix< 3, 3 > &  W,
double &  result,
MsqMatrix< 3, 3 > &  deriv_wrt_A,
MsqMatrix< 3, 3 >  second_wrt_A[6],
MsqError err 
) [virtual]

Hessian of \(\mu(A,W)\) with respect to components of A.

Parameters:
A3x3 active matrix
W3x3 target matrix
resultOutput: value of function
deriv_wrt_AOutput: partial deriviatve of \(\mu\) wrt each term of A, evaluated at passed A.
second_wrt_AOutput: 9x9 matrix of second partial deriviatve of \(\mu\) wrt each term of A, in row-major order. The symmetric matrix is decomposed into 3x3 blocks and only the upper diagonal blocks, in row-major order, are returned.

\[\left[\begin{array}{ccc|ccc|ccc} \frac{\partial^{2}\mu}{\partial A_{0,0}^2} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{0,1}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{0,2}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{1,0}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{1,1}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{1,2}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{2,0}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{2,2}} \\ \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{0,1}} & \frac{\partial^{2}\mu}{\partial A_{0,1}^2} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{0,2}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{1,0}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{1,1}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{1,2}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{2,0}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{2,2}} \\ \frac{\partial^{2}\mu}{\partial A_{0,0}\partial A_{0,2}} & \frac{\partial^{2}\mu}{\partial A_{0,1}\partial A_{0,2}} & \frac{\partial^{2}\mu}{\partial A_{0,2}^2} & \frac{\partial^{2}\mu}{\partial A_{0,2}\partial A_{1,0}} & \frac{\partial^{2}\mu}{\partial A_{0,2}\partial A_{1,1}} & \frac{\partial^{2}\mu}{\partial A_{0,2}\partial A_{1,2}} & \frac{\partial^{2}\mu}{\partial A_{0,2}\partial A_{2,0}} & \frac{\partial^{2}\mu}{\partial A_{0,2}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{0,2}\partial A_{2,2}} \\ \hline & & & \frac{\partial^{2}\mu}{\partial A_{1,0}^2} & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{1,1}} & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{1,2}} & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{2,0}} & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{2,2}} \\ & & & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{1,1}} & \frac{\partial^{2}\mu}{\partial A_{1,1}^2} & \frac{\partial^{2}\mu}{\partial A_{1,1}\partial A_{1,2}} & \frac{\partial^{2}\mu}{\partial A_{1,1}\partial A_{2,0}} & \frac{\partial^{2}\mu}{\partial A_{1,1}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{1,1}\partial A_{2,2}} \\ & & & \frac{\partial^{2}\mu}{\partial A_{1,0}\partial A_{1,2}} & \frac{\partial^{2}\mu}{\partial A_{1,1}\partial A_{1,2}} & \frac{\partial^{2}\mu}{\partial A_{1,2}^2} & \frac{\partial^{2}\mu}{\partial A_{1,2}\partial A_{2,0}} & \frac{\partial^{2}\mu}{\partial A_{1,2}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{1,2}\partial A_{2,2}} \\ \hline & & & & & & \frac{\partial^{2}\mu}{\partial A_{2,0}^2} & \frac{\partial^{2}\mu}{\partial A_{2,0}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{2,0}\partial A_{2,2}} \\ & & & & & & \frac{\partial^{2}\mu}{\partial A_{2,0}\partial A_{2,1}} & \frac{\partial^{2}\mu}{\partial A_{2,1}^2} & \frac{\partial^{2}\mu}{\partial A_{2,1}\partial A_{2,2}} \\ & & & & & & \frac{\partial^{2}\mu}{\partial A_{2,0}\partial A_{2,2}} & \frac{\partial^{2}\mu}{\partial A_{2,1}\partial A_{2,2}} & \frac{\partial^{2}\mu}{\partial A_{2,2}^2} \\ \end{array}\right]\]

Returns:
false if function cannot be evaluated for given A and W (e.g. division by zero, etc.), true otherwise.

Reimplemented in HessTestMetricAbs_2, MBMesquite::AWShapeSizeOrientNB1, and MBMesquite::AWSizeNB1.

Definition at line 225 of file AWMetric.cpp.

References MBMesquite::do_numerical_hessian().

{
    return do_numerical_hessian( this, A, W, result, deriv_wrt_A, hess_wrt_A, err );
}

List of all members.


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