Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Mesquite Namespace Reference

Used to hold the error state and return it to the application. More...

Classes

class  Mesh
 A Mesquite::Mesh is a collection of mesh elements which are composed of mesh vertices. Intermediate objects are not accessible through this interface (where intermediate objects include things like the faces of a hex, or an element's edges). More...
 
class  EntityIterator
 Iterates through a set of entities. An EntityIterator is typically obtained via Mesh::vertex_iterator() or Mesh::element_iterator(). An iterator obtained in this way iterates over the set of all vertices/elements in the Mesh from which the iterator was obtained. More...
 
class  MeshDomain
 
class  AddQualityMetric
 Combines two quality metrics (qMetric1 and qMetric2 defined in the parent class CompositeQualityMetric) by addition for two- and three-diminsional elements. Note: This function should not be used to combine a node-based metric with an element-based metric. More...
 
class  ASMQualityMetric
 Computes the ASM (Area Smoothness Metric) of the given element. More...
 
class  AspectRatioGammaQualityMetric
 Object for computing the aspect ratio gamma of simplicial elements. More...
 
class  CompositeOFAdd
 Adds two ObjectiveFunction values together. More...
 
class  CompositeOFMultiply
 Multiplies two ObjectiveFunction values together. More...
 
class  CompositeOFScalarAdd
 Adds a scalar to a given ObjectiveFunction. More...
 
class  CompositeOFScalarMultiply
 Scales a given an ObjectiveFunction. More...
 
class  ShapeGuides811
 Shape Improvement with Unit Aspect Ratio. Use with sR-DFT. More...
 
class  ShapeGuides812
 Shape Improvement with non-Unit Aspect Ratio. Use with sR-DFT. More...
 
class  ShapeSizeGuides821
 Shape and Size Improvement with Unit Aspect Ratio and Equidistributed Size. Use with R-DFT. More...
 
class  ShapeSizeGuides822
 Shape and Size Improvement with Unit Aspect Ratio and Preserved Size. Use with R-DFT. More...
 
class  ShapeSizeGuides823
 Shape and Size Improvement with non-Unit Aspect Ratio and Equidistributed Size. Use with R-DFT. More...
 
class  ShapeSizeGuides824
 Shape and Size Improvement with non-Unit Aspect Ratio and Preserved Size. Use with R-DFT. More...
 
class  RezoneGuides832
 Rezone with Angle Improvement. Use with I-DFT. More...
 
class  DeformingDomainGuides841
 Deforming Domain Mesh Tracking. Use with I-DFT or R-DFT. More...
 
class  DeformingDomainGuides843
 Deforming Domain with Angle Improvement. Use with I-DFT or R-DFT. More...
 
class  DeformingDomainGuides844
 Deforming Domain with Angle Improvement, non-Unit AR. Use with R-DFT. More...
 
class  ConditionNumberQualityMetric
 Computes the condition number of given element. More...
 
class  ConjugateGradient
 Optimizes the objective function using the Polack-Ribiere scheme. More...
 
class  CornerJacobianQualityMetric
 Computes the volume or area of the element, as appropriate. This metric uses the average of the corner Jacobian determinants for the approximation to the volume of hex. More...
 
class  CornerTagHandles
 Utility class to manage tag handles for corner tags. More...
 
class  CornerTag
 A class for caching and managing Tags on element corners. More...
 
class  DistanceFromTarget
 Base class for the computation of the distance from target between the target matrices W and the actual corner matrices A. More...
 
class  EdgeLengthQualityMetric
 Computes the lengths of the edges connected to given a vertex.. More...
 
class  EdgeLengthRangeQualityMetric
 Computes the edge length range metric for a given vertex. More...
 
class  Exponent
 
class  FeasibleNewton
 High Performance implementation of the Feasible Newton algorythm. More...
 
class  FileTokenizer
 Parse a file as space-separated tokens. More...
 
class  GeneralizedConditionNumberQualityMetric
 Computes the condition number of given element. The``condition number" is scaled between one and infinity, with an ideal element having condition number one. More...
 
class  GeomTSTT
 A base class describing a Mesquite::MeshDomain implemented on top of the TSTT geometry and classification interfaces. More...
 
class  I_DFT
 Class containing the target corner matrices for the context based smoothing. More...
 
class  I_DFT_Generalized
 I_DFT metric where mAlpha, mBeta, mGamma, and UseBarrierDelta can be set be the user. Defaults are mAlpha = .5, mBeta = 1, mGamma = 2/3. More...
 
class  I_DFT_InverseMeanRatio
 I_DFT metric with mAlpha = 1/3, mBeta = 0.0, mGamma = 2/3. More...
 
class  I_DFT_NoBarrier
 I_DFT metric with mAlpha = .5, mBeta = 1, mGamma = 0. More...
 
class  I_DFT_StrongBarrier
 I_DFT metric with mAlpha = .5, mBeta = 1, mGamma = 2/3. More...
 
class  I_DFT_WeakBarrier
 I_DFT metric with mAlpha = .5, mBeta = 1, mGamma = 2/3. More...
 
class  IdealWeightInverseMeanRatio
 Computes the inverse mean ratio of given element. More...
 
class  IdealWeightMeanRatio
 Computes the mean ratio quality metric of given element. More...
 
class  InstructionQueue
 An InstructionQueue object gathers Mesquite Instructions and ensures that the instruction queue is coherent for mesh improvement and/or mesh quality assessment purposes. More...
 
class  LaplacianIQ
 
class  LaplacianSmoother
 
class  LInfTemplate
 Computes the L_infinity objective function for a given patch, i.e., LInfTemplate::concrete_evaluate returns the maximum absolute value of the quality metric values on 'patch'. More...
 
class  LocalSizeQualityMetric
 Computes the local size metric for a given vertex. More...
 
class  LPtoPTemplate
 Calculates the L_p objective function raised to the pth power. That is, sums the p_th powers of (the absolute value of) the quality metric values. More...
 
class  LVQDTargetCalculator
 This is an intermediary class. Concrete classes will simply instantiate the various guide enums in their constructor. More...
 
class  Matrix3D
 3*3 Matric class, row-oriented, 0-based [i][j] indexing. More...
 
class  MaxTemplate
 Computes the maximum quality metric value. More...
 
class  MeanMidNodeMover
 Class to adjust positions of higher-order nodes. More...
 
class  MeshImpl
 MeshImpl is a Mesquite implementation of the Mesh interface. Applications can also provide their own implementation of the interface. More...
 
class  MeshImplData
 Class to store mesh representation for MeshImpl. More...
 
class  MeshImplVertIter
 VertexIterator for MeshImpl. More...
 
class  MeshImplElemIter
 ElementIterator for MeshImpl. More...
 
struct  TagDescription
 
class  MeshImplTags
 Store tags and tag data for Mesquite's native mesh representation. More...
 
class  MeshSet
 The MeshSet class stores one or more Mesquite::Mesh pointers and manages access to the mesh information. More...
 
class  MeshTransform
 
class  MeshTSTT
 The name of the tag (integer) used internally by MeshTSTT to eliminate duplicate vertices. More...
 
class  MsqDebug
 Run-time activation/deactivation of debug flags. More...
 
class  MsqError
 Used to hold the error state and return it to the application. More...
 
class  MsqPrintError
 Utility class for printing error data - used in Mesquite tests. More...
 
class  MsqFPE
 Utility class used by InstructionQueue SIGFPE option. More...
 
class  MsqFreeVertexIndexIterator
 iterates over indexes of free vetices in a PatchData. More...
 
class  MsqHessian
 Vector3D is the object that effeciently stores the objective function Hessian each entry is a Matrix3D object (i.e. a vertex Hessian). More...
 
class  MsqInterrupt
 Class to watch for user-interrupt (SIGINT, ctrl-C) More...
 
class  MsqMeshEntity
 MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh. More...
 
class  Timer
 
class  StopWatch
 
class  StopWatchCollection
 
class  FunctionTimer
 
class  MsqVertex
 MsqVertex is the Mesquite object that stores information about the vertices in the mesh. More...
 
class  MultiplyQualityMetric
 Combines two quality metrics (qMetric1 and qMetric2 defined in the parent class CompositeQualityMetric) by multiplication for two- and three-diminsional elements. Note: This function should not be used to combine a node-based metric with an element-based metric. More...
 
struct  ActiveSet
 
class  NonSmoothSteepestDescent
 
class  NullImprover
 
class  ObjectiveFunction
 Base class for concrete Objective Functions ObjectiveFunction contains a pointer to a QualityMetric. If the ObjectiveFunction is associated with more than one QualityMetric (i.e., the Objective is a composite, and the composed ObjectiveFunctions are associated with different QualityMetrics), then the QualityMetric pointer is set to NULL.. More...
 
class  ParameterSet
 
class  PatchData
 
class  PatchDataVerticesMemento
 Contains a copy of the coordinates of a PatchData. More...
 
class  PatchDataMem
 
class  PatchDataParameters
 
class  PatchDataUser
 This should be the parent class of all algorithms retrieving information from a MeshSet object. More...
 
class  PlanarDomain
 
class  PowerQualityMetric
 Raises a single quality metrics (qMetric1) to an arbitrary power (a double value, scaleAlpha) for two- and three-diminsional elements. More...
 
class  QualityAssessor
 A QualityAssessor instance can be inserted into an InstructionQueue to calculate and summarize registered QualityMetrics for the mesh. More...
 
class  QualityImprover
 Base class for all quality improvers. Mote that the PatchData settings are inherited from the PathDataUser class. More...
 
class  QualityMetric
 Base class for concrete quality metrics. More...
 
class  Randomize
 Randomly perftubs the (un-culled) vertices. More...
 
class  RI_DFT
 Class containing the target corner matrices for the context based smoothing. More...
 
class  ScalarAddQualityMetric
 Adds a number (a double) to the quality metric value. More...
 
class  ScalarMultiplyQualityMetric
 Multiplies quality metric value by a number (a double). More...
 
class  ShapeImprovementWrapper
 Wrapper which performs a Feasible Newton solve using an $\ell_2^2 $ objective function template with inverse mean ratio. More...
 
class  ShapeQualityMetric
 
class  sI_DFT
 Class containing the target corner matrices for the context based smoothing. More...
 
class  SmartLaplacianSmoother
 
class  SmoothnessQualityMetric
 
class  SphericalDomain
 
class  sRI_DFT
 Class containing the target corner matrices for the context based smoothing. More...
 
class  SteepestDescent
 
class  TargetCalculator
 Base class that provides the interface for computing the target corner matrices used in the context based smoothing. More...
 
class  TargetMatrix
 Class containing the target corner matrices for the context based smoothing. More...
 
class  TerminationCriterion
 The TerminationCriterion class contains functionality to terminate the VertexMover's optimization. More...
 
class  TopologyInfo
 Information about different element topologies. More...
 
class  TopologyModifier
 
class  UntangleBetaQualityMetric
 The untangle beta quality metric. More...
 
class  UntangleQualityMetric
 
class  Vector3D
 Vector3D is the object that effeciently stores information about about three-deminsional vectors. It is also the parent class of MsqVertex. More...
 
class  VertexConditionNumberQualityMetric
 Computes the condition numbers of the corner's of elements connected to the given vertex and then averages those values. More...
 
class  VertexMover
 
class  VolumeQualityMetric
 
class  WTargetCalculator
 This is a concrete class. More...
 
class  GeomTSTTCommon
 Common code for specific implementations of MeshDomain on TSTT interfaces. More...
 
class  DomainTSTT
 
class  GeomEntTSTT
 
class  TSTTIterator
 Wrapper around single-entity TSTT interator. More...
 
class  SIDLIterator
 Iterate over a sidl array of TSTT entity handles. More...
 
class  TSTTArrIter
 TSTT iterator using array-iterator interface and buffer of handles. More...
 
class  MeshTSTTImpl
 Implementation of MeshTSTT. More...
 

Typedefs

typedef EntityIterator VertexIterator
 
typedef EntityIterator ElementIterator
 
typedef void * TagHandle
 Type used to refer to a tag defintion. More...
 
typedef int StatusCode
 
typedef double real
 
typedef void(* msq_sig_handler_t )(int)
 

Enumerations

enum  DomainHint { NO_DOMAIN_HINT, PLANAR_DOMAIN, LOCAL_PALANAR, SMOOTH_DOMAIN }
 A hint on the characteristics of the domain that Mesquite may use to determine what, if any, scheme to use to cache characteristics of the geometric domain. More...
 
enum  StatusCodeValues { MSQ_FAILURE = 0, MSQ_SUCCESS }
 
enum  EntityTopology {
  POLYGON =7, TRIANGLE =8, QUADRILATERAL =9, POLYHEDRON =10,
  TETRAHEDRON =11, HEXAHEDRON =12, PRISM =13, PYRAMID =14,
  SEPTAHEDRON =15, MIXED
}
 
enum  ReleaseType { STABLE_RELEASE, BETA, ALPHA }
 

Functions

size_t vertices_in_topology (EntityTopology)
 
const char * version_string (bool include_build_number=false)
 
unsigned int major_version_number ()
 
unsigned int minor_version_number ()
 
unsigned int build_number ()
 
Mesquite::ReleaseType release_type ()
 
template<class T >
MSQ_MIN_2 (T a, T b)
 
template<class T >
MSQ_MAX_2 (T a, T b)
 
double cbrt (double d)
 
double cbrt_sqr (double d)
 
double pow (double value, const Exponent &exp)
 
bool m_gdft_2 (double &obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_2 (double &obj, Vector3D g_obj[3], const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_2 (double &obj, Vector3D g_obj[3], Matrix3D h_obj[6], const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool m_gdft_3 (double &obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_3 (double &obj, Vector3D g_obj[4], const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_3 (double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_2_v0 (double &obj, Vector3D &g_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_2_v1 (double &obj, Vector3D &g_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_2_v2 (double &obj, Vector3D &g_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_2_v0 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_2_v1 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_2_v2 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[3], const Vector3D &n, const Matrix3D &invR, const Matrix3D &Q, const double alpha=0.5, const Exponent &gamma=1.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_3_v0 (double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_3_v1 (double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_3_v2 (double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool g_gdft_3_v3 (double &obj, Vector3D &g_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_3_v0 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_3_v1 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_3_v2 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
bool h_gdft_3_v3 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const Matrix3D &invR, const Matrix3D &Q, const double alpha=1.0/3.0, const Exponent &gamma=2.0/3.0, const double delta=0.0, const double beta=0.0)
 
void centroid_smooth_mesh (PatchData &pd, size_t num_adj_vtx, msq_std::vector< size_t > adj_vtx_ind, size_t free_ind, size_t dimension, MsqError &err)
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &s, const Matrix3D &A)
 
msq_stdio::istream & operator>> (msq_stdio::istream &s, Matrix3D &A)
 
bool operator== (const Matrix3D &lhs, const Matrix3D &rhs)
 
bool operator!= (const Matrix3D &lhs, const Matrix3D &rhs)
 
const Matrix3D operator+ (const Matrix3D &A, const Matrix3D &B)
 
const Matrix3D operator- (const Matrix3D &A, const Matrix3D &B)
 
const Matrix3D mult_element (const Matrix3D &A, const Matrix3D &B)
 Multiplies entry by entry. This is NOT a matrix multiplication. More...
 
double Frobenius_2 (const Matrix3D &A)
 Return the square of the Frobenius norm of A, i.e. sum (diag (A' * A)) More...
 
Matrix3D transpose (const Matrix3D &A)
 
const Matrix3D operator* (const Matrix3D &A, const Matrix3D &B)
 
const Matrix3D operator* (const double &s, const Matrix3D &A)
 friend function to allow for commutatative property of scalar mulitplication. More...
 
int matmult (Matrix3D &C, const Matrix3D &A, const Matrix3D &B)
 $ C = A \times B $ More...
 
const Vector3D operator* (const Matrix3D &A, const Vector3D &x)
 Computes $ A v $ . More...
 
const Vector3D operator* (const Vector3D &x, const Matrix3D &A)
 Computes $ v^T A $ . More...
 
void eqAx (Vector3D &v, const Matrix3D &A, const Vector3D &x)
 
void plusEqAx (Vector3D &v, const Matrix3D &A, const Vector3D &x)
 
void plusEqTransAx (Vector3D &v, const Matrix3D &A, const Vector3D &x)
 
void plusEqaA (Matrix3D &B, const double a, const Matrix3D &A)
 
double det (const Matrix3D &A)
 
void inv (Matrix3D &Ainv, const Matrix3D &A)
 
void timesInvA (Matrix3D &B, const Matrix3D &A)
 
void QR (Matrix3D &Q, Matrix3D &R, const Matrix3D &A)
 
bool m_fcn_2e (double &obj, const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c)
 
bool g_fcn_2e (double &obj, Vector3D g_obj[3], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c)
 
bool h_fcn_2e (double &obj, Vector3D g_obj[3], Matrix3D h_obj[6], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c)
 
bool m_fcn_2i (double &obj, const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
 
bool g_fcn_2i (double &obj, Vector3D g_obj[3], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
 
bool h_fcn_2i (double &obj, Vector3D g_obj[3], Matrix3D h_obj[6], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
 
bool m_fcn_3e (double &obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool g_fcn_3e (double &obj, Vector3D g_obj[4], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool h_fcn_3e (double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool g_fcn_3e_v3 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool g_fcn_3e_v0 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool g_fcn_3e_v1 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool g_fcn_3e_v2 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool h_fcn_3e_v3 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool h_fcn_3e_v0 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool h_fcn_3e_v1 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool h_fcn_3e_v2 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
 
bool m_fcn_3i (double &obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
 
bool g_fcn_3i (double &obj, Vector3D g_obj[4], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
 
int h_fcn_3i (double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
 
void test_aomd (void)
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &, const MsqError &)
 Print message and stack trace. More...
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &, const MsqError::Trace &)
 Print MsqError::Trace. More...
 
void axpy (Vector3D res[], size_t size_r, const MsqHessian &H, const Vector3D x[], size_t size_x, const Vector3D y[], size_t size_y, MsqError &)
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &s, const MsqHessian &h)
 Prints out the MsqHessian blocks. More...
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &, StopWatchCollection &coll)
 
void print_timing_diagnostics (int debugflag)
 
void print_timing_diagnostics (msq_stdio::ostream &stream)
 
static msq_std::string process_tstt_error (TSTTB::Error &tstt_err)
 
template<class T >
static T * convert_from_sidl_vector (sidl::array< T > &array)
 
template<class T >
static sidl::array< T > alloc_sidl_vector (size_t size)
 
template<class T >
static sidl::array< T > alloc_sidl_vector (size_t size, T init)
 
template<class S , class T >
static void copy_from_sidl (sidl::array< S > &source, T *target)
 
template<class T >
static sidl::array< T > convert_to_sidl_vector (T *array, size_t size)
 
const Vector3D operator+ (const Vector3D &lhs, const Vector3D &rhs)
 
const Vector3D operator- (const Vector3D &lhs, const Vector3D &rhs)
 
const Vector3D operator* (const Vector3D &lhs, const double scalar)
 
const Vector3D operator* (const double scalar, const Vector3D &rhs)
 
const Vector3D operator/ (const Vector3D &lhs, const double scalar)
 
double operator% (const Vector3D &lhs, const Vector3D &rhs)
 
double inner (const Vector3D lhs[], const Vector3D rhs[], int n)
 
double operator% (const double scalar, const Vector3D &rhs)
 
double operator% (const Vector3D &lhs, const double scalar)
 
const Vector3D operator* (const Vector3D &lhs, const Vector3D &rhs)
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &s, const Mesquite::Vector3D &v)
 
double length (Vector3D *const v, int n)
 
double Linf (Vector3D *const v, int n)
 
bool operator== (const Vector3D &v1, const Vector3D &v2)
 
bool operator!= (const Vector3D &v1, const Vector3D &v2)
 
ostream & operator<< (ostream &stream, const MsqMeshEntity &entity)
 
ostream & operator<< (ostream &stream, const PatchData &pd)
 
static msq_std::string process_tstt_error (TSTTB::Error &tstt_err)
 
template<class T >
static T * convert_from_sidl_vector (sidl::array< T > &array)
 
template<class T >
static sidl::array< T > alloc_sidl_vector (size_t size)
 
template<class T >
static sidl::array< T > alloc_sidl_vector (size_t size, T init)
 
template<class S , class T >
static void copy_from_sidl (sidl::array< S > &source, T *target)
 
template<class T >
static sidl::array< T > convert_to_sidl_vector (T *array, size_t size)
 
void msq_sigint_handler (int)
 

Variables

const int MSQ_MAX_NUM_VERT_PER_ENT =8
 
const int MSQ_HIST_SIZE =7
 
static const double MSQ_SQRT_TWO = msq_stdc::sqrt(2.0)
 
static const double MSQ_SQRT_THREE = msq_stdc::sqrt(3.0)
 
static const double MSQ_SQRT_THREE_DIV_TWO =MSQ_SQRT_THREE/2.0
 
static const double MSQ_SQRT_THREE_INV =1.0/MSQ_SQRT_THREE
 
static const double MSQ_SQRT_TWO_INV =1.0/MSQ_SQRT_TWO
 
static const double MSQ_SQRT_TWO_DIV_SQRT_THREE =MSQ_SQRT_TWO/MSQ_SQRT_THREE
 
static const double MSQ_ONE_THIRD = 1.0 / 3.0
 
static const double MSQ_TWO_THIRDS = 2.0 / 3.0
 
static const double MSQ_3RT_2_OVER_6RT_3 = msq_stdc::pow( 2/MSQ_SQRT_THREE, MSQ_ONE_THIRD )
 
const unsigned MSQ_UINT_MAX = ~(unsigned)0
 
const int MSQ_INT_MAX = MSQ_UINT_MAX >> 1
 
const int MSQ_INT_MIN = ~MSQ_INT_MAX
 
const double MSQ_DBL_MIN = 1.0E-30
 
const double MSQ_MIN = MSQ_DBL_MIN
 
const double MSQ_DBL_MAX = 1.0E30
 
const double MSQ_MAX = MSQ_DBL_MAX
 
const double MSQ_MAX_CAP = 1.e6
 
const char *const VERTEX_BYTE_TAG_NAME = "MesquiteVertexByte"
 The name of the tag (integer) that Mesquite will use to store internal data. More...
 
const char *const VERTEX_FIXED_TAG_NAME = "MesquiteVertexFixed"
 The name of the tag (integer) Mesquite expects to be non-zero for vertices which are not to be moved by Mesquite. More...
 
Mesquite::StopWatchCollection GlobalStopWatches
 
const unsigned long GRAD_FLAGS
 
const unsigned long OF_FLAGS
 
const char *const vtk_type_names []
 
const msq_std::vector< size_t > dummy_list
 
const Vector3D dummy_vtx
 
msq_sig_handler_t oldHandler = SIG_ERR
 
const int DEFAULT_HISTOGRAM_INTERVALS = 10
 

Detailed Description

Used to hold the error state and return it to the application.

Copyright 2003 Sandia Corporation and the University of Chicago. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation and Contract W-31-109-ENG-38 with the University of Chicago, the U.S. Government retains certain rights in this software.

Author
Jason Kraftcheck
Date
2004-09-17

Typedef Documentation

Definition at line 60 of file MeshInterface.hpp.

typedef void(* msq_sig_handler_t)(int)

Definition at line 34 of file Misc/MsqInterrupt.cpp.

typedef double real

Definition at line 84 of file Mesquite.hpp.

typedef int StatusCode

Definition at line 82 of file Mesquite.hpp.

typedef void* TagHandle

Type used to refer to a tag defintion.

Definition at line 63 of file MeshInterface.hpp.

Definition at line 58 of file MeshInterface.hpp.

Enumeration Type Documentation

enum DomainHint

A hint on the characteristics of the domain that Mesquite may use to determine what, if any, scheme to use to cache characteristics of the geometric domain.

Enumerator
NO_DOMAIN_HINT 
PLANAR_DOMAIN 
LOCAL_PALANAR 
SMOOTH_DOMAIN 

Definition at line 446 of file MeshInterface.hpp.

446  {
447  NO_DOMAIN_HINT, //< Do not make any assumptions about the domain.
448  PLANAR_DOMAIN, //< Domain is planar
449  LOCAL_PALANAR, //< Domain is close to planar
450  SMOOTH_DOMAIN //< Domain is C1-continuous
451  };
Enumerator
POLYGON 
TRIANGLE 
QUADRILATERAL 
POLYHEDRON 
TETRAHEDRON 
HEXAHEDRON 
PRISM 
PYRAMID 
SEPTAHEDRON 
MIXED 

Definition at line 92 of file Mesquite.hpp.

Enumerator
STABLE_RELEASE 
BETA 
ALPHA 

Definition at line 111 of file Mesquite.hpp.

Enumerator
MSQ_FAILURE 
MSQ_SUCCESS 

Definition at line 86 of file Mesquite.hpp.

Function Documentation

static sidl::array<T> Mesquite::alloc_sidl_vector ( size_t  size)
inlinestatic

Definition at line 26 of file includeLinks/TSTTUtil.hpp.

Referenced by MeshTSTTImpl::tag_get_data(), and MeshTSTTImpl::tag_set_data().

27 {
28  int32_t lower = 0;
29  int32_t upper = size - 1;
30  return sidl::array<T>::createCol( 1, &lower, &upper );
31 }

Here is the caller graph for this function:

static sidl::array<T> Mesquite::alloc_sidl_vector ( size_t  size)
inlinestatic

Definition at line 26 of file src/Mesh/TSTTUtil.hpp.

27 {
28  int32_t lower = 0;
29  int32_t upper = size - 1;
30  return sidl::array<T>::createCol( 1, &lower, &upper );
31 }
static sidl::array<T> Mesquite::alloc_sidl_vector ( size_t  size,
init 
)
inlinestatic

Definition at line 33 of file includeLinks/TSTTUtil.hpp.

References convert_from_sidl_vector().

34 {
35  sidl::array<T> result = alloc_sidl_vector<T>(size);
36  T* ptr = convert_from_sidl_vector( result );
37  for ( T* const end = ptr + size; ptr != end; ++ptr)
38  *ptr = init;
39  return result;
40 }
static T * convert_from_sidl_vector(sidl::array< T > &array)

Here is the call graph for this function:

static sidl::array<T> Mesquite::alloc_sidl_vector ( size_t  size,
init 
)
inlinestatic

Definition at line 33 of file src/Mesh/TSTTUtil.hpp.

References convert_from_sidl_vector().

34 {
35  sidl::array<T> result = alloc_sidl_vector<T>(size);
36  T* ptr = convert_from_sidl_vector( result );
37  for ( T* const end = ptr + size; ptr != end; ++ptr)
38  *ptr = init;
39  return result;
40 }
static T * convert_from_sidl_vector(sidl::array< T > &array)

Here is the call graph for this function:

void axpy ( Vector3D  res[],
size_t  size_r,
const MsqHessian &  H,
const Vector3D  x[],
size_t  size_x,
const Vector3D  y[],
size_t  size_y,
MsqError &   
)
inline
Parameters
res,:array of Vector3D in which the result is stored.
size_r,:size of the res array.
x,:vector multiplied by the Hessian.
size_x,:size of the x array.
y,:vector added to the Hessian vector product. Set to 0 (NULL) if not needed.
size_y,:size of the y array. Set to 0 if not needed.

Definition at line 187 of file includeLinks/MsqHessian.hpp.

References eqAx(), i, j, MsqHessian::mColIndex, MsqHessian::mEntries, MsqHessian::mRowStart, MsqHessian::mSize, plusEqAx(), and plusEqTransAx().

190  {
191  if ((size_r != H.mSize) || (size_x != H.mSize) ||
192  (size_y != H.mSize && size_y != 0)) {
193  // throw an error
194  }
195 
196  Vector3D tmpx, tmpm; // for cache opt.
197  size_t* col = H.mColIndex;
198  const size_t nn = H.mSize;
199  size_t rl; // row length
200  size_t el; // entries index
201  size_t lo;
202  size_t c; // column index
203  size_t i, j;
204 
205  if (y != 0) {
206  for (i = 0; i < nn; ++i) {
207  res[i] = y[i];
208  }
209  }
210  else { // y == 0
211  for (i = 0; i < nn; ++i) {
212  res[i] = 0.;
213  }
214  }
215 
216  el = 0;
217  for (i = 0; i < nn; ++i) {
218  rl = H.mRowStart[i+1] - H.mRowStart[i];
219  lo = *col++;
220 
221  // Diagonal entry
222  tmpx = x[i];
223  eqAx(tmpm, H.mEntries[el], tmpx);
224  ++el;
225 
226  //Non-diagonal entries
227  for (j = 1; j < rl; ++j) {
228  c = *col++;
229  // res[i] += H.mEntries[e] * x[c];
230  plusEqAx(tmpm, H.mEntries[el], x[c]);
231  // res[c] += transpose(H.mEntries[e]) * tmpxi;
232  plusEqTransAx(res[c], H.mEntries[el], tmpx);
233  ++el;
234  }
235  res[lo] += tmpm;
236  }
237  }
void int int REAL REAL * y
Definition: read.cpp:74
void plusEqAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)
void plusEqTransAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)
NVec< 3, double > Vector3D
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
j indices j
Definition: Indexing.h:6
void eqAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)

Here is the call graph for this function:

unsigned int build_number ( )

Definition at line 56 of file Misc/MesquiteVersion.cpp.

References MSQ_BUILD_NUMBER.

57 {
58  return MSQ_BUILD_NUMBER;
59 }
#define MSQ_BUILD_NUMBER
double Mesquite::cbrt ( double  d)
inline

Definition at line 182 of file Mesquite.hpp.

References MSQ_ONE_THIRD, and pow().

Referenced by cbrt_sqr(), TargetCalculator::compute_Delta_3D(), TargetCalculator::compute_Lambda(), TargetCalculator::compute_Q_3D(), and Exponent::cubeRoot().

183 {
184 #ifdef HAVE_CBRT
185  return ::cbrt( d );
186 #else
187  return msq_stdc::pow( d, MSQ_ONE_THIRD );
188 #endif
189 }
static const double MSQ_ONE_THIRD
Definition: Mesquite.hpp:128
const NT & d
double cbrt(double d)
Definition: Mesquite.hpp:182
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

double Mesquite::cbrt_sqr ( double  d)
inline

Definition at line 191 of file Mesquite.hpp.

References cbrt(), MSQ_TWO_THIRDS, and pow().

Referenced by Exponent::powTwoThirds().

192 {
193 #ifdef HAVE_CBRT
194  return ::cbrt(d*d);
195 #else
196  return msq_stdc::pow( d, MSQ_TWO_THIRDS );
197 #endif
198 }
static const double MSQ_TWO_THIRDS
Definition: Mesquite.hpp:129
const NT & d
double cbrt(double d)
Definition: Mesquite.hpp:182
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

void centroid_smooth_mesh ( PatchData &  pd,
size_t  num_adj_vtx,
msq_std::vector< size_t >  adj_vtx_ind,
size_t  free_ind,
size_t  dimension,
MsqError &  err 
)
inline

Definition at line 76 of file includeLinks/LaplacianSmoother.hpp.

References PatchData::get_vertex_array(), MsqError::INVALID_ARG, j, and MSQ_SETERR.

Referenced by SmartLaplacianSmoother::optimize_vertex_positions(), and LaplacianSmoother::optimize_vertex_positions().

80  {
81  MsqVertex* verts=pd.get_vertex_array(err);
82  msq_std::vector<size_t>::iterator iter;
83 
84  size_t j;
85  double scale_val=1.0;
86  if (num_adj_vtx==0) {
87  MSQ_SETERR(err)("Number of incident vertices is zero",MsqError::INVALID_ARG);
88  return;
89  }
90  else
91  scale_val=1.0/((double) num_adj_vtx);
92  double avg[3];
93  //loop over the two or three dimensions
94  for(j=0;j<dimension;++j) {
95  //set the iterator to the beginning ob adj_vtx_ind
96  iter=adj_vtx_ind.begin();
97  avg[j] = 0.;
98  while(iter != adj_vtx_ind.end()){
99  avg[j]+=verts[*iter][j];
100  ++iter;
101  }
102  //divide the average by the number of adj. verts
103  verts[free_ind][j] = avg[j]*scale_val;
104  }
105 
106  return;
107  }
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
j indices j
Definition: Indexing.h:6

Here is the call graph for this function:

Here is the caller graph for this function:

static T* Mesquite::convert_from_sidl_vector ( sidl::array< T > &  array)
inlinestatic

Definition at line 23 of file includeLinks/TSTTUtil.hpp.

Referenced by alloc_sidl_vector(), MeshTSTTImpl::cache_adjacent_elements(), GeomTSTTCommon::closest_and_normal(), GeomTSTTCommon::move_to(), GeomTSTTCommon::normal(), and MeshTSTTImpl::vertex_get_attached_elements().

24 { return reinterpret_cast<T*>(array._get_ior()->d_firstElement); }

Here is the caller graph for this function:

static T* Mesquite::convert_from_sidl_vector ( sidl::array< T > &  array)
inlinestatic

Definition at line 23 of file src/Mesh/TSTTUtil.hpp.

24 { return reinterpret_cast<T*>(array._get_ior()->d_firstElement); }
static sidl::array<T> Mesquite::convert_to_sidl_vector ( T *  array,
size_t  size 
)
inlinestatic
static sidl::array<T> Mesquite::convert_to_sidl_vector ( T *  array,
size_t  size 
)
inlinestatic

Definition at line 51 of file src/Mesh/TSTTUtil.hpp.

52 {
53  sidl::array<T> result;
54  int32_t lower = 0, upper = size - 1, stride = 1;
55  result.borrow( array, 1, &lower, &upper, &stride );
56  return result;
57 }
static void Mesquite::copy_from_sidl ( sidl::array< S > &  source,
T *  target 
)
inlinestatic

Definition at line 42 of file includeLinks/TSTTUtil.hpp.

References i.

Referenced by MeshTSTTImpl::elements_get_attached_vertices().

44 {
45  typename sidl::array<S>::iterator i = source.begin();
46  for (; i != source.end(); ++i, ++target)
47  *target = (T)*i;
48 }
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

static void Mesquite::copy_from_sidl ( sidl::array< S > &  source,
T *  target 
)
inlinestatic

Definition at line 42 of file src/Mesh/TSTTUtil.hpp.

References i.

44 {
45  typename sidl::array<S>::iterator i = source.begin();
46  for (; i != source.end(); ++i, ++target)
47  *target = (T)*i;
48 }
blockLoc i
Definition: read.cpp:79
double det ( const Matrix3D &  A)
inline
void eqAx ( Vector3D &  v,
const Matrix3D &  A,
const Vector3D &  x 
)
inline

Definition at line 522 of file includeLinks/Matrix3D.hpp.

References Vector3D::mCoords, and Matrix3D::v_.

Referenced by axpy().

523  {
524  v.mCoords[0] = A.v_[0]*x[0] + A.v_[1]*x.mCoords[1] + A.v_[2]*x.mCoords[2];
525  v.mCoords[1] = A.v_[3]*x[0] + A.v_[4]*x.mCoords[1] + A.v_[5]*x.mCoords[2];
526  v.mCoords[2] = A.v_[6]*x[0] + A.v_[7]*x.mCoords[1] + A.v_[8]*x.mCoords[2];
527  }
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

double Frobenius_2 ( const Matrix3D &  A)
inline

Return the square of the Frobenius norm of A, i.e. sum (diag (A' * A))

Definition at line 326 of file includeLinks/Matrix3D.hpp.

References i.

Referenced by sI_DFT::evaluate_element(), and sRI_DFT::evaluate_element().

327  {
328  double fro=0.;
329  for (int i=0; i<3; ++i) {
330  fro += A[0][i]*A[0][i] + A[1][i]*A[1][i] + A[2][i]*A[2][i] ;
331  }
332  return fro;
333  }
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

bool g_fcn_2e ( double &  obj,
Vector3D  g_obj[3],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 170 of file includeLinks/MeanRatioFunctions.hpp.

References isqrt3, MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_gradient(), and IdealWeightMeanRatio::compute_element_analytical_gradient().

173 {
174  double matr[9], f;
175  double adj_m[9], g; // adj_m[2,5,8] not used
176  double loc1, loc2, loc3;
177 
178  /* Calculate M = [A*inv(W) n] */
179  matr[0] = x[1][0] - x[0][0];
180  matr[1] = (2.0*x[2][0] - x[1][0] - x[0][0])*isqrt3;
181  matr[2] = n[0];
182 
183  matr[3] = x[1][1] - x[0][1];
184  matr[4] = (2.0*x[2][1] - x[1][1] - x[0][1])*isqrt3;
185  matr[5] = n[1];
186 
187  matr[6] = x[1][2] - x[0][2];
188  matr[7] = (2.0*x[2][2] - x[1][2] - x[0][2])*isqrt3;
189  matr[8] = n[2];
190 
191  /* Calculate det([n M]). */
192  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
193  loc2 = matr[2]*matr[7] - matr[1]*matr[8];
194  loc3 = matr[1]*matr[5] - matr[2]*matr[4];
195  g = matr[0]*loc1 + matr[3]*loc2 + matr[6]*loc3;
196  if (g < MSQ_MIN) { obj = g; return false; }
197 
198  /* Calculate norm(M). */
199  f = matr[0]*matr[0] + matr[1]*matr[1] +
200  matr[3]*matr[3] + matr[4]*matr[4] +
201  matr[6]*matr[6] + matr[7]*matr[7];
202 
203  /* Calculate objective function. */
204  obj = a * pow(f, b) * pow(g, c);
205 
206  /* Calculate the derivative of the objective function. */
207  f = b * obj / f; /* Constant on nabla f */
208  g = c * obj / g; /* Constant on nable g */
209  f *= 2.0; /* Modification for nabla f */
210 
211  adj_m[0] = matr[0]*f + loc1*g;
212  adj_m[3] = matr[3]*f + loc2*g;
213  adj_m[6] = matr[6]*f + loc3*g;
214 
215  loc1 = matr[0]*g;
216  loc2 = matr[3]*g;
217  loc3 = matr[6]*g;
218 
219  adj_m[1] = matr[1]*f + loc3*matr[5] - loc2*matr[8];
220  adj_m[4] = matr[4]*f + loc1*matr[8] - loc3*matr[2];
221  adj_m[7] = matr[7]*f + loc2*matr[2] - loc1*matr[5];
222 
223  loc1 = isqrt3*adj_m[1];
224  g_obj[0][0] = -adj_m[0] - loc1;
225  g_obj[1][0] = adj_m[0] - loc1;
226  g_obj[2][0] = 2.0*loc1;
227 
228  loc1 = isqrt3*adj_m[4];
229  g_obj[0][1] = -adj_m[3] - loc1;
230  g_obj[1][1] = adj_m[3] - loc1;
231  g_obj[2][1] = 2.0*loc1;
232 
233  loc1 = isqrt3*adj_m[7];
234  g_obj[0][2] = -adj_m[6] - loc1;
235  g_obj[1][2] = adj_m[6] - loc1;
236  g_obj[2][2] = 2.0*loc1;
237  return true;
238 }
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_fcn_2i ( double &  obj,
Vector3D  g_obj[3],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
)
inline

Definition at line 584 of file includeLinks/MeanRatioFunctions.hpp.

References MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_gradient(), and IdealWeightMeanRatio::compute_element_analytical_gradient().

588 {
589  double matr[9], f;
590  double adj_m[9], g; // adj_m[2,5,8] not used
591  double loc1, loc2, loc3;
592 
593  /* Calculate M = [A*inv(W) n] */
594  matr[0] = d[0]*(x[1][0] - x[0][0]);
595  matr[1] = d[1]*(x[2][0] - x[0][0]);
596  matr[2] = n[0];
597 
598  matr[3] = d[0]*(x[1][1] - x[0][1]);
599  matr[4] = d[1]*(x[2][1] - x[0][1]);
600  matr[5] = n[1];
601 
602  matr[6] = d[0]*(x[1][2] - x[0][2]);
603  matr[7] = d[1]*(x[2][2] - x[0][2]);
604  matr[8] = n[2];
605 
606  /* Calculate det([n M]). */
607  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
608  loc2 = matr[2]*matr[7] - matr[1]*matr[8];
609  loc3 = matr[1]*matr[5] - matr[2]*matr[4];
610  g = matr[0]*loc1 + matr[3]*loc2 + matr[6]*loc3;
611  if (g < MSQ_MIN) { obj = g; return false; }
612 
613  /* Calculate norm(M). */
614  f = matr[0]*matr[0] + matr[1]*matr[1] +
615  matr[3]*matr[3] + matr[4]*matr[4] +
616  matr[6]*matr[6] + matr[7]*matr[7];
617 
618  /* Calculate objective function. */
619  obj = a * pow(f, b) * pow(g, c);
620 
621  /* Calculate the derivative of the objective function. */
622  f = b * obj / f; /* Constant on nabla f */
623  g = c * obj / g; /* Constant on nable g */
624  f *= 2.0; /* Modification for nabla f */
625 
626  adj_m[0] = d[0]*(matr[0]*f + loc1*g);
627  adj_m[3] = d[0]*(matr[3]*f + loc2*g);
628  adj_m[6] = d[0]*(matr[6]*f + loc3*g);
629 
630  loc1 = matr[0]*g;
631  loc2 = matr[3]*g;
632  loc3 = matr[6]*g;
633 
634  adj_m[1] = d[1]*(matr[1]*f + loc3*matr[5] - loc2*matr[8]);
635  adj_m[4] = d[1]*(matr[4]*f + loc1*matr[8] - loc3*matr[2]);
636  adj_m[7] = d[1]*(matr[7]*f + loc2*matr[2] - loc1*matr[5]);
637 
638  g_obj[0][0] = -adj_m[0] - adj_m[1];
639  g_obj[1][0] = adj_m[0];
640  g_obj[2][0] = adj_m[1];
641 
642  g_obj[0][1] = -adj_m[3] - adj_m[4];
643  g_obj[1][1] = adj_m[3];
644  g_obj[2][1] = adj_m[4];
645 
646  g_obj[0][2] = -adj_m[6] - adj_m[7];
647  g_obj[1][2] = adj_m[6];
648  g_obj[2][2] = adj_m[7];
649  return true;
650 }
const NT & d
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_fcn_3e ( double &  obj,
Vector3D  g_obj[4],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 973 of file includeLinks/MeanRatioFunctions.hpp.

References isqrt3, isqrt6, MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_gradient(), and IdealWeightMeanRatio::compute_element_analytical_gradient().

975 {
976  double matr[9], f;
977  double adj_m[9], g;
978  double loc1, loc2, loc3;
979 
980  /* Calculate M = A*inv(W). */
981  f = x[1][0] + x[0][0];
982  matr[0] = x[1][0] - x[0][0];
983  matr[1] = (2.0*x[2][0] - f)*isqrt3;
984  matr[2] = (3.0*x[3][0] - x[2][0] - f)*isqrt6;
985 
986  f = x[1][1] + x[0][1];
987  matr[3] = x[1][1] - x[0][1];
988  matr[4] = (2.0*x[2][1] - f)*isqrt3;
989  matr[5] = (3.0*x[3][1] - x[2][1] - f)*isqrt6;
990 
991  f = x[1][2] + x[0][2];
992  matr[6] = x[1][2] - x[0][2];
993  matr[7] = (2.0*x[2][2] - f)*isqrt3;
994  matr[8] = (3.0*x[3][2] - x[2][2] - f)*isqrt6;
995 
996  /* Calculate det(M). */
997  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
998  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
999  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
1000  g = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
1001  if (g < MSQ_MIN) { obj = g; return false; }
1002 
1003  /* Calculate norm(M). */
1004  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
1005  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
1006  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
1007 
1008  /* Calculate objective function. */
1009  obj = a * pow(f, b) * pow(g, c);
1010 
1011  /* Calculate the derivative of the objective function. */
1012  f = b * obj / f; /* Constant on nabla f */
1013  g = c * obj / g; /* Constant on nable g */
1014  f *= 2.0; /* Modification for nabla f */
1015 
1016  adj_m[0] = matr[0]*f + loc1*g;
1017  adj_m[1] = matr[1]*f + loc2*g;
1018  adj_m[2] = matr[2]*f + loc3*g;
1019 
1020  loc1 = matr[0]*g;
1021  loc2 = matr[1]*g;
1022  loc3 = matr[2]*g;
1023 
1024  adj_m[3] = matr[3]*f + loc3*matr[7] - loc2*matr[8];
1025  adj_m[4] = matr[4]*f + loc1*matr[8] - loc3*matr[6];
1026  adj_m[5] = matr[5]*f + loc2*matr[6] - loc1*matr[7];
1027 
1028  adj_m[6] = matr[6]*f + loc2*matr[5] - loc3*matr[4];
1029  adj_m[7] = matr[7]*f + loc3*matr[3] - loc1*matr[5];
1030  adj_m[8] = matr[8]*f + loc1*matr[4] - loc2*matr[3];
1031 
1032  loc1 = isqrt3*adj_m[1];
1033  loc2 = isqrt6*adj_m[2];
1034  loc3 = loc1 + loc2;
1035  g_obj[0][0] = -adj_m[0] - loc3;
1036  g_obj[1][0] = adj_m[0] - loc3;
1037  g_obj[2][0] = 2.0*loc1 - loc2;
1038  g_obj[3][0] = 3.0*loc2;
1039 
1040  loc1 = isqrt3*adj_m[4];
1041  loc2 = isqrt6*adj_m[5];
1042  loc3 = loc1 + loc2;
1043  g_obj[0][1] = -adj_m[3] - loc3;
1044  g_obj[1][1] = adj_m[3] - loc3;
1045  g_obj[2][1] = 2.0*loc1 - loc2;
1046  g_obj[3][1] = 3.0*loc2;
1047 
1048  loc1 = isqrt3*adj_m[7];
1049  loc2 = isqrt6*adj_m[8];
1050  loc3 = loc1 + loc2;
1051  g_obj[0][2] = -adj_m[6] - loc3;
1052  g_obj[1][2] = adj_m[6] - loc3;
1053  g_obj[2][2] = 2.0*loc1 - loc2;
1054  g_obj[3][2] = 3.0*loc2;
1055  return true;
1056 }
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_fcn_3e_v0 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1681 of file includeLinks/MeanRatioFunctions.hpp.

References g_fcn_3e_v3().

1683 {
1684  static Vector3D my_x[4];
1685 
1686  my_x[0] = x[1];
1687  my_x[1] = x[3];
1688  my_x[2] = x[2];
1689  my_x[3] = x[0];
1690  return g_fcn_3e_v3(obj, g_obj, my_x, a, b, c);
1691 }
NVec< 3, double > Vector3D
void int int REAL * x
Definition: read.cpp:74
bool g_fcn_3e_v3(double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)

Here is the call graph for this function:

bool g_fcn_3e_v1 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1693 of file includeLinks/MeanRatioFunctions.hpp.

References g_fcn_3e_v3().

1695 {
1696  static Vector3D my_x[4];
1697 
1698  my_x[0] = x[0];
1699  my_x[1] = x[2];
1700  my_x[2] = x[3];
1701  my_x[3] = x[1];
1702  return g_fcn_3e_v3(obj, g_obj, my_x, a, b, c);
1703 }
NVec< 3, double > Vector3D
void int int REAL * x
Definition: read.cpp:74
bool g_fcn_3e_v3(double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)

Here is the call graph for this function:

bool g_fcn_3e_v2 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1705 of file includeLinks/MeanRatioFunctions.hpp.

References g_fcn_3e_v3().

1707 {
1708  static Vector3D my_x[4];
1709 
1710  my_x[0] = x[1];
1711  my_x[1] = x[0];
1712  my_x[2] = x[3];
1713  my_x[3] = x[2];
1714  return g_fcn_3e_v3(obj, g_obj, my_x, a, b, c);
1715 }
NVec< 3, double > Vector3D
void int int REAL * x
Definition: read.cpp:74
bool g_fcn_3e_v3(double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)

Here is the call graph for this function:

bool g_fcn_3e_v3 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1629 of file includeLinks/MeanRatioFunctions.hpp.

References isqrt3, isqrt6, MSQ_MIN, pow(), and tisqrt6.

Referenced by g_fcn_3e_v0(), g_fcn_3e_v1(), and g_fcn_3e_v2().

1631 {
1632  double matr[9], f, g;
1633  double loc1, loc2, loc3;
1634 
1635  /* Calculate M = A*inv(W). */
1636  f = x[1][0] + x[0][0];
1637  matr[0] = x[1][0] - x[0][0];
1638  matr[1] = (2.0*x[2][0] - f)*isqrt3;
1639  matr[2] = (3.0*x[3][0] - x[2][0] - f)*isqrt6;
1640 
1641  f = x[1][1] + x[0][1];
1642  matr[3] = x[1][1] - x[0][1];
1643  matr[4] = (2.0*x[2][1] - f)*isqrt3;
1644  matr[5] = (3.0*x[3][1] - x[2][1] - f)*isqrt6;
1645 
1646  f = x[1][2] + x[0][2];
1647  matr[6] = x[1][2] - x[0][2];
1648  matr[7] = (2.0*x[2][2] - f)*isqrt3;
1649  matr[8] = (3.0*x[3][2] - x[2][2] - f)*isqrt6;
1650 
1651  /* Calculate det(M). */
1652  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
1653  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
1654  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
1655  g = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
1656  if (g < MSQ_MIN) { obj = g; return false; }
1657 
1658  /* Calculate norm(M). */
1659  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
1660  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
1661  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
1662 
1663  /* Calculate objective function. */
1664  obj = a * pow(f, b) * pow(g, c);
1665 
1666  /* Calculate the derivative of the objective function. */
1667  f = b * obj / f; /* Constant on nabla f */
1668  g = c * obj / g; /* Constant on nable g */
1669  f *= 2.0; /* Modification for nabla f */
1670 
1671  g_obj[0] = tisqrt6*(matr[2]*f + loc3*g);
1672 
1673  loc1 = matr[0]*g;
1674  loc2 = matr[1]*g;
1675 
1676  g_obj[1] = tisqrt6*(matr[5]*f + loc2*matr[6] - loc1*matr[7]);
1677  g_obj[2] = tisqrt6*(matr[8]*f + loc1*matr[4] - loc2*matr[3]);
1678  return true;
1679 }
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_fcn_3i ( double &  obj,
Vector3D  g_obj[4],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
)
inline

Definition at line 1895 of file includeLinks/MeanRatioFunctions.hpp.

References MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_gradient(), and IdealWeightMeanRatio::compute_element_analytical_gradient().

1898 {
1899  double matr[9], f;
1900  double adj_m[9], g;
1901  double loc1, loc2, loc3;
1902 
1903  /* Calculate M = A*inv(W). */
1904  matr[0] = d[0]*(x[1][0] - x[0][0]);
1905  matr[1] = d[1]*(x[2][0] - x[0][0]);
1906  matr[2] = d[2]*(x[3][0] - x[0][0]);
1907 
1908  matr[3] = d[0]*(x[1][1] - x[0][1]);
1909  matr[4] = d[1]*(x[2][1] - x[0][1]);
1910  matr[5] = d[2]*(x[3][1] - x[0][1]);
1911 
1912  matr[6] = d[0]*(x[1][2] - x[0][2]);
1913  matr[7] = d[1]*(x[2][2] - x[0][2]);
1914  matr[8] = d[2]*(x[3][2] - x[0][2]);
1915 
1916  /* Calculate det(M). */
1917  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
1918  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
1919  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
1920  g = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
1921  if (g < MSQ_MIN) { obj = g; return false; }
1922 
1923  /* Calculate norm(M). */
1924  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
1925  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
1926  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
1927 
1928  /* Calculate objective function. */
1929  obj = a * pow(f, b) * pow(g, c);
1930 
1931  /* Calculate the derivative of the objective function. */
1932  f = b * obj / f; /* Constant on nabla f */
1933  g = c * obj / g; /* Constant on nable g */
1934  f *= 2.0; /* Modification for nabla f */
1935 
1936  adj_m[0] = d[0]*(matr[0]*f + loc1*g);
1937  adj_m[1] = d[1]*(matr[1]*f + loc2*g);
1938  adj_m[2] = d[2]*(matr[2]*f + loc3*g);
1939 
1940  loc1 = matr[0]*g;
1941  loc2 = matr[1]*g;
1942  loc3 = matr[2]*g;
1943 
1944  adj_m[3] = d[0]*(matr[3]*f + loc3*matr[7] - loc2*matr[8]);
1945  adj_m[4] = d[1]*(matr[4]*f + loc1*matr[8] - loc3*matr[6]);
1946  adj_m[5] = d[2]*(matr[5]*f + loc2*matr[6] - loc1*matr[7]);
1947 
1948  adj_m[6] = d[0]*(matr[6]*f + loc2*matr[5] - loc3*matr[4]);
1949  adj_m[7] = d[1]*(matr[7]*f + loc3*matr[3] - loc1*matr[5]);
1950  adj_m[8] = d[2]*(matr[8]*f + loc1*matr[4] - loc2*matr[3]);
1951 
1952  g_obj[0][0] = -adj_m[0] - adj_m[1] - adj_m[2];
1953  g_obj[1][0] = adj_m[0];
1954  g_obj[2][0] = adj_m[1];
1955  g_obj[3][0] = adj_m[2];
1956 
1957  g_obj[0][1] = -adj_m[3] - adj_m[4] - adj_m[5];
1958  g_obj[1][1] = adj_m[3];
1959  g_obj[2][1] = adj_m[4];
1960  g_obj[3][1] = adj_m[5];
1961 
1962  g_obj[0][2] = -adj_m[6] - adj_m[7] - adj_m[8];
1963  g_obj[1][2] = adj_m[6];
1964  g_obj[2][2] = adj_m[7];
1965  g_obj[3][2] = adj_m[8];
1966  return true;
1967 }
const NT & d
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_2 ( double &  obj,
Vector3D  g_obj[3],
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 210 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

218  {
219  double matr[9], f, t1, t2;
220  double matd[9], g;
221  double adjm[9], loc1, loc2, loc3, loc4;
222 
223  /* Calculate M = A*inv(R). */
224  f = x[1][0] - x[0][0];
225  g = x[2][0] - x[0][0];
226  matr[0] = f*invR[0][0];
227  matr[1] = f*invR[0][1] + g*invR[1][1];
228  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
229 
230  f = x[1][1] - x[0][1];
231  g = x[2][1] - x[0][1];
232  matr[3] = f*invR[0][0];
233  matr[4] = f*invR[0][1] + g*invR[1][1];
234  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
235 
236  f = x[1][2] - x[0][2];
237  g = x[2][2] - x[0][2];
238  matr[6] = f*invR[0][0];
239  matr[7] = f*invR[0][1] + g*invR[1][1];
240  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
241 
242  /* Calculate det(M). */
243  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
244  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
245  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
246  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
247 
248  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
249 
250  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
251  t2 = sqrt(t1*t1 + 4.0*delta*delta);
252  g = t1 + t2;
253 
254  /* Calculate N = M - beta*Q. */
255  matd[0] = matr[0] - beta*Q[0][0];
256  matd[1] = matr[1] - beta*Q[0][1];
257  matd[2] = matr[2] - beta*Q[0][2];
258  matd[3] = matr[3] - beta*Q[1][0];
259  matd[4] = matr[4] - beta*Q[1][1];
260  matd[5] = matr[5] - beta*Q[1][2];
261  matd[6] = matr[6] - beta*Q[2][0];
262  matd[7] = matr[7] - beta*Q[2][1];
263  matd[8] = matr[8] - beta*Q[2][2];
264 
265  /* Calculate norm(N) */
266  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
267  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
268  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
269 
270  /* Calculate objective function. */
271  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
272  obj = f * loc4;
273 
274  /* Calculate the derivative of the objective function. */
275  f = 2.0 * loc4;
276  g = -gamma * obj / t2;
277 
278  /* Calculate adjoint matrix */
279  adjm[0] = f*matd[0] + g*loc1;
280  adjm[1] = f*matd[1] + g*loc2;
281  adjm[2] = f*matd[2] + g*loc3;
282 
283  loc1 = g*matr[0];
284  loc2 = g*matr[1];
285  loc3 = g*matr[2];
286 
287  adjm[3] = f*matd[3] + loc3*matr[7] - loc2*matr[8];
288  adjm[4] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
289  adjm[5] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
290 
291  adjm[6] = f*matd[6] + loc2*matr[5] - loc3*matr[4];
292  adjm[7] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
293  adjm[8] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
294 
295  /* Construct gradients */
296  g_obj[1][0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
297  g_obj[2][0] = invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
298  g_obj[0][0] = -g_obj[1][0] - g_obj[2][0];
299 
300  g_obj[1][1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
301  g_obj[2][1] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
302  g_obj[0][1] = -g_obj[1][1] - g_obj[2][1];
303 
304  g_obj[1][2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
305  g_obj[2][2] = invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
306  g_obj[0][2] = -g_obj[1][2] - g_obj[2][2];
307  return true;
308  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_2_v0 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 1216 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

1224  {
1225  double matr[9], f, t1, t2;
1226  double matd[9], g;
1227  double adjm[9], loc1, loc2, loc3, loc4;
1228 
1229  /* Calculate M = A*inv(R). */
1230  f = x[1][0] - x[0][0];
1231  g = x[2][0] - x[0][0];
1232  matr[0] = f*invR[0][0];
1233  matr[1] = f*invR[0][1] + g*invR[1][1];
1234  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
1235 
1236  f = x[1][1] - x[0][1];
1237  g = x[2][1] - x[0][1];
1238  matr[3] = f*invR[0][0];
1239  matr[4] = f*invR[0][1] + g*invR[1][1];
1240  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
1241 
1242  f = x[1][2] - x[0][2];
1243  g = x[2][2] - x[0][2];
1244  matr[6] = f*invR[0][0];
1245  matr[7] = f*invR[0][1] + g*invR[1][1];
1246  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
1247 
1248  /* Calculate det(M). */
1249  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
1250  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
1251  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
1252  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
1253 
1254  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
1255 
1256  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
1257  t2 = sqrt(t1*t1 + 4.0*delta*delta);
1258  g = t1 + t2;
1259 
1260  /* Calculate N = M - beta*Q. */
1261  matd[0] = matr[0] - beta*Q[0][0];
1262  matd[1] = matr[1] - beta*Q[0][1];
1263  matd[2] = matr[2] - beta*Q[0][2];
1264  matd[3] = matr[3] - beta*Q[1][0];
1265  matd[4] = matr[4] - beta*Q[1][1];
1266  matd[5] = matr[5] - beta*Q[1][2];
1267  matd[6] = matr[6] - beta*Q[2][0];
1268  matd[7] = matr[7] - beta*Q[2][1];
1269  matd[8] = matr[8] - beta*Q[2][2];
1270 
1271  /* Calculate norm(N) */
1272  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
1273  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
1274  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
1275 
1276  /* Calculate objective function. */
1277  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
1278  obj = f * loc4;
1279 
1280  /* Calculate the derivative of the objective function. */
1281  f = 2.0 * loc4;
1282  g = -gamma * obj / t2;
1283 
1284  /* Calculate adjoint matrix */
1285  adjm[0] = f*matd[0] + g*loc1;
1286  adjm[1] = f*matd[1] + g*loc2;
1287  adjm[2] = f*matd[2] + g*loc3;
1288 
1289  loc1 = g*matr[0];
1290  loc2 = g*matr[1];
1291  loc3 = g*matr[2];
1292 
1293  adjm[3] = f*matd[3] + loc3*matr[7] - loc2*matr[8];
1294  adjm[4] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
1295  adjm[5] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
1296 
1297  adjm[6] = f*matd[6] + loc2*matr[5] - loc3*matr[4];
1298  adjm[7] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
1299  adjm[8] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
1300 
1301  /* Construct gradients */
1302  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
1303  g_obj[0] += invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
1304  g_obj[0] = -g_obj[0];
1305 
1306  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
1307  g_obj[1] += invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
1308  g_obj[1] = -g_obj[1];
1309 
1310  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
1311  g_obj[2] += invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
1312  g_obj[2] = -g_obj[2];
1313  return true;
1314  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_2_v1 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 1316 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

1324  {
1325  double matr[9], f, t1, t2;
1326  double matd[9], g;
1327  double adjm[9], loc1, loc2, loc3, loc4;
1328 
1329  /* Calculate M = A*inv(R). */
1330  f = x[1][0] - x[0][0];
1331  g = x[2][0] - x[0][0];
1332  matr[0] = f*invR[0][0];
1333  matr[1] = f*invR[0][1] + g*invR[1][1];
1334  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
1335 
1336  f = x[1][1] - x[0][1];
1337  g = x[2][1] - x[0][1];
1338  matr[3] = f*invR[0][0];
1339  matr[4] = f*invR[0][1] + g*invR[1][1];
1340  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
1341 
1342  f = x[1][2] - x[0][2];
1343  g = x[2][2] - x[0][2];
1344  matr[6] = f*invR[0][0];
1345  matr[7] = f*invR[0][1] + g*invR[1][1];
1346  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
1347 
1348  /* Calculate det(M). */
1349  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
1350  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
1351  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
1352  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
1353 
1354  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
1355 
1356  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
1357  t2 = sqrt(t1*t1 + 4.0*delta*delta);
1358  g = t1 + t2;
1359 
1360  /* Calculate N = M - beta*Q. */
1361  matd[0] = matr[0] - beta*Q[0][0];
1362  matd[1] = matr[1] - beta*Q[0][1];
1363  matd[2] = matr[2] - beta*Q[0][2];
1364  matd[3] = matr[3] - beta*Q[1][0];
1365  matd[4] = matr[4] - beta*Q[1][1];
1366  matd[5] = matr[5] - beta*Q[1][2];
1367  matd[6] = matr[6] - beta*Q[2][0];
1368  matd[7] = matr[7] - beta*Q[2][1];
1369  matd[8] = matr[8] - beta*Q[2][2];
1370 
1371  /* Calculate norm(N) */
1372  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
1373  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
1374  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
1375 
1376  /* Calculate objective function. */
1377  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
1378  obj = f * loc4;
1379 
1380  /* Calculate the derivative of the objective function. */
1381  f = 2.0 * loc4;
1382  g = -gamma * obj / t2;
1383 
1384  /* Calculate adjoint matrix */
1385  adjm[0] = f*matd[0] + g*loc1;
1386  adjm[1] = f*matd[1] + g*loc2;
1387  adjm[2] = f*matd[2] + g*loc3;
1388 
1389  loc1 = g*matr[0];
1390  loc2 = g*matr[1];
1391  loc3 = g*matr[2];
1392 
1393  adjm[3] = f*matd[3] + loc3*matr[7] - loc2*matr[8];
1394  adjm[4] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
1395  adjm[5] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
1396 
1397  adjm[6] = f*matd[6] + loc2*matr[5] - loc3*matr[4];
1398  adjm[7] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
1399  adjm[8] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
1400 
1401  /* Construct gradients */
1402  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
1403  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
1404  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
1405  return true;
1406  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_2_v2 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 1408 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

1416  {
1417  double matr[9], f, t1, t2;
1418  double matd[9], g;
1419  double adjm[6], loc1, loc2, loc3, loc4;
1420 
1421  /* Calculate M = A*inv(R). */
1422  f = x[1][0] - x[0][0];
1423  g = x[2][0] - x[0][0];
1424  matr[0] = f*invR[0][0];
1425  matr[1] = f*invR[0][1] + g*invR[1][1];
1426  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
1427 
1428  f = x[1][1] - x[0][1];
1429  g = x[2][1] - x[0][1];
1430  matr[3] = f*invR[0][0];
1431  matr[4] = f*invR[0][1] + g*invR[1][1];
1432  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
1433 
1434  f = x[1][2] - x[0][2];
1435  g = x[2][2] - x[0][2];
1436  matr[6] = f*invR[0][0];
1437  matr[7] = f*invR[0][1] + g*invR[1][1];
1438  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
1439 
1440  /* Calculate det(M). */
1441  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
1442  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
1443  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
1444  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
1445 
1446  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
1447 
1448  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
1449  t2 = sqrt(t1*t1 + 4.0*delta*delta);
1450  g = t1 + t2;
1451 
1452  /* Calculate N = M - beta*Q. */
1453  matd[0] = matr[0] - beta*Q[0][0];
1454  matd[1] = matr[1] - beta*Q[0][1];
1455  matd[2] = matr[2] - beta*Q[0][2];
1456  matd[3] = matr[3] - beta*Q[1][0];
1457  matd[4] = matr[4] - beta*Q[1][1];
1458  matd[5] = matr[5] - beta*Q[1][2];
1459  matd[6] = matr[6] - beta*Q[2][0];
1460  matd[7] = matr[7] - beta*Q[2][1];
1461  matd[8] = matr[8] - beta*Q[2][2];
1462 
1463  /* Calculate norm(N) */
1464  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
1465  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
1466  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
1467 
1468  /* Calculate objective function. */
1469  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
1470  obj = f * loc4;
1471 
1472  /* Calculate the derivative of the objective function. */
1473  f = 2.0 * loc4;
1474  g = -gamma * obj / t2;
1475 
1476  /* Calculate adjoint matrix */
1477  adjm[0] = f*matd[1] + g*loc2;
1478  adjm[1] = f*matd[2] + g*loc3;
1479 
1480  loc1 = g*matr[0];
1481  loc2 = g*matr[1];
1482  loc3 = g*matr[2];
1483 
1484  adjm[2] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
1485  adjm[3] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
1486 
1487  adjm[4] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
1488  adjm[5] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
1489 
1490  /* Construct gradients */
1491  g_obj[0] = invR[1][1]*adjm[0]+invR[1][2]*adjm[1];
1492  g_obj[1] = invR[1][1]*adjm[2]+invR[1][2]*adjm[3];
1493  g_obj[2] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
1494  return true;
1495  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_3 ( double &  obj,
Vector3D  g_obj[4],
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 709 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

717  {
718  double matr[9], f, t1, t2;
719  double matd[9], g;
720  double adjm[9], loc1, loc2, loc3, loc4;
721 
722  /* Calculate M = A*inv(R). */
723  f = x[1][0] - x[0][0];
724  g = x[2][0] - x[0][0];
725  t1 = x[3][0] - x[0][0];
726  matr[0] = f*invR[0][0];
727  matr[1] = f*invR[0][1] + g*invR[1][1];
728  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
729 
730  f = x[1][1] - x[0][1];
731  g = x[2][1] - x[0][1];
732  t1 = x[3][1] - x[0][1];
733  matr[3] = f*invR[0][0];
734  matr[4] = f*invR[0][1] + g*invR[1][1];
735  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
736 
737  f = x[1][2] - x[0][2];
738  g = x[2][2] - x[0][2];
739  t1 = x[3][2] - x[0][2];
740  matr[6] = f*invR[0][0];
741  matr[7] = f*invR[0][1] + g*invR[1][1];
742  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
743 
744  /* Calculate det(M). */
745  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
746  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
747  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
748  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
749 
750  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
751 
752  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
753  t2 = sqrt(t1*t1 + 4.0*delta*delta);
754  g = t1 + t2;
755 
756  /* Calculate N = M - beta*Q. */
757  matd[0] = matr[0] - beta*Q[0][0];
758  matd[1] = matr[1] - beta*Q[0][1];
759  matd[2] = matr[2] - beta*Q[0][2];
760  matd[3] = matr[3] - beta*Q[1][0];
761  matd[4] = matr[4] - beta*Q[1][1];
762  matd[5] = matr[5] - beta*Q[1][2];
763  matd[6] = matr[6] - beta*Q[2][0];
764  matd[7] = matr[7] - beta*Q[2][1];
765  matd[8] = matr[8] - beta*Q[2][2];
766 
767  /* Calculate norm(N) */
768  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
769  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
770  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
771 
772  /* Calculate objective function. */
773  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
774  obj = f * loc4;
775 
776  /* Calculate the derivative of the objective function. */
777  f = 2.0 * loc4;
778  g = -gamma * obj / t2;
779 
780  /* Calculate adjoint matrix */
781  adjm[0] = f*matd[0] + g*loc1;
782  adjm[1] = f*matd[1] + g*loc2;
783  adjm[2] = f*matd[2] + g*loc3;
784 
785  loc1 = g*matr[0];
786  loc2 = g*matr[1];
787  loc3 = g*matr[2];
788 
789  adjm[3] = f*matd[3] + loc3*matr[7] - loc2*matr[8];
790  adjm[4] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
791  adjm[5] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
792 
793  adjm[6] = f*matd[6] + loc2*matr[5] - loc3*matr[4];
794  adjm[7] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
795  adjm[8] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
796 
797  /* Construct gradients */
798  g_obj[1][0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
799  g_obj[2][0] = invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
800  g_obj[3][0] = invR[2][2]*adjm[2];
801  g_obj[0][0] = -g_obj[1][0] - g_obj[2][0] - g_obj[3][0];
802 
803  g_obj[1][1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
804  g_obj[2][1] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
805  g_obj[3][1] = invR[2][2]*adjm[5];
806  g_obj[0][1] = -g_obj[1][1] - g_obj[2][1] - g_obj[3][1];
807 
808  g_obj[1][2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
809  g_obj[2][2] = invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
810  g_obj[3][2] = invR[2][2]*adjm[8];
811  g_obj[0][2] = -g_obj[1][2] - g_obj[2][2] - g_obj[3][2];
812  return true;
813  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_3_v0 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 2173 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

2181  {
2182  double matr[9], f, t1, t2;
2183  double matd[9], g;
2184  double adjm[9], loc1, loc2, loc3, loc4;
2185 
2186  /* Calculate M = A*inv(R). */
2187  f = x[1][0] - x[0][0];
2188  g = x[2][0] - x[0][0];
2189  t1 = x[3][0] - x[0][0];
2190  matr[0] = f*invR[0][0];
2191  matr[1] = f*invR[0][1] + g*invR[1][1];
2192  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2193 
2194  f = x[1][1] - x[0][1];
2195  g = x[2][1] - x[0][1];
2196  t1 = x[3][1] - x[0][1];
2197  matr[3] = f*invR[0][0];
2198  matr[4] = f*invR[0][1] + g*invR[1][1];
2199  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2200 
2201  f = x[1][2] - x[0][2];
2202  g = x[2][2] - x[0][2];
2203  t1 = x[3][2] - x[0][2];
2204  matr[6] = f*invR[0][0];
2205  matr[7] = f*invR[0][1] + g*invR[1][1];
2206  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2207 
2208  /* Calculate det(M). */
2209  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
2210  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
2211  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
2212  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
2213 
2214  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
2215 
2216  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
2217  t2 = sqrt(t1*t1 + 4.0*delta*delta);
2218  g = t1 + t2;
2219 
2220  /* Calculate N = M - beta*Q. */
2221  matd[0] = matr[0] - beta*Q[0][0];
2222  matd[1] = matr[1] - beta*Q[0][1];
2223  matd[2] = matr[2] - beta*Q[0][2];
2224  matd[3] = matr[3] - beta*Q[1][0];
2225  matd[4] = matr[4] - beta*Q[1][1];
2226  matd[5] = matr[5] - beta*Q[1][2];
2227  matd[6] = matr[6] - beta*Q[2][0];
2228  matd[7] = matr[7] - beta*Q[2][1];
2229  matd[8] = matr[8] - beta*Q[2][2];
2230 
2231  /* Calculate norm(N) */
2232  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
2233  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
2234  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
2235 
2236  /* Calculate objective function. */
2237  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
2238  obj = f * loc4;
2239 
2240  /* Calculate the derivative of the objective function. */
2241  f = 2.0 * loc4;
2242  g = -gamma * obj / t2;
2243 
2244  /* Calculate adjoint matrix */
2245  adjm[0] = f*matd[0] + g*loc1;
2246  adjm[1] = f*matd[1] + g*loc2;
2247  adjm[2] = f*matd[2] + g*loc3;
2248 
2249  loc1 = g*matr[0];
2250  loc2 = g*matr[1];
2251  loc3 = g*matr[2];
2252 
2253  adjm[3] = f*matd[3] + loc3*matr[7] - loc2*matr[8];
2254  adjm[4] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
2255  adjm[5] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
2256 
2257  adjm[6] = f*matd[6] + loc2*matr[5] - loc3*matr[4];
2258  adjm[7] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
2259  adjm[8] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
2260 
2261  /* Construct gradients */
2262  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
2263  g_obj[0] += invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
2264  g_obj[0] += invR[2][2]*adjm[2];
2265  g_obj[0] = -g_obj[0];
2266 
2267  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
2268  g_obj[1] += invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
2269  g_obj[1] += invR[2][2]*adjm[5];
2270  g_obj[1] = -g_obj[1];
2271 
2272  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
2273  g_obj[2] += invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
2274  g_obj[2] += invR[2][2]*adjm[8];
2275  g_obj[2] = -g_obj[2];
2276  return true;
2277  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_3_v1 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 2279 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

2287  {
2288  double matr[9], f, t1, t2;
2289  double matd[9], g;
2290  double adjm[9], loc1, loc2, loc3, loc4;
2291 
2292  /* Calculate M = A*inv(R). */
2293  f = x[1][0] - x[0][0];
2294  g = x[2][0] - x[0][0];
2295  t1 = x[3][0] - x[0][0];
2296  matr[0] = f*invR[0][0];
2297  matr[1] = f*invR[0][1] + g*invR[1][1];
2298  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2299 
2300  f = x[1][1] - x[0][1];
2301  g = x[2][1] - x[0][1];
2302  t1 = x[3][1] - x[0][1];
2303  matr[3] = f*invR[0][0];
2304  matr[4] = f*invR[0][1] + g*invR[1][1];
2305  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2306 
2307  f = x[1][2] - x[0][2];
2308  g = x[2][2] - x[0][2];
2309  t1 = x[3][2] - x[0][2];
2310  matr[6] = f*invR[0][0];
2311  matr[7] = f*invR[0][1] + g*invR[1][1];
2312  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2313 
2314  /* Calculate det(M). */
2315  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
2316  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
2317  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
2318  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
2319 
2320  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
2321 
2322  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
2323  t2 = sqrt(t1*t1 + 4.0*delta*delta);
2324  g = t1 + t2;
2325 
2326  /* Calculate N = M - beta*Q. */
2327  matd[0] = matr[0] - beta*Q[0][0];
2328  matd[1] = matr[1] - beta*Q[0][1];
2329  matd[2] = matr[2] - beta*Q[0][2];
2330  matd[3] = matr[3] - beta*Q[1][0];
2331  matd[4] = matr[4] - beta*Q[1][1];
2332  matd[5] = matr[5] - beta*Q[1][2];
2333  matd[6] = matr[6] - beta*Q[2][0];
2334  matd[7] = matr[7] - beta*Q[2][1];
2335  matd[8] = matr[8] - beta*Q[2][2];
2336 
2337  /* Calculate norm(N) */
2338  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
2339  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
2340  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
2341 
2342  /* Calculate objective function. */
2343  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
2344  obj = f * loc4;
2345 
2346  /* Calculate the derivative of the objective function. */
2347  f = 2.0 * loc4;
2348  g = -gamma * obj / t2;
2349 
2350  /* Calculate adjoint matrix */
2351  adjm[0] = f*matd[0] + g*loc1;
2352  adjm[1] = f*matd[1] + g*loc2;
2353  adjm[2] = f*matd[2] + g*loc3;
2354 
2355  loc1 = g*matr[0];
2356  loc2 = g*matr[1];
2357  loc3 = g*matr[2];
2358 
2359  adjm[3] = f*matd[3] + loc3*matr[7] - loc2*matr[8];
2360  adjm[4] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
2361  adjm[5] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
2362 
2363  adjm[6] = f*matd[6] + loc2*matr[5] - loc3*matr[4];
2364  adjm[7] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
2365  adjm[8] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
2366 
2367  /* Construct gradients */
2368  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
2369  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
2370  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
2371  return true;
2372  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_3_v2 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 2374 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

2382  {
2383  double matr[9], f, t1, t2;
2384  double matd[9], g;
2385  double adjm[6], loc1, loc2, loc3, loc4;
2386 
2387  /* Calculate M = A*inv(R). */
2388  f = x[1][0] - x[0][0];
2389  g = x[2][0] - x[0][0];
2390  t1 = x[3][0] - x[0][0];
2391  matr[0] = f*invR[0][0];
2392  matr[1] = f*invR[0][1] + g*invR[1][1];
2393  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2394 
2395  f = x[1][1] - x[0][1];
2396  g = x[2][1] - x[0][1];
2397  t1 = x[3][1] - x[0][1];
2398  matr[3] = f*invR[0][0];
2399  matr[4] = f*invR[0][1] + g*invR[1][1];
2400  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2401 
2402  f = x[1][2] - x[0][2];
2403  g = x[2][2] - x[0][2];
2404  t1 = x[3][2] - x[0][2];
2405  matr[6] = f*invR[0][0];
2406  matr[7] = f*invR[0][1] + g*invR[1][1];
2407  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2408 
2409  /* Calculate det(M). */
2410  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
2411  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
2412  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
2413  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
2414 
2415  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
2416 
2417  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
2418  t2 = sqrt(t1*t1 + 4.0*delta*delta);
2419  g = t1 + t2;
2420 
2421  /* Calculate N = M - beta*Q. */
2422  matd[0] = matr[0] - beta*Q[0][0];
2423  matd[1] = matr[1] - beta*Q[0][1];
2424  matd[2] = matr[2] - beta*Q[0][2];
2425  matd[3] = matr[3] - beta*Q[1][0];
2426  matd[4] = matr[4] - beta*Q[1][1];
2427  matd[5] = matr[5] - beta*Q[1][2];
2428  matd[6] = matr[6] - beta*Q[2][0];
2429  matd[7] = matr[7] - beta*Q[2][1];
2430  matd[8] = matr[8] - beta*Q[2][2];
2431 
2432  /* Calculate norm(N) */
2433  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
2434  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
2435  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
2436 
2437  /* Calculate objective function. */
2438  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
2439  obj = f * loc4;
2440 
2441  /* Calculate the derivative of the objective function. */
2442  f = 2.0 * loc4;
2443  g = -gamma * obj / t2;
2444 
2445  /* Calculate adjoint matrix */
2446  adjm[0] = f*matd[1] + g*loc2;
2447  adjm[1] = f*matd[2] + g*loc3;
2448 
2449  loc1 = g*matr[0];
2450  loc2 = g*matr[1];
2451  loc3 = g*matr[2];
2452 
2453  adjm[2] = f*matd[4] + loc1*matr[8] - loc3*matr[6];
2454  adjm[3] = f*matd[5] + loc2*matr[6] - loc1*matr[7];
2455 
2456  adjm[4] = f*matd[7] + loc3*matr[3] - loc1*matr[5];
2457  adjm[5] = f*matd[8] + loc1*matr[4] - loc2*matr[3];
2458 
2459  /* Construct gradients */
2460  g_obj[0] = invR[1][1]*adjm[0]+invR[1][2]*adjm[1];
2461  g_obj[1] = invR[1][1]*adjm[2]+invR[1][2]*adjm[3];
2462  g_obj[2] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
2463  return true;
2464  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool g_gdft_3_v3 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 2466 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient().

2474  {
2475  double matr[9], f, t1, t2;
2476  double matd[9], g;
2477  double loc1, loc2, loc3, loc4;
2478 
2479  /* Calculate M = A*inv(R). */
2480  f = x[1][0] - x[0][0];
2481  g = x[2][0] - x[0][0];
2482  t1 = x[3][0] - x[0][0];
2483  matr[0] = f*invR[0][0];
2484  matr[1] = f*invR[0][1] + g*invR[1][1];
2485  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2486 
2487  f = x[1][1] - x[0][1];
2488  g = x[2][1] - x[0][1];
2489  t1 = x[3][1] - x[0][1];
2490  matr[3] = f*invR[0][0];
2491  matr[4] = f*invR[0][1] + g*invR[1][1];
2492  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2493 
2494  f = x[1][2] - x[0][2];
2495  g = x[2][2] - x[0][2];
2496  t1 = x[3][2] - x[0][2];
2497  matr[6] = f*invR[0][0];
2498  matr[7] = f*invR[0][1] + g*invR[1][1];
2499  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2500 
2501  /* Calculate det(M). */
2502  loc1 = matr[4]*matr[8] - matr[5]*matr[7];
2503  loc2 = matr[5]*matr[6] - matr[3]*matr[8];
2504  loc3 = matr[3]*matr[7] - matr[4]*matr[6];
2505  t1 = matr[0]*loc1 + matr[1]*loc2 + matr[2]*loc3;
2506 
2507  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
2508 
2509  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
2510  t2 = sqrt(t1*t1 + 4.0*delta*delta);
2511  g = t1 + t2;
2512 
2513  /* Calculate N = M - beta*Q. */
2514  matd[0] = matr[0] - beta*Q[0][0];
2515  matd[1] = matr[1] - beta*Q[0][1];
2516  matd[2] = matr[2] - beta*Q[0][2];
2517  matd[3] = matr[3] - beta*Q[1][0];
2518  matd[4] = matr[4] - beta*Q[1][1];
2519  matd[5] = matr[5] - beta*Q[1][2];
2520  matd[6] = matr[6] - beta*Q[2][0];
2521  matd[7] = matr[7] - beta*Q[2][1];
2522  matd[8] = matr[8] - beta*Q[2][2];
2523 
2524  /* Calculate norm(N) */
2525  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
2526  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
2527  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
2528 
2529  /* Calculate objective function. */
2530  loc4 = alpha * pow(2.0, gamma) / pow(g, gamma);
2531  obj = f * loc4;
2532 
2533  /* Calculate the derivative of the objective function. */
2534  f = 2.0 * loc4;
2535  g = -gamma * obj / t2;
2536 
2537  /* Construct gradients */
2538  loc1 = g*matr[0];
2539  loc2 = g*matr[1];
2540 
2541  g_obj[0] = invR[2][2]*(f*matd[2] + g*loc3);
2542  g_obj[1] = invR[2][2]*(f*matd[5] + loc2*matr[6] - loc1*matr[7]);
2543  g_obj[2] = invR[2][2]*(f*matd[8] + loc1*matr[4] - loc2*matr[3]);
2544  return true;
2545  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_fcn_2e ( double &  obj,
Vector3D  g_obj[3],
Matrix3D  h_obj[6],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 244 of file includeLinks/MeanRatioFunctions.hpp.

References A, nvc::cross(), Matrix3D::fill_lower_triangle(), isqrt3, MSQ_MIN, pow(), and tisqrt3.

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), and IdealWeightMeanRatio::compute_element_analytical_hessian().

247 {
248  double matr[9], f;
249  double adj_m[9], g; // adj_m[2,5,8] not used
250  double dg[9]; // dg[2,5,8] not used
251  double loc0, loc1, loc2, loc3, loc4;
252  double A[12], J_A[6], J_B[9], J_C[9], cross; // only 2x2 corners used
253 
254  /* Calculate M = [A*inv(W) n] */
255  matr[0] = x[1][0] - x[0][0];
256  matr[1] = (2.0*x[2][0] - x[1][0] - x[0][0])*isqrt3;
257  matr[2] = n[0];
258 
259  matr[3] = x[1][1] - x[0][1];
260  matr[4] = (2.0*x[2][1] - x[1][1] - x[0][1])*isqrt3;
261  matr[5] = n[1];
262 
263  matr[6] = x[1][2] - x[0][2];
264  matr[7] = (2.0*x[2][2] - x[1][2] - x[0][2])*isqrt3;
265  matr[8] = n[2];
266 
267  /* Calculate det([n M]). */
268  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
269  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
270  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
271  g = matr[0]*dg[0] + matr[3]*dg[3] + matr[6]*dg[6];
272  if (g < MSQ_MIN) { obj = g; return false; }
273 
274  /* Calculate norm(M). */
275  f = matr[0]*matr[0] + matr[1]*matr[1] +
276  matr[3]*matr[3] + matr[4]*matr[4] +
277  matr[6]*matr[6] + matr[7]*matr[7];
278 
279  loc3 = f;
280  loc4 = g;
281 
282  /* Calculate objective function. */
283  obj = a * pow(f, b) * pow(g, c);
284 
285  /* Calculate the derivative of the objective function. */
286  f = b * obj / f; /* Constant on nabla f */
287  g = c * obj / g; /* Constant on nable g */
288  f *= 2.0; /* Modification for nabla f */
289 
290  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
291  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
292  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
293 
294  adj_m[0] = matr[0]*f + dg[0]*g;
295  adj_m[1] = matr[1]*f + dg[1]*g;
296  adj_m[3] = matr[3]*f + dg[3]*g;
297  adj_m[4] = matr[4]*f + dg[4]*g;
298  adj_m[6] = matr[6]*f + dg[6]*g;
299  adj_m[7] = matr[7]*f + dg[7]*g;
300 
301  loc1 = isqrt3*adj_m[1];
302  g_obj[0][0] = -adj_m[0] - loc1;
303  g_obj[1][0] = adj_m[0] - loc1;
304  g_obj[2][0] = 2.0*loc1;
305 
306  loc1 = isqrt3*adj_m[4];
307  g_obj[0][1] = -adj_m[3] - loc1;
308  g_obj[1][1] = adj_m[3] - loc1;
309  g_obj[2][1] = 2.0*loc1;
310 
311  loc1 = isqrt3*adj_m[7];
312  g_obj[0][2] = -adj_m[6] - loc1;
313  g_obj[1][2] = adj_m[6] - loc1;
314  g_obj[2][2] = 2.0*loc1;
315 
316  /* Calculate the hessian of the objective. */
317  loc0 = f; /* Constant on nabla^2 f */
318  loc1 = g; /* Constant on nabla^2 g */
319  cross = f * c / loc4; /* Constant on nabla g nabla f */
320  f = f * (b-1) / loc3; /* Constant on nabla f nabla f */
321  g = g * (c-1) / loc4; /* Constant on nabla g nabla g */
322  f *= 2.0; /* Modification for nabla f */
323 
324  /* First block of rows */
325  loc3 = matr[0]*f + dg[0]*cross;
326  loc4 = dg[0]*g + matr[0]*cross;
327 
328  J_A[0] = loc0 + loc3*matr[0] + loc4*dg[0];
329  J_A[1] = loc3*matr[1] + loc4*dg[1];
330  J_B[0] = loc3*matr[3] + loc4*dg[3];
331  J_B[1] = loc3*matr[4] + loc4*dg[4];
332  J_C[0] = loc3*matr[6] + loc4*dg[6];
333  J_C[1] = loc3*matr[7] + loc4*dg[7];
334 
335  loc3 = matr[1]*f + dg[1]*cross;
336  loc4 = dg[1]*g + matr[1]*cross;
337 
338  J_A[3] = loc0 + loc3*matr[1] + loc4*dg[1];
339  J_B[3] = loc3*matr[3] + loc4*dg[3];
340  J_B[4] = loc3*matr[4] + loc4*dg[4];
341  J_C[3] = loc3*matr[6] + loc4*dg[6];
342  J_C[4] = loc3*matr[7] + loc4*dg[7];
343 
344  /* First diagonal block */
345  loc2 = isqrt3*J_A[1];
346  A[0] = -J_A[0] - loc2;
347  A[1] = J_A[0] - loc2;
348 
349  loc2 = isqrt3*J_A[3];
350  A[4] = -J_A[1] - loc2;
351  A[5] = J_A[1] - loc2;
352  A[6] = 2.0*loc2;
353 
354  loc2 = isqrt3*A[4];
355  h_obj[0][0][0] = -A[0] - loc2;
356  h_obj[1][0][0] = A[0] - loc2;
357  h_obj[2][0][0] = 2.0*loc2;
358 
359  loc2 = isqrt3*A[5];
360  h_obj[3][0][0] = A[1] - loc2;
361  h_obj[4][0][0] = 2.0*loc2;
362 
363  h_obj[5][0][0] = tisqrt3*A[6];
364 
365  /* First off-diagonal block */
366  loc2 = matr[8]*loc1;
367  J_B[1] += loc2;
368  J_B[3] -= loc2;
369 
370  loc2 = isqrt3*J_B[3];
371  A[0] = -J_B[0] - loc2;
372  A[1] = J_B[0] - loc2;
373  A[2] = 2.0*loc2;
374 
375  loc2 = isqrt3*J_B[4];
376  A[4] = -J_B[1] - loc2;
377  A[5] = J_B[1] - loc2;
378  A[6] = 2.0*loc2;
379 
380  loc2 = isqrt3*A[4];
381  h_obj[0][0][1] = -A[0] - loc2;
382  h_obj[1][0][1] = A[0] - loc2;
383  h_obj[2][0][1] = 2.0*loc2;
384 
385  loc2 = isqrt3*A[5];
386  h_obj[1][1][0] = -A[1] - loc2;
387  h_obj[3][0][1] = A[1] - loc2;
388  h_obj[4][0][1] = 2.0*loc2;
389 
390  loc2 = isqrt3*A[6];
391  h_obj[2][1][0] = -A[2] - loc2;
392  h_obj[4][1][0] = A[2] - loc2;
393  h_obj[5][0][1] = 2.0*loc2;
394 
395  /* Second off-diagonal block */
396  loc2 = matr[5]*loc1;
397  J_C[1] -= loc2;
398  J_C[3] += loc2;
399 
400  loc2 = isqrt3*J_C[3];
401  A[0] = -J_C[0] - loc2;
402  A[1] = J_C[0] - loc2;
403  A[2] = 2.0*loc2;
404 
405  loc2 = isqrt3*J_C[4];
406  A[4] = -J_C[1] - loc2;
407  A[5] = J_C[1] - loc2;
408  A[6] = 2.0*loc2;
409 
410  loc2 = isqrt3*A[4];
411  h_obj[0][0][2] = -A[0] - loc2;
412  h_obj[1][0][2] = A[0] - loc2;
413  h_obj[2][0][2] = 2.0*loc2;
414 
415  loc2 = isqrt3*A[5];
416  h_obj[1][2][0] = -A[1] - loc2;
417  h_obj[3][0][2] = A[1] - loc2;
418  h_obj[4][0][2] = 2.0*loc2;
419 
420  loc2 = isqrt3*A[6];
421  h_obj[2][2][0] = -A[2] - loc2;
422  h_obj[4][2][0] = A[2] - loc2;
423  h_obj[5][0][2] = 2.0*loc2;
424 
425  /* Second block of rows */
426  loc3 = matr[3]*f + dg[3]*cross;
427  loc4 = dg[3]*g + matr[3]*cross;
428 
429  J_A[0] = loc0 + loc3*matr[3] + loc4*dg[3];
430  J_A[1] = loc3*matr[4] + loc4*dg[4];
431  J_B[0] = loc3*matr[6] + loc4*dg[6];
432  J_B[1] = loc3*matr[7] + loc4*dg[7];
433 
434  loc3 = matr[4]*f + dg[4]*cross;
435  loc4 = dg[4]*g + matr[4]*cross;
436 
437  J_A[3] = loc0 + loc3*matr[4] + loc4*dg[4];
438  J_B[3] = loc3*matr[6] + loc4*dg[6];
439  J_B[4] = loc3*matr[7] + loc4*dg[7];
440 
441  /* Second diagonal block */
442  loc2 = isqrt3*J_A[1];
443  A[0] = -J_A[0] - loc2;
444  A[1] = J_A[0] - loc2;
445 
446  loc2 = isqrt3*J_A[3];
447  A[4] = -J_A[1] - loc2;
448  A[5] = J_A[1] - loc2;
449  A[6] = 2.0*loc2;
450 
451  loc2 = isqrt3*A[4];
452  h_obj[0][1][1] = -A[0] - loc2;
453  h_obj[1][1][1] = A[0] - loc2;
454  h_obj[2][1][1] = 2.0*loc2;
455 
456  loc2 = isqrt3*A[5];
457  h_obj[3][1][1] = A[1] - loc2;
458  h_obj[4][1][1] = 2.0*loc2;
459 
460  h_obj[5][1][1] = tisqrt3*A[6];
461 
462  /* Third off-diagonal block */
463  loc2 = matr[2]*loc1;
464  J_B[1] += loc2;
465  J_B[3] -= loc2;
466 
467  loc2 = isqrt3*J_B[3];
468  A[0] = -J_B[0] - loc2;
469  A[1] = J_B[0] - loc2;
470  A[2] = 2.0*loc2;
471 
472  loc2 = isqrt3*J_B[4];
473  A[4] = -J_B[1] - loc2;
474  A[5] = J_B[1] - loc2;
475  A[6] = 2.0*loc2;
476 
477  loc2 = isqrt3*A[4];
478  h_obj[0][1][2] = -A[0] - loc2;
479  h_obj[1][1][2] = A[0] - loc2;
480  h_obj[2][1][2] = 2.0*loc2;
481 
482  loc2 = isqrt3*A[5];
483  h_obj[1][2][1] = -A[1] - loc2;
484  h_obj[3][1][2] = A[1] - loc2;
485  h_obj[4][1][2] = 2.0*loc2;
486 
487  loc2 = isqrt3*A[6];
488  h_obj[2][2][1] = -A[2] - loc2;
489  h_obj[4][2][1] = A[2] - loc2;
490  h_obj[5][1][2] = 2.0*loc2;
491 
492  /* Third block of rows */
493  loc3 = matr[6]*f + dg[6]*cross;
494  loc4 = dg[6]*g + matr[6]*cross;
495 
496  J_A[0] = loc0 + loc3*matr[6] + loc4*dg[6];
497  J_A[1] = loc3*matr[7] + loc4*dg[7];
498 
499  loc3 = matr[7]*f + dg[7]*cross;
500  loc4 = dg[7]*g + matr[7]*cross;
501 
502  J_A[3] = loc0 + loc3*matr[7] + loc4*dg[7];
503 
504  /* Third diagonal block */
505  loc2 = isqrt3*J_A[1];
506  A[0] = -J_A[0] - loc2;
507  A[1] = J_A[0] - loc2;
508 
509  loc2 = isqrt3*J_A[3];
510  A[4] = -J_A[1] - loc2;
511  A[5] = J_A[1] - loc2;
512  A[6] = 2.0*loc2;
513 
514  loc2 = isqrt3*A[4];
515  h_obj[0][2][2] = -A[0] - loc2;
516  h_obj[1][2][2] = A[0] - loc2;
517  h_obj[2][2][2] = 2.0*loc2;
518 
519  loc2 = isqrt3*A[5];
520  h_obj[3][2][2] = A[1] - loc2;
521  h_obj[4][2][2] = 2.0*loc2;
522 
523  h_obj[5][2][2] = tisqrt3*A[6];
524 
525  // completes diagonal blocks.
526  h_obj[0].fill_lower_triangle();
527  h_obj[3].fill_lower_triangle();
528  h_obj[5].fill_lower_triangle();
529  return true;
530 }
NVec< 3, T > cross(const NVec< 3, T > &u, const NVec< 3, T > &v)
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_fcn_2i ( double &  obj,
Vector3D  g_obj[3],
Matrix3D  h_obj[6],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
)
inline

Definition at line 656 of file includeLinks/MeanRatioFunctions.hpp.

References A, nvc::cross(), Matrix3D::fill_lower_triangle(), MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), and IdealWeightMeanRatio::compute_element_analytical_hessian().

660 {
661  double matr[9], f;
662  double adj_m[9], g; // adj_m[2,5,8] not used
663  double dg[9]; // dg[2,5,8] not used
664  double loc0, loc1, loc2, loc3, loc4;
665  double A[12], J_A[6], J_B[9], J_C[9], cross; // only 2x2 corners used
666 
667  const double scale[3] = {
668  d[0]*d[0], d[0]*d[1],
669  d[1]*d[1]
670  };
671 
672  /* Calculate M = [A*inv(W) n] */
673  matr[0] = d[0]*(x[1][0] - x[0][0]);
674  matr[1] = d[1]*(x[2][0] - x[0][0]);
675  matr[2] = n[0];
676 
677  matr[3] = d[0]*(x[1][1] - x[0][1]);
678  matr[4] = d[1]*(x[2][1] - x[0][1]);
679  matr[5] = n[1];
680 
681  matr[6] = d[0]*(x[1][2] - x[0][2]);
682  matr[7] = d[1]*(x[2][2] - x[0][2]);
683  matr[8] = n[2];
684 
685  /* Calculate det([n M]). */
686  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
687  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
688  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
689  g = matr[0]*dg[0] + matr[3]*dg[3] + matr[6]*dg[6];
690  if (g < MSQ_MIN) { obj = g; return false; }
691 
692  /* Calculate norm(M). */
693  f = matr[0]*matr[0] + matr[1]*matr[1] +
694  matr[3]*matr[3] + matr[4]*matr[4] +
695  matr[6]*matr[6] + matr[7]*matr[7];
696 
697  loc3 = f;
698  loc4 = g;
699 
700  /* Calculate objective function. */
701  obj = a * pow(f, b) * pow(g, c);
702 
703  /* Calculate the derivative of the objective function. */
704  f = b * obj / f; /* Constant on nabla f */
705  g = c * obj / g; /* Constant on nable g */
706  f *= 2.0; /* Modification for nabla f */
707 
708  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
709  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
710  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
711 
712  adj_m[0] = d[0]*(matr[0]*f + dg[0]*g);
713  adj_m[1] = d[1]*(matr[1]*f + dg[1]*g);
714  adj_m[3] = d[0]*(matr[3]*f + dg[3]*g);
715  adj_m[4] = d[1]*(matr[4]*f + dg[4]*g);
716  adj_m[6] = d[0]*(matr[6]*f + dg[6]*g);
717  adj_m[7] = d[1]*(matr[7]*f + dg[7]*g);
718 
719  g_obj[0][0] = -adj_m[0] - adj_m[1];
720  g_obj[1][0] = adj_m[0];
721  g_obj[2][0] = adj_m[1];
722 
723  g_obj[0][1] = -adj_m[3] - adj_m[4];
724  g_obj[1][1] = adj_m[3];
725  g_obj[2][1] = adj_m[4];
726 
727  g_obj[0][2] = -adj_m[6] - adj_m[7];
728  g_obj[1][2] = adj_m[6];
729  g_obj[2][2] = adj_m[7];
730 
731  /* Calculate the hessian of the objective. */
732  loc0 = f; /* Constant on nabla^2 f */
733  loc1 = g; /* Constant on nabla^2 g */
734  cross = f * c / loc4; /* Constant on nabla g nabla f */
735  f = f * (b-1) / loc3; /* Constant on nabla f nabla f */
736  g = g * (c-1) / loc4; /* Constant on nabla g nabla g */
737  f *= 2.0; /* Modification for nabla f */
738 
739  /* First block of rows */
740  loc3 = matr[0]*f + dg[0]*cross;
741  loc4 = dg[0]*g + matr[0]*cross;
742 
743  J_A[0] = loc0 + loc3*matr[0] + loc4*dg[0];
744  J_A[1] = loc3*matr[1] + loc4*dg[1];
745  J_B[0] = loc3*matr[3] + loc4*dg[3];
746  J_B[1] = loc3*matr[4] + loc4*dg[4];
747  J_C[0] = loc3*matr[6] + loc4*dg[6];
748  J_C[1] = loc3*matr[7] + loc4*dg[7];
749 
750  loc3 = matr[1]*f + dg[1]*cross;
751  loc4 = dg[1]*g + matr[1]*cross;
752 
753  J_A[3] = loc0 + loc3*matr[1] + loc4*dg[1];
754  J_B[3] = loc3*matr[3] + loc4*dg[3];
755  J_B[4] = loc3*matr[4] + loc4*dg[4];
756  J_C[3] = loc3*matr[6] + loc4*dg[6];
757  J_C[4] = loc3*matr[7] + loc4*dg[7];
758 
759  /* First diagonal block */
760  J_A[0] *= scale[0];
761  J_A[1] *= scale[1];
762  J_A[3] *= scale[2];
763 
764  A[0] = -J_A[0] - J_A[1];
765  A[4] = -J_A[1] - J_A[3];
766 
767  h_obj[0][0][0] = -A[0] - A[4];
768  h_obj[1][0][0] = A[0];
769  h_obj[2][0][0] = A[4];
770 
771  h_obj[3][0][0] = J_A[0];
772  h_obj[4][0][0] = J_A[1];
773 
774  h_obj[5][0][0] = J_A[3];
775 
776  /* First off-diagonal block */
777  loc2 = matr[8]*loc1;
778  J_B[1] += loc2;
779  J_B[3] -= loc2;
780 
781  J_B[0] *= scale[0];
782  J_B[1] *= scale[1];
783  J_B[3] *= scale[1];
784  J_B[4] *= scale[2];
785 
786  A[0] = -J_B[0] - J_B[3];
787  A[4] = -J_B[1] - J_B[4];
788 
789  h_obj[0][0][1] = -A[0] - A[4];
790  h_obj[1][0][1] = A[0];
791  h_obj[2][0][1] = A[4];
792 
793  h_obj[1][1][0] = -J_B[0] - J_B[1];
794  h_obj[3][0][1] = J_B[0];
795  h_obj[4][0][1] = J_B[1];
796 
797  h_obj[2][1][0] = -J_B[3] - J_B[4];
798  h_obj[4][1][0] = J_B[3];
799  h_obj[5][0][1] = J_B[4];
800 
801  /* Second off-diagonal block */
802  loc2 = matr[5]*loc1;
803  J_C[1] -= loc2;
804  J_C[3] += loc2;
805 
806  J_C[0] *= scale[0];
807  J_C[1] *= scale[1];
808  J_C[3] *= scale[1];
809  J_C[4] *= scale[2];
810 
811  A[0] = -J_C[0] - J_C[3];
812  A[4] = -J_C[1] - J_C[4];
813 
814  h_obj[0][0][2] = -A[0] - A[4];
815  h_obj[1][0][2] = A[0];
816  h_obj[2][0][2] = A[4];
817 
818  h_obj[1][2][0] = -J_C[0] - J_C[1];
819  h_obj[3][0][2] = J_C[0];
820  h_obj[4][0][2] = J_C[1];
821 
822  h_obj[2][2][0] = -J_C[3] - J_C[4];
823  h_obj[4][2][0] = J_C[3];
824  h_obj[5][0][2] = J_C[4];
825 
826  /* Second block of rows */
827  loc3 = matr[3]*f + dg[3]*cross;
828  loc4 = dg[3]*g + matr[3]*cross;
829 
830  J_A[0] = loc0 + loc3*matr[3] + loc4*dg[3];
831  J_A[1] = loc3*matr[4] + loc4*dg[4];
832  J_B[0] = loc3*matr[6] + loc4*dg[6];
833  J_B[1] = loc3*matr[7] + loc4*dg[7];
834 
835  loc3 = matr[4]*f + dg[4]*cross;
836  loc4 = dg[4]*g + matr[4]*cross;
837 
838  J_A[3] = loc0 + loc3*matr[4] + loc4*dg[4];
839  J_B[3] = loc3*matr[6] + loc4*dg[6];
840  J_B[4] = loc3*matr[7] + loc4*dg[7];
841 
842  /* Second diagonal block */
843  J_A[0] *= scale[0];
844  J_A[1] *= scale[1];
845  J_A[3] *= scale[2];
846 
847  A[0] = -J_A[0] - J_A[1];
848  A[4] = -J_A[1] - J_A[3];
849 
850  h_obj[0][1][1] = -A[0] - A[4];
851  h_obj[1][1][1] = A[0];
852  h_obj[2][1][1] = A[4];
853 
854  h_obj[3][1][1] = J_A[0];
855  h_obj[4][1][1] = J_A[1];
856 
857  h_obj[5][1][1] = J_A[3];
858 
859  /* Third off-diagonal block */
860  loc2 = matr[2]*loc1;
861  J_B[1] += loc2;
862  J_B[3] -= loc2;
863 
864  J_B[0] *= scale[0];
865  J_B[1] *= scale[1];
866  J_B[3] *= scale[1];
867  J_B[4] *= scale[2];
868 
869  A[0] = -J_B[0] - J_B[3];
870  A[4] = -J_B[1] - J_B[4];
871 
872  h_obj[0][1][2] = -A[0] - A[4];
873  h_obj[1][1][2] = A[0];
874  h_obj[2][1][2] = A[4];
875 
876  h_obj[1][2][1] = -J_B[0] - J_B[1];
877  h_obj[3][1][2] = J_B[0];
878  h_obj[4][1][2] = J_B[1];
879 
880  h_obj[2][2][1] = -J_B[3] - J_B[4];
881  h_obj[4][2][1] = J_B[3];
882  h_obj[5][1][2] = J_B[4];
883 
884  /* Third block of rows */
885  loc3 = matr[6]*f + dg[6]*cross;
886  loc4 = dg[6]*g + matr[6]*cross;
887 
888  J_A[0] = loc0 + loc3*matr[6] + loc4*dg[6];
889  J_A[1] = loc3*matr[7] + loc4*dg[7];
890 
891  loc3 = matr[7]*f + dg[7]*cross;
892  loc4 = dg[7]*g + matr[7]*cross;
893 
894  J_A[3] = loc0 + loc3*matr[7] + loc4*dg[7];
895 
896  /* Third diagonal block */
897  J_A[0] *= scale[0];
898  J_A[1] *= scale[1];
899  J_A[3] *= scale[2];
900 
901  A[0] = -J_A[0] - J_A[1];
902  A[4] = -J_A[1] - J_A[3];
903 
904  h_obj[0][2][2] = -A[0] - A[4];
905  h_obj[1][2][2] = A[0];
906  h_obj[2][2][2] = A[4];
907 
908  h_obj[3][2][2] = J_A[0];
909  h_obj[4][2][2] = J_A[1];
910 
911  h_obj[5][2][2] = J_A[3];
912 
913  // completes diagonal blocks.
914  h_obj[0].fill_lower_triangle();
915  h_obj[3].fill_lower_triangle();
916  h_obj[5].fill_lower_triangle();
917  return true;
918 }
NVec< 3, T > cross(const NVec< 3, T > &u, const NVec< 3, T > &v)
const NT & d
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_fcn_3e ( double &  obj,
Vector3D  g_obj[4],
Matrix3D  h_obj[10],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1062 of file includeLinks/MeanRatioFunctions.hpp.

References A, nvc::cross(), Matrix3D::fill_lower_triangle(), isqrt3, isqrt6, MSQ_MIN, pow(), tisqrt3, and tisqrt6.

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), and IdealWeightMeanRatio::compute_element_analytical_hessian().

1065 {
1066 
1067  std::cout << "";
1068 
1069  double matr[9], f;
1070  double adj_m[9], g;
1071  double dg[9], loc0, loc1, loc2, loc3, loc4;
1072  double A[12], J_A[6], J_B[9], J_C[9], cross;
1073 
1074  /* Calculate M = A*inv(W). */
1075  f = x[1][0] + x[0][0];
1076  matr[0] = x[1][0] - x[0][0];
1077  matr[1] = (2.0*x[2][0] - f)*isqrt3;
1078  matr[2] = (3.0*x[3][0] - x[2][0] - f)*isqrt6;
1079 
1080  f = x[1][1] + x[0][1];
1081  matr[3] = x[1][1] - x[0][1];
1082  matr[4] = (2.0*x[2][1] - f)*isqrt3;
1083  matr[5] = (3.0*x[3][1] - x[2][1] - f)*isqrt6;
1084 
1085  f = x[1][2] + x[0][2];
1086  matr[6] = x[1][2] - x[0][2];
1087  matr[7] = (2.0*x[2][2] - f)*isqrt3;
1088  matr[8] = (3.0*x[3][2] - x[2][2] - f)*isqrt6;
1089 
1090  /* Calculate det(M). */
1091  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
1092  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
1093  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
1094  g = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
1095  if (g < MSQ_MIN) { obj = g; return false; }
1096 
1097  /* Calculate norm(M). */
1098  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
1099  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
1100  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
1101 
1102  loc3 = f;
1103  loc4 = g;
1104 
1105  /* Calculate objective function. */
1106  obj = a * pow(f, b) * pow(g, c);
1107 
1108  /* Calculate the derivative of the objective function. */
1109  f = b * obj / f; /* Constant on nabla f */
1110  g = c * obj / g; /* Constant on nable g */
1111  f *= 2.0; /* Modification for nabla f */
1112 
1113  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
1114  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
1115  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
1116  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
1117  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
1118  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
1119 
1120  adj_m[0] = matr[0]*f + dg[0]*g;
1121  adj_m[1] = matr[1]*f + dg[1]*g;
1122  adj_m[2] = matr[2]*f + dg[2]*g;
1123  adj_m[3] = matr[3]*f + dg[3]*g;
1124  adj_m[4] = matr[4]*f + dg[4]*g;
1125  adj_m[5] = matr[5]*f + dg[5]*g;
1126  adj_m[6] = matr[6]*f + dg[6]*g;
1127  adj_m[7] = matr[7]*f + dg[7]*g;
1128  adj_m[8] = matr[8]*f + dg[8]*g;
1129 
1130  loc0 = isqrt3*adj_m[1];
1131  loc1 = isqrt6*adj_m[2];
1132  loc2 = loc0 + loc1;
1133  g_obj[0][0] = -adj_m[0] - loc2;
1134  g_obj[1][0] = adj_m[0] - loc2;
1135  g_obj[2][0] = 2.0*loc0 - loc1;
1136  g_obj[3][0] = 3.0*loc1;
1137 
1138  loc0 = isqrt3*adj_m[4];
1139  loc1 = isqrt6*adj_m[5];
1140  loc2 = loc0 + loc1;
1141  g_obj[0][1] = -adj_m[3] - loc2;
1142  g_obj[1][1] = adj_m[3] - loc2;
1143  g_obj[2][1] = 2.0*loc0 - loc1;
1144  g_obj[3][1] = 3.0*loc1;
1145 
1146  loc0 = isqrt3*adj_m[7];
1147  loc1 = isqrt6*adj_m[8];
1148  loc2 = loc0 + loc1;
1149  g_obj[0][2] = -adj_m[6] - loc2;
1150  g_obj[1][2] = adj_m[6] - loc2;
1151  g_obj[2][2] = 2.0*loc0 - loc1;
1152  g_obj[3][2] = 3.0*loc1;
1153 
1154  /* Calculate the hessian of the objective. */
1155  loc0 = f; /* Constant on nabla^2 f */
1156  loc1 = g; /* Constant on nabla^2 g */
1157  cross = f * c / loc4; /* Constant on nabla g nabla f */
1158  f = f * (b-1) / loc3; /* Constant on nabla f nabla f */
1159  g = g * (c-1) / loc4; /* Constant on nabla g nabla g */
1160  f *= 2.0; /* Modification for nabla f */
1161 
1162  /* First block of rows */
1163  loc3 = matr[0]*f + dg[0]*cross;
1164  loc4 = dg[0]*g + matr[0]*cross;
1165 
1166  J_A[0] = loc0 + loc3*matr[0] + loc4*dg[0];
1167  J_A[1] = loc3*matr[1] + loc4*dg[1];
1168  J_A[2] = loc3*matr[2] + loc4*dg[2];
1169  J_B[0] = loc3*matr[3] + loc4*dg[3];
1170  J_B[1] = loc3*matr[4] + loc4*dg[4];
1171  J_B[2] = loc3*matr[5] + loc4*dg[5];
1172  J_C[0] = loc3*matr[6] + loc4*dg[6];
1173  J_C[1] = loc3*matr[7] + loc4*dg[7];
1174  J_C[2] = loc3*matr[8] + loc4*dg[8];
1175 
1176  loc3 = matr[1]*f + dg[1]*cross;
1177  loc4 = dg[1]*g + matr[1]*cross;
1178 
1179  J_A[3] = loc0 + loc3*matr[1] + loc4*dg[1];
1180  J_A[4] = loc3*matr[2] + loc4*dg[2];
1181  J_B[3] = loc3*matr[3] + loc4*dg[3];
1182  J_B[4] = loc3*matr[4] + loc4*dg[4];
1183  J_B[5] = loc3*matr[5] + loc4*dg[5];
1184  J_C[3] = loc3*matr[6] + loc4*dg[6];
1185  J_C[4] = loc3*matr[7] + loc4*dg[7];
1186  J_C[5] = loc3*matr[8] + loc4*dg[8];
1187 
1188  loc3 = matr[2]*f + dg[2]*cross;
1189  loc4 = dg[2]*g + matr[2]*cross;
1190 
1191  J_A[5] = loc0 + loc3*matr[2] + loc4*dg[2];
1192  J_B[6] = loc3*matr[3] + loc4*dg[3];
1193  J_B[7] = loc3*matr[4] + loc4*dg[4];
1194  J_B[8] = loc3*matr[5] + loc4*dg[5];
1195  J_C[6] = loc3*matr[6] + loc4*dg[6];
1196  J_C[7] = loc3*matr[7] + loc4*dg[7];
1197  J_C[8] = loc3*matr[8] + loc4*dg[8];
1198 
1199  /* First diagonal block */
1200  loc2 = isqrt3*J_A[1];
1201  loc3 = isqrt6*J_A[2];
1202  loc4 = loc2 + loc3;
1203 
1204  A[0] = -J_A[0] - loc4;
1205  A[1] = J_A[0] - loc4;
1206 
1207  loc2 = isqrt3*J_A[3];
1208  loc3 = isqrt6*J_A[4];
1209  loc4 = loc2 + loc3;
1210 
1211  A[4] = -J_A[1] - loc4;
1212  A[5] = J_A[1] - loc4;
1213  A[6] = 2.0*loc2 - loc3;
1214 
1215  loc2 = isqrt3*J_A[4];
1216  loc3 = isqrt6*J_A[5];
1217  loc4 = loc2 + loc3;
1218 
1219  A[8] = -J_A[2] - loc4;
1220  A[9] = J_A[2] - loc4;
1221  A[10] = 2.0*loc2 - loc3;
1222  A[11] = 3.0*loc3;
1223 
1224  loc2 = isqrt3*A[4];
1225  loc3 = isqrt6*A[8];
1226  loc4 = loc2 + loc3;
1227 
1228  h_obj[0][0][0] = -A[0] - loc4;
1229  h_obj[1][0][0] = A[0] - loc4;
1230  h_obj[2][0][0] = 2.0*loc2 - loc3;
1231  h_obj[3][0][0] = 3.0*loc3;
1232 
1233  loc2 = isqrt3*A[5];
1234  loc3 = isqrt6*A[9];
1235 
1236  h_obj[4][0][0] = A[1] - loc2 - loc3;
1237  h_obj[5][0][0] = 2.0*loc2 - loc3;
1238  h_obj[6][0][0] = 3.0*loc3;
1239 
1240  loc3 = isqrt6*A[10];
1241  h_obj[7][0][0] = tisqrt3*A[6] - loc3;
1242  h_obj[8][0][0] = 3.0*loc3;
1243 
1244  h_obj[9][0][0] = tisqrt6*A[11];
1245 
1246  /* First off-diagonal block */
1247  loc2 = matr[8]*loc1;
1248  J_B[1] += loc2;
1249  J_B[3] -= loc2;
1250 
1251  loc2 = matr[7]*loc1;
1252  J_B[2] -= loc2;
1253  J_B[6] += loc2;
1254 
1255  loc2 = matr[6]*loc1;
1256  J_B[5] += loc2;
1257  J_B[7] -= loc2;
1258 
1259  loc2 = isqrt3*J_B[3];
1260  loc3 = isqrt6*J_B[6];
1261  loc4 = loc2 + loc3;
1262 
1263  A[0] = -J_B[0] - loc4;
1264  A[1] = J_B[0] - loc4;
1265  A[2] = 2.0*loc2 - loc3;
1266  A[3] = 3.0*loc3;
1267 
1268  loc2 = isqrt3*J_B[4];
1269  loc3 = isqrt6*J_B[7];
1270  loc4 = loc2 + loc3;
1271 
1272  A[4] = -J_B[1] - loc4;
1273  A[5] = J_B[1] - loc4;
1274  A[6] = 2.0*loc2 - loc3;
1275  A[7] = 3.0*loc3;
1276 
1277  loc2 = isqrt3*J_B[5];
1278  loc3 = isqrt6*J_B[8];
1279  loc4 = loc2 + loc3;
1280 
1281  A[8] = -J_B[2] - loc4;
1282  A[9] = J_B[2] - loc4;
1283  A[10] = 2.0*loc2 - loc3;
1284  A[11] = 3.0*loc3;
1285 
1286  loc2 = isqrt3*A[4];
1287  loc3 = isqrt6*A[8];
1288  loc4 = loc2 + loc3;
1289 
1290  h_obj[0][0][1] = -A[0] - loc4;
1291  h_obj[1][0][1] = A[0] - loc4;
1292  h_obj[2][0][1] = 2.0*loc2 - loc3;
1293  h_obj[3][0][1] = 3.0*loc3;
1294 
1295  loc2 = isqrt3*A[5];
1296  loc3 = isqrt6*A[9];
1297  loc4 = loc2 + loc3;
1298 
1299  h_obj[1][1][0] = -A[1] - loc4;
1300  h_obj[4][0][1] = A[1] - loc4;
1301  h_obj[5][0][1] = 2.0*loc2 - loc3;
1302  h_obj[6][0][1] = 3.0*loc3;
1303 
1304  loc2 = isqrt3*A[6];
1305  loc3 = isqrt6*A[10];
1306  loc4 = loc2 + loc3;
1307 
1308  h_obj[2][1][0] = -A[2] - loc4;
1309  h_obj[5][1][0] = A[2] - loc4;
1310  h_obj[7][0][1] = 2.0*loc2 - loc3;
1311  h_obj[8][0][1] = 3.0*loc3;
1312 
1313  loc2 = isqrt3*A[7];
1314  loc3 = isqrt6*A[11];
1315  loc4 = loc2 + loc3;
1316 
1317  h_obj[3][1][0] = -A[3] - loc4;
1318  h_obj[6][1][0] = A[3] - loc4;
1319  h_obj[8][1][0] = 2.0*loc2 - loc3;
1320  h_obj[9][0][1] = 3.0*loc3;
1321 
1322  /* Second off-diagonal block */
1323  loc2 = matr[5]*loc1;
1324  J_C[1] -= loc2;
1325  J_C[3] += loc2;
1326 
1327  loc2 = matr[4]*loc1;
1328  J_C[2] += loc2;
1329  J_C[6] -= loc2;
1330 
1331  loc2 = matr[3]*loc1;
1332  J_C[5] -= loc2;
1333  J_C[7] += loc2;
1334 
1335  loc2 = isqrt3*J_C[3];
1336  loc3 = isqrt6*J_C[6];
1337  loc4 = loc2 + loc3;
1338 
1339  A[0] = -J_C[0] - loc4;
1340  A[1] = J_C[0] - loc4;
1341  A[2] = 2.0*loc2 - loc3;
1342  A[3] = 3.0*loc3;
1343 
1344  loc2 = isqrt3*J_C[4];
1345  loc3 = isqrt6*J_C[7];
1346  loc4 = loc2 + loc3;
1347 
1348  A[4] = -J_C[1] - loc4;
1349  A[5] = J_C[1] - loc4;
1350  A[6] = 2.0*loc2 - loc3;
1351  A[7] = 3.0*loc3;
1352 
1353  loc2 = isqrt3*J_C[5];
1354  loc3 = isqrt6*J_C[8];
1355  loc4 = loc2 + loc3;
1356 
1357  A[8] = -J_C[2] - loc4;
1358  A[9] = J_C[2] - loc4;
1359  A[10] = 2.0*loc2 - loc3;
1360  A[11] = 3.0*loc3;
1361 
1362  loc2 = isqrt3*A[4];
1363  loc3 = isqrt6*A[8];
1364  loc4 = loc2 + loc3;
1365 
1366  h_obj[0][0][2] = -A[0] - loc4;
1367  h_obj[1][0][2] = A[0] - loc4;
1368  h_obj[2][0][2] = 2.0*loc2 - loc3;
1369  h_obj[3][0][2] = 3.0*loc3;
1370 
1371  loc2 = isqrt3*A[5];
1372  loc3 = isqrt6*A[9];
1373  loc4 = loc2 + loc3;
1374 
1375  h_obj[1][2][0] = -A[1] - loc4;
1376  h_obj[4][0][2] = A[1] - loc4;
1377  h_obj[5][0][2] = 2.0*loc2 - loc3;
1378  h_obj[6][0][2] = 3.0*loc3;
1379 
1380  loc2 = isqrt3*A[6];
1381  loc3 = isqrt6*A[10];
1382  loc4 = loc2 + loc3;
1383 
1384  h_obj[2][2][0] = -A[2] - loc4;
1385  h_obj[5][2][0] = A[2] - loc4;
1386  h_obj[7][0][2] = 2.0*loc2 - loc3;
1387  h_obj[8][0][2] = 3.0*loc3;
1388 
1389  loc2 = isqrt3*A[7];
1390  loc3 = isqrt6*A[11];
1391  loc4 = loc2 + loc3;
1392 
1393  h_obj[3][2][0] = -A[3] - loc4;
1394  h_obj[6][2][0] = A[3] - loc4;
1395  h_obj[8][2][0] = 2.0*loc2 - loc3;
1396  h_obj[9][0][2] = 3.0*loc3;
1397 
1398  /* Second block of rows */
1399  loc3 = matr[3]*f + dg[3]*cross;
1400  loc4 = dg[3]*g + matr[3]*cross;
1401 
1402  J_A[0] = loc0 + loc3*matr[3] + loc4*dg[3];
1403  J_A[1] = loc3*matr[4] + loc4*dg[4];
1404  J_A[2] = loc3*matr[5] + loc4*dg[5];
1405  J_B[0] = loc3*matr[6] + loc4*dg[6];
1406  J_B[1] = loc3*matr[7] + loc4*dg[7];
1407  J_B[2] = loc3*matr[8] + loc4*dg[8];
1408 
1409  loc3 = matr[4]*f + dg[4]*cross;
1410  loc4 = dg[4]*g + matr[4]*cross;
1411 
1412  J_A[3] = loc0 + loc3*matr[4] + loc4*dg[4];
1413  J_A[4] = loc3*matr[5] + loc4*dg[5];
1414  J_B[3] = loc3*matr[6] + loc4*dg[6];
1415  J_B[4] = loc3*matr[7] + loc4*dg[7];
1416  J_B[5] = loc3*matr[8] + loc4*dg[8];
1417 
1418  loc3 = matr[5]*f + dg[5]*cross;
1419  loc4 = dg[5]*g + matr[5]*cross;
1420 
1421  J_A[5] = loc0 + loc3*matr[5] + loc4*dg[5];
1422  J_B[6] = loc3*matr[6] + loc4*dg[6];
1423  J_B[7] = loc3*matr[7] + loc4*dg[7];
1424  J_B[8] = loc3*matr[8] + loc4*dg[8];
1425 
1426  /* Second diagonal block */
1427  loc2 = isqrt3*J_A[1];
1428  loc3 = isqrt6*J_A[2];
1429  loc4 = loc2 + loc3;
1430 
1431  A[0] = -J_A[0] - loc4;
1432  A[1] = J_A[0] - loc4;
1433 
1434  loc2 = isqrt3*J_A[3];
1435  loc3 = isqrt6*J_A[4];
1436  loc4 = loc2 + loc3;
1437 
1438  A[4] = -J_A[1] - loc4;
1439  A[5] = J_A[1] - loc4;
1440  A[6] = 2.0*loc2 - loc3;
1441 
1442  loc2 = isqrt3*J_A[4];
1443  loc3 = isqrt6*J_A[5];
1444  loc4 = loc2 + loc3;
1445 
1446  A[8] = -J_A[2] - loc4;
1447  A[9] = J_A[2] - loc4;
1448  A[10] = 2.0*loc2 - loc3;
1449  A[11] = 3.0*loc3;
1450 
1451  loc2 = isqrt3*A[4];
1452  loc3 = isqrt6*A[8];
1453  loc4 = loc2 + loc3;
1454 
1455  h_obj[0][1][1] = -A[0] - loc4;
1456  h_obj[1][1][1] = A[0] - loc4;
1457  h_obj[2][1][1] = 2.0*loc2 - loc3;
1458  h_obj[3][1][1] = 3.0*loc3;
1459 
1460  loc2 = isqrt3*A[5];
1461  loc3 = isqrt6*A[9];
1462 
1463  h_obj[4][1][1] = A[1] - loc2 - loc3;
1464  h_obj[5][1][1] = 2.0*loc2 - loc3;
1465  h_obj[6][1][1] = 3.0*loc3;
1466 
1467  loc3 = isqrt6*A[10];
1468  h_obj[7][1][1] = tisqrt3*A[6] - loc3;
1469  h_obj[8][1][1] = 3.0*loc3;
1470 
1471  h_obj[9][1][1] = tisqrt6*A[11];
1472 
1473  /* Third off-diagonal block */
1474  loc2 = matr[2]*loc1;
1475  J_B[1] += loc2;
1476  J_B[3] -= loc2;
1477 
1478  loc2 = matr[1]*loc1;
1479  J_B[2] -= loc2;
1480  J_B[6] += loc2;
1481 
1482  loc2 = matr[0]*loc1;
1483  J_B[5] += loc2;
1484  J_B[7] -= loc2;
1485 
1486  loc2 = isqrt3*J_B[3];
1487  loc3 = isqrt6*J_B[6];
1488  loc4 = loc2 + loc3;
1489 
1490  A[0] = -J_B[0] - loc4;
1491  A[1] = J_B[0] - loc4;
1492  A[2] = 2.0*loc2 - loc3;
1493  A[3] = 3.0*loc3;
1494 
1495  loc2 = isqrt3*J_B[4];
1496  loc3 = isqrt6*J_B[7];
1497  loc4 = loc2 + loc3;
1498 
1499  A[4] = -J_B[1] - loc4;
1500  A[5] = J_B[1] - loc4;
1501  A[6] = 2.0*loc2 - loc3;
1502  A[7] = 3.0*loc3;
1503 
1504  loc2 = isqrt3*J_B[5];
1505  loc3 = isqrt6*J_B[8];
1506  loc4 = loc2 + loc3;
1507 
1508  A[8] = -J_B[2] - loc4;
1509  A[9] = J_B[2] - loc4;
1510  A[10] = 2.0*loc2 - loc3;
1511  A[11] = 3.0*loc3;
1512 
1513  loc2 = isqrt3*A[4];
1514  loc3 = isqrt6*A[8];
1515  loc4 = loc2 + loc3;
1516 
1517  h_obj[0][1][2] = -A[0] - loc4;
1518  h_obj[1][1][2] = A[0] - loc4;
1519  h_obj[2][1][2] = 2.0*loc2 - loc3;
1520  h_obj[3][1][2] = 3.0*loc3;
1521 
1522  loc2 = isqrt3*A[5];
1523  loc3 = isqrt6*A[9];
1524  loc4 = loc2 + loc3;
1525 
1526  h_obj[1][2][1] = -A[1] - loc4;
1527  h_obj[4][1][2] = A[1] - loc4;
1528  h_obj[5][1][2] = 2.0*loc2 - loc3;
1529  h_obj[6][1][2] = 3.0*loc3;
1530 
1531  loc2 = isqrt3*A[6];
1532  loc3 = isqrt6*A[10];
1533  loc4 = loc2 + loc3;
1534 
1535  h_obj[2][2][1] = -A[2] - loc4;
1536  h_obj[5][2][1] = A[2] - loc4;
1537  h_obj[7][1][2] = 2.0*loc2 - loc3;
1538  h_obj[8][1][2] = 3.0*loc3;
1539 
1540  loc2 = isqrt3*A[7];
1541  loc3 = isqrt6*A[11];
1542  loc4 = loc2 + loc3;
1543 
1544  h_obj[3][2][1] = -A[3] - loc4;
1545  h_obj[6][2][1] = A[3] - loc4;
1546  h_obj[8][2][1] = 2.0*loc2 - loc3;
1547  h_obj[9][1][2] = 3.0*loc3;
1548 
1549  /* Third block of rows */
1550  loc3 = matr[6]*f + dg[6]*cross;
1551  loc4 = dg[6]*g + matr[6]*cross;
1552 
1553  J_A[0] = loc0 + loc3*matr[6] + loc4*dg[6];
1554  J_A[1] = loc3*matr[7] + loc4*dg[7];
1555  J_A[2] = loc3*matr[8] + loc4*dg[8];
1556 
1557  loc3 = matr[7]*f + dg[7]*cross;
1558  loc4 = dg[7]*g + matr[7]*cross;
1559 
1560  J_A[3] = loc0 + loc3*matr[7] + loc4*dg[7];
1561  J_A[4] = loc3*matr[8] + loc4*dg[8];
1562 
1563  loc3 = matr[8]*f + dg[8]*cross;
1564  loc4 = dg[8]*g + matr[8]*cross;
1565 
1566  J_A[5] = loc0 + loc3*matr[8] + loc4*dg[8];
1567 
1568  /* Third diagonal block */
1569  loc2 = isqrt3*J_A[1];
1570  loc3 = isqrt6*J_A[2];
1571  loc4 = loc2 + loc3;
1572 
1573  A[0] = -J_A[0] - loc4;
1574  A[1] = J_A[0] - loc4;
1575 
1576  loc2 = isqrt3*J_A[3];
1577  loc3 = isqrt6*J_A[4];
1578  loc4 = loc2 + loc3;
1579 
1580  A[4] = -J_A[1] - loc4;
1581  A[5] = J_A[1] - loc4;
1582  A[6] = 2.0*loc2 - loc3;
1583 
1584  loc2 = isqrt3*J_A[4];
1585  loc3 = isqrt6*J_A[5];
1586  loc4 = loc2 + loc3;
1587 
1588  A[8] = -J_A[2] - loc4;
1589  A[9] = J_A[2] - loc4;
1590  A[10] = 2.0*loc2 - loc3;
1591  A[11] = 3.0*loc3;
1592 
1593  loc2 = isqrt3*A[4];
1594  loc3 = isqrt6*A[8];
1595  loc4 = loc2 + loc3;
1596 
1597  h_obj[0][2][2] = -A[0] - loc4;
1598  h_obj[1][2][2] = A[0] - loc4;
1599  h_obj[2][2][2] = 2.0*loc2 - loc3;
1600  h_obj[3][2][2] = 3.0*loc3;
1601 
1602  loc2 = isqrt3*A[5];
1603  loc3 = isqrt6*A[9];
1604 
1605  h_obj[4][2][2] = A[1] - loc2 - loc3;
1606  h_obj[5][2][2] = 2.0*loc2 - loc3;
1607  h_obj[6][2][2] = 3.0*loc3;
1608 
1609  loc3 = isqrt6*A[10];
1610  h_obj[7][2][2] = tisqrt3*A[6] - loc3;
1611  h_obj[8][2][2] = 3.0*loc3;
1612 
1613  h_obj[9][2][2] = tisqrt6*A[11];
1614 
1615  // completes diagonal blocks.
1616  h_obj[0].fill_lower_triangle();
1617  h_obj[4].fill_lower_triangle();
1618  h_obj[7].fill_lower_triangle();
1619  h_obj[9].fill_lower_triangle();
1620  return true;
1621 }
NVec< 3, T > cross(const NVec< 3, T > &u, const NVec< 3, T > &v)
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_fcn_3e_v0 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1805 of file includeLinks/MeanRatioFunctions.hpp.

References h_fcn_3e_v3().

1808 {
1809  static Vector3D my_x[4];
1810 
1811  my_x[0] = x[1];
1812  my_x[1] = x[3];
1813  my_x[2] = x[2];
1814  my_x[3] = x[0];
1815  return h_fcn_3e_v3(obj, g_obj, h_obj, my_x, a, b, c);
1816 }
bool h_fcn_3e_v3(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
NVec< 3, double > Vector3D
void int int REAL * x
Definition: read.cpp:74

Here is the call graph for this function:

bool h_fcn_3e_v1 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1818 of file includeLinks/MeanRatioFunctions.hpp.

References h_fcn_3e_v3().

1821 {
1822  static Vector3D my_x[4];
1823 
1824  my_x[0] = x[0];
1825  my_x[1] = x[2];
1826  my_x[2] = x[3];
1827  my_x[3] = x[1];
1828  return h_fcn_3e_v3(obj, g_obj, h_obj, my_x, a, b, c);
1829 }
bool h_fcn_3e_v3(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
NVec< 3, double > Vector3D
void int int REAL * x
Definition: read.cpp:74

Here is the call graph for this function:

bool h_fcn_3e_v2 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1831 of file includeLinks/MeanRatioFunctions.hpp.

References h_fcn_3e_v3().

1834 {
1835  static Vector3D my_x[4];
1836 
1837  my_x[0] = x[1];
1838  my_x[1] = x[0];
1839  my_x[2] = x[3];
1840  my_x[3] = x[2];
1841  return h_fcn_3e_v3(obj, g_obj, h_obj, my_x, a, b, c);
1842 }
bool h_fcn_3e_v3(double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
NVec< 3, double > Vector3D
void int int REAL * x
Definition: read.cpp:74

Here is the call graph for this function:

bool h_fcn_3e_v3 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 1717 of file includeLinks/MeanRatioFunctions.hpp.

References nvc::cross(), Matrix3D::fill_lower_triangle(), isqrt3, isqrt6, MSQ_MIN, pow(), and tisqrt6.

Referenced by h_fcn_3e_v0(), h_fcn_3e_v1(), and h_fcn_3e_v2().

1720 {
1721  double matr[9], f, g;
1722  double dg[9], loc0, loc1, loc3, loc4;
1723  double cross;
1724 
1725  /* Calculate M = A*inv(W). */
1726  f = x[1][0] + x[0][0];
1727  matr[0] = x[1][0] - x[0][0];
1728  matr[1] = (2.0*x[2][0] - f)*isqrt3;
1729  matr[2] = (3.0*x[3][0] - x[2][0] - f)*isqrt6;
1730 
1731  f = x[1][1] + x[0][1];
1732  matr[3] = x[1][1] - x[0][1];
1733  matr[4] = (2.0*x[2][1] - f)*isqrt3;
1734  matr[5] = (3.0*x[3][1] - x[2][1] - f)*isqrt6;
1735 
1736  f = x[1][2] + x[0][2];
1737  matr[6] = x[1][2] - x[0][2];
1738  matr[7] = (2.0*x[2][2] - f)*isqrt3;
1739  matr[8] = (3.0*x[3][2] - x[2][2] - f)*isqrt6;
1740 
1741  /* Calculate det(M). */
1742  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
1743  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
1744  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
1745  g = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
1746  if (g < MSQ_MIN) { obj = g; return false; }
1747 
1748  /* Calculate norm(M). */
1749  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
1750  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
1751  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
1752 
1753  loc3 = f;
1754  loc4 = g;
1755 
1756  /* Calculate objective function. */
1757  obj = a * pow(f, b) * pow(g, c);
1758 
1759  /* Calculate the derivative of the objective function. */
1760  f = b * obj / f; /* Constant on nabla f */
1761  g = c * obj / g; /* Constant on nable g */
1762  f *= 2.0; /* Modification for nabla f */
1763 
1764  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
1765  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
1766 
1767  g_obj[0] = tisqrt6*(matr[2]*f + dg[2]*g);
1768  g_obj[1] = tisqrt6*(matr[5]*f + dg[5]*g);
1769  g_obj[2] = tisqrt6*(matr[8]*f + dg[8]*g);
1770 
1771  /* Calculate the hessian of the objective. */
1772  loc0 = f; /* Constant on nabla^2 f */
1773  loc1 = g; /* Constant on nabla^2 g */
1774  cross = f * c / loc4; /* Constant on nabla g nabla f */
1775  f = f * (b-1) / loc3; /* Constant on nabla f nabla f */
1776  g = g * (c-1) / loc4; /* Constant on nabla g nabla g */
1777  f *= 2.0; /* Modification for nabla f */
1778 
1779  /* First block of rows */
1780  loc3 = matr[2]*f + dg[2]*cross;
1781  loc4 = dg[2]*g + matr[2]*cross;
1782 
1783  h_obj[0][0] = 1.5*(loc0 + loc3*matr[2] + loc4*dg[2]);
1784  h_obj[0][1] = 1.5*(loc3*matr[5] + loc4*dg[5]);
1785  h_obj[0][2] = 1.5*(loc3*matr[8] + loc4*dg[8]);
1786 
1787  /* Second block of rows */
1788  loc3 = matr[5]*f + dg[5]*cross;
1789  loc4 = dg[5]*g + matr[5]*cross;
1790 
1791  h_obj[1][1] = 1.5*(loc0 + loc3*matr[5] + loc4*dg[5]);
1792  h_obj[1][2] = 1.5*(loc3*matr[8] + loc4*dg[8]);
1793 
1794  /* Third block of rows */
1795  loc3 = matr[8]*f + dg[8]*cross;
1796  loc4 = dg[8]*g + matr[8]*cross;
1797 
1798  h_obj[2][2] = 1.5*(loc0 + loc3*matr[8] + loc4*dg[8]);
1799 
1800  // completes diagonal block.
1801  h_obj.fill_lower_triangle();
1802  return true;
1803 }
NVec< 3, T > cross(const NVec< 3, T > &u, const NVec< 3, T > &v)
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

int h_fcn_3i ( double &  obj,
Vector3D  g_obj[4],
Matrix3D  h_obj[10],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
)
inline

Definition at line 1973 of file includeLinks/MeanRatioFunctions.hpp.

References A, nvc::cross(), Matrix3D::fill_lower_triangle(), MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), and IdealWeightMeanRatio::compute_element_analytical_hessian().

1977 {
1978  double matr[9], f;
1979  double adj_m[9], g;
1980  double dg[9], loc0, loc1, loc2, loc3, loc4;
1981  double A[3], J_A[6], J_B[9], J_C[9], cross;
1982 
1983  const double scale[6] = {
1984  d[0]*d[0], d[0]*d[1], d[0]*d[2],
1985  d[1]*d[1], d[1]*d[2],
1986  d[2]*d[2]
1987  };
1988 
1989  /* Calculate M = A*inv(W). */
1990  matr[0] = d[0]*(x[1][0] - x[0][0]);
1991  matr[1] = d[1]*(x[2][0] - x[0][0]);
1992  matr[2] = d[2]*(x[3][0] - x[0][0]);
1993 
1994  matr[3] = d[0]*(x[1][1] - x[0][1]);
1995  matr[4] = d[1]*(x[2][1] - x[0][1]);
1996  matr[5] = d[2]*(x[3][1] - x[0][1]);
1997 
1998  matr[6] = d[0]*(x[1][2] - x[0][2]);
1999  matr[7] = d[1]*(x[2][2] - x[0][2]);
2000  matr[8] = d[2]*(x[3][2] - x[0][2]);
2001 
2002  /* Calculate det(M). */
2003  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
2004  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
2005  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
2006  g = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
2007  if (g < MSQ_MIN) { obj = g; return false; }
2008 
2009  /* Calculate norm(M). */
2010  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
2011  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
2012  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
2013 
2014  loc3 = f;
2015  loc4 = g;
2016 
2017  /* Calculate objective function. */
2018  obj = a * pow(f, b) * pow(g, c);
2019 
2020  /* Calculate the derivative of the objective function. */
2021  f = b * obj / f; /* Constant on nabla f */
2022  g = c * obj / g; /* Constant on nable g */
2023  f *= 2.0; /* Modification for nabla f */
2024 
2025  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
2026  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
2027  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
2028  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
2029  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
2030  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
2031 
2032  adj_m[0] = d[0]*(matr[0]*f + dg[0]*g);
2033  adj_m[1] = d[1]*(matr[1]*f + dg[1]*g);
2034  adj_m[2] = d[2]*(matr[2]*f + dg[2]*g);
2035  adj_m[3] = d[0]*(matr[3]*f + dg[3]*g);
2036  adj_m[4] = d[1]*(matr[4]*f + dg[4]*g);
2037  adj_m[5] = d[2]*(matr[5]*f + dg[5]*g);
2038  adj_m[6] = d[0]*(matr[6]*f + dg[6]*g);
2039  adj_m[7] = d[1]*(matr[7]*f + dg[7]*g);
2040  adj_m[8] = d[2]*(matr[8]*f + dg[8]*g);
2041 
2042  g_obj[0][0] = -adj_m[0] - adj_m[1] - adj_m[2];
2043  g_obj[1][0] = adj_m[0];
2044  g_obj[2][0] = adj_m[1];
2045  g_obj[3][0] = adj_m[2];
2046 
2047  g_obj[0][1] = -adj_m[3] - adj_m[4] - adj_m[5];
2048  g_obj[1][1] = adj_m[3];
2049  g_obj[2][1] = adj_m[4];
2050  g_obj[3][1] = adj_m[5];
2051 
2052  g_obj[0][2] = -adj_m[6] - adj_m[7] - adj_m[8];
2053  g_obj[1][2] = adj_m[6];
2054  g_obj[2][2] = adj_m[7];
2055  g_obj[3][2] = adj_m[8];
2056 
2057  /* Calculate the hessian of the objective. */
2058  loc0 = f; /* Constant on nabla^2 f */
2059  loc1 = g; /* Constant on nabla^2 g */
2060  cross = f * c / loc4; /* Constant on nabla g nabla f */
2061  f = f * (b-1) / loc3; /* Constant on nabla f nabla f */
2062  g = g * (c-1) / loc4; /* Constant on nabla g nabla g */
2063  f *= 2.0; /* Modification for nabla f */
2064 
2065  /* First block of rows */
2066  loc3 = matr[0]*f + dg[0]*cross;
2067  loc4 = dg[0]*g + matr[0]*cross;
2068 
2069  J_A[0] = loc0 + loc3*matr[0] + loc4*dg[0];
2070  J_A[1] = loc3*matr[1] + loc4*dg[1];
2071  J_A[2] = loc3*matr[2] + loc4*dg[2];
2072  J_B[0] = loc3*matr[3] + loc4*dg[3];
2073  J_B[1] = loc3*matr[4] + loc4*dg[4];
2074  J_B[2] = loc3*matr[5] + loc4*dg[5];
2075  J_C[0] = loc3*matr[6] + loc4*dg[6];
2076  J_C[1] = loc3*matr[7] + loc4*dg[7];
2077  J_C[2] = loc3*matr[8] + loc4*dg[8];
2078 
2079  loc3 = matr[1]*f + dg[1]*cross;
2080  loc4 = dg[1]*g + matr[1]*cross;
2081 
2082  J_A[3] = loc0 + loc3*matr[1] + loc4*dg[1];
2083  J_A[4] = loc3*matr[2] + loc4*dg[2];
2084  J_B[3] = loc3*matr[3] + loc4*dg[3];
2085  J_B[4] = loc3*matr[4] + loc4*dg[4];
2086  J_B[5] = loc3*matr[5] + loc4*dg[5];
2087  J_C[3] = loc3*matr[6] + loc4*dg[6];
2088  J_C[4] = loc3*matr[7] + loc4*dg[7];
2089  J_C[5] = loc3*matr[8] + loc4*dg[8];
2090 
2091  loc3 = matr[2]*f + dg[2]*cross;
2092  loc4 = dg[2]*g + matr[2]*cross;
2093 
2094  J_A[5] = loc0 + loc3*matr[2] + loc4*dg[2];
2095  J_B[6] = loc3*matr[3] + loc4*dg[3];
2096  J_B[7] = loc3*matr[4] + loc4*dg[4];
2097  J_B[8] = loc3*matr[5] + loc4*dg[5];
2098  J_C[6] = loc3*matr[6] + loc4*dg[6];
2099  J_C[7] = loc3*matr[7] + loc4*dg[7];
2100  J_C[8] = loc3*matr[8] + loc4*dg[8];
2101 
2102  /* First diagonal block */
2103  J_A[0] *= scale[0];
2104  J_A[1] *= scale[1];
2105  J_A[2] *= scale[2];
2106  J_A[3] *= scale[3];
2107  J_A[4] *= scale[4];
2108  J_A[5] *= scale[5];
2109 
2110  A[0] = -J_A[0] - J_A[1] - J_A[2];
2111  A[1] = -J_A[1] - J_A[3] - J_A[4];
2112  A[2] = -J_A[2] - J_A[4] - J_A[5];
2113 
2114  h_obj[0][0][0] = -A[0] - A[1] - A[2];
2115  h_obj[1][0][0] = A[0];
2116  h_obj[2][0][0] = A[1];
2117  h_obj[3][0][0] = A[2];
2118 
2119  h_obj[4][0][0] = J_A[0];
2120  h_obj[5][0][0] = J_A[1];
2121  h_obj[6][0][0] = J_A[2];
2122 
2123  h_obj[7][0][0] = J_A[3];
2124  h_obj[8][0][0] = J_A[4];
2125 
2126  h_obj[9][0][0] = J_A[5];
2127 
2128  /* First off-diagonal block */
2129  loc2 = matr[8]*loc1;
2130  J_B[1] += loc2;
2131  J_B[3] -= loc2;
2132 
2133  loc2 = matr[7]*loc1;
2134  J_B[2] -= loc2;
2135  J_B[6] += loc2;
2136 
2137  loc2 = matr[6]*loc1;
2138  J_B[5] += loc2;
2139  J_B[7] -= loc2;
2140 
2141  J_B[0] *= scale[0];
2142  J_B[1] *= scale[1];
2143  J_B[2] *= scale[2];
2144  J_B[3] *= scale[1];
2145  J_B[4] *= scale[3];
2146  J_B[5] *= scale[4];
2147  J_B[6] *= scale[2];
2148  J_B[7] *= scale[4];
2149  J_B[8] *= scale[5];
2150 
2151  A[0] = -J_B[0] - J_B[3] - J_B[6];
2152  A[1] = -J_B[1] - J_B[4] - J_B[7];
2153  A[2] = -J_B[2] - J_B[5] - J_B[8];
2154 
2155  h_obj[0][0][1] = -A[0] - A[1] - A[2];
2156  h_obj[1][0][1] = A[0];
2157  h_obj[2][0][1] = A[1];
2158  h_obj[3][0][1] = A[2];
2159 
2160  h_obj[1][1][0] = -J_B[0] - J_B[1] - J_B[2];
2161  h_obj[4][0][1] = J_B[0];
2162  h_obj[5][0][1] = J_B[1];
2163  h_obj[6][0][1] = J_B[2];
2164 
2165  h_obj[2][1][0] = -J_B[3] - J_B[4] - J_B[5];
2166  h_obj[5][1][0] = J_B[3];
2167  h_obj[7][0][1] = J_B[4];
2168  h_obj[8][0][1] = J_B[5];
2169 
2170  h_obj[3][1][0] = -J_B[6] - J_B[7] - J_B[8];
2171  h_obj[6][1][0] = J_B[6];
2172  h_obj[8][1][0] = J_B[7];
2173  h_obj[9][0][1] = J_B[8];
2174 
2175  /* Second off-diagonal block */
2176  loc2 = matr[5]*loc1;
2177  J_C[1] -= loc2;
2178  J_C[3] += loc2;
2179 
2180  loc2 = matr[4]*loc1;
2181  J_C[2] += loc2;
2182  J_C[6] -= loc2;
2183 
2184  loc2 = matr[3]*loc1;
2185  J_C[5] -= loc2;
2186  J_C[7] += loc2;
2187 
2188  J_C[0] *= scale[0];
2189  J_C[1] *= scale[1];
2190  J_C[2] *= scale[2];
2191  J_C[3] *= scale[1];
2192  J_C[4] *= scale[3];
2193  J_C[5] *= scale[4];
2194  J_C[6] *= scale[2];
2195  J_C[7] *= scale[4];
2196  J_C[8] *= scale[5];
2197 
2198  A[0] = -J_C[0] - J_C[3] - J_C[6];
2199  A[1] = -J_C[1] - J_C[4] - J_C[7];
2200  A[2] = -J_C[2] - J_C[5] - J_C[8];
2201 
2202  h_obj[0][0][2] = -A[0] - A[1] - A[2];
2203  h_obj[1][0][2] = A[0];
2204  h_obj[2][0][2] = A[1];
2205  h_obj[3][0][2] = A[2];
2206 
2207  h_obj[1][2][0] = -J_C[0] - J_C[1] - J_C[2];
2208  h_obj[4][0][2] = J_C[0];
2209  h_obj[5][0][2] = J_C[1];
2210  h_obj[6][0][2] = J_C[2];
2211 
2212  h_obj[2][2][0] = -J_C[3] - J_C[4] - J_C[5];
2213  h_obj[5][2][0] = J_C[3];
2214  h_obj[7][0][2] = J_C[4];
2215  h_obj[8][0][2] = J_C[5];
2216 
2217  h_obj[3][2][0] = -J_C[6] - J_C[7] - J_C[8];
2218  h_obj[6][2][0] = J_C[6];
2219  h_obj[8][2][0] = J_C[7];
2220  h_obj[9][0][2] = J_C[8];
2221 
2222  /* Second block of rows */
2223  loc3 = matr[3]*f + dg[3]*cross;
2224  loc4 = dg[3]*g + matr[3]*cross;
2225 
2226  J_A[0] = loc0 + loc3*matr[3] + loc4*dg[3];
2227  J_A[1] = loc3*matr[4] + loc4*dg[4];
2228  J_A[2] = loc3*matr[5] + loc4*dg[5];
2229  J_B[0] = loc3*matr[6] + loc4*dg[6];
2230  J_B[1] = loc3*matr[7] + loc4*dg[7];
2231  J_B[2] = loc3*matr[8] + loc4*dg[8];
2232 
2233  loc3 = matr[4]*f + dg[4]*cross;
2234  loc4 = dg[4]*g + matr[4]*cross;
2235 
2236  J_A[3] = loc0 + loc3*matr[4] + loc4*dg[4];
2237  J_A[4] = loc3*matr[5] + loc4*dg[5];
2238  J_B[3] = loc3*matr[6] + loc4*dg[6];
2239  J_B[4] = loc3*matr[7] + loc4*dg[7];
2240  J_B[5] = loc3*matr[8] + loc4*dg[8];
2241 
2242  loc3 = matr[5]*f + dg[5]*cross;
2243  loc4 = dg[5]*g + matr[5]*cross;
2244 
2245  J_A[5] = loc0 + loc3*matr[5] + loc4*dg[5];
2246  J_B[6] = loc3*matr[6] + loc4*dg[6];
2247  J_B[7] = loc3*matr[7] + loc4*dg[7];
2248  J_B[8] = loc3*matr[8] + loc4*dg[8];
2249 
2250  /* Second diagonal block */
2251  J_A[0] *= scale[0];
2252  J_A[1] *= scale[1];
2253  J_A[2] *= scale[2];
2254  J_A[3] *= scale[3];
2255  J_A[4] *= scale[4];
2256  J_A[5] *= scale[5];
2257 
2258  A[0] = -J_A[0] - J_A[1] - J_A[2];
2259  A[1] = -J_A[1] - J_A[3] - J_A[4];
2260  A[2] = -J_A[2] - J_A[4] - J_A[5];
2261 
2262  h_obj[0][1][1] = -A[0] - A[1] - A[2];
2263  h_obj[1][1][1] = A[0];
2264  h_obj[2][1][1] = A[1];
2265  h_obj[3][1][1] = A[2];
2266 
2267  h_obj[4][1][1] = J_A[0];
2268  h_obj[5][1][1] = J_A[1];
2269  h_obj[6][1][1] = J_A[2];
2270 
2271  h_obj[7][1][1] = J_A[3];
2272  h_obj[8][1][1] = J_A[4];
2273 
2274  h_obj[9][1][1] = J_A[5];
2275 
2276  /* Third off-diagonal block */
2277  loc2 = matr[2]*loc1;
2278  J_B[1] += loc2;
2279  J_B[3] -= loc2;
2280 
2281  loc2 = matr[1]*loc1;
2282  J_B[2] -= loc2;
2283  J_B[6] += loc2;
2284 
2285  loc2 = matr[0]*loc1;
2286  J_B[5] += loc2;
2287  J_B[7] -= loc2;
2288 
2289  J_B[0] *= scale[0];
2290  J_B[1] *= scale[1];
2291  J_B[2] *= scale[2];
2292  J_B[3] *= scale[1];
2293  J_B[4] *= scale[3];
2294  J_B[5] *= scale[4];
2295  J_B[6] *= scale[2];
2296  J_B[7] *= scale[4];
2297  J_B[8] *= scale[5];
2298 
2299  A[0] = -J_B[0] - J_B[3] - J_B[6];
2300  A[1] = -J_B[1] - J_B[4] - J_B[7];
2301  A[2] = -J_B[2] - J_B[5] - J_B[8];
2302 
2303  h_obj[0][1][2] = -A[0] - A[1] - A[2];
2304  h_obj[1][1][2] = A[0];
2305  h_obj[2][1][2] = A[1];
2306  h_obj[3][1][2] = A[2];
2307 
2308  h_obj[1][2][1] = -J_B[0] - J_B[1] - J_B[2];
2309  h_obj[4][1][2] = J_B[0];
2310  h_obj[5][1][2] = J_B[1];
2311  h_obj[6][1][2] = J_B[2];
2312 
2313  h_obj[2][2][1] = -J_B[3] - J_B[4] - J_B[5];
2314  h_obj[5][2][1] = J_B[3];
2315  h_obj[7][1][2] = J_B[4];
2316  h_obj[8][1][2] = J_B[5];
2317 
2318  h_obj[3][2][1] = -J_B[6] - J_B[7] - J_B[8];
2319  h_obj[6][2][1] = J_B[6];
2320  h_obj[8][2][1] = J_B[7];
2321  h_obj[9][1][2] = J_B[8];
2322 
2323  /* Third block of rows */
2324  loc3 = matr[6]*f + dg[6]*cross;
2325  loc4 = dg[6]*g + matr[6]*cross;
2326 
2327  J_A[0] = loc0 + loc3*matr[6] + loc4*dg[6];
2328  J_A[1] = loc3*matr[7] + loc4*dg[7];
2329  J_A[2] = loc3*matr[8] + loc4*dg[8];
2330 
2331  loc3 = matr[7]*f + dg[7]*cross;
2332  loc4 = dg[7]*g + matr[7]*cross;
2333 
2334  J_A[3] = loc0 + loc3*matr[7] + loc4*dg[7];
2335  J_A[4] = loc3*matr[8] + loc4*dg[8];
2336 
2337  loc3 = matr[8]*f + dg[8]*cross;
2338  loc4 = dg[8]*g + matr[8]*cross;
2339 
2340  J_A[5] = loc0 + loc3*matr[8] + loc4*dg[8];
2341 
2342  /* Third diagonal block */
2343  J_A[0] *= scale[0];
2344  J_A[1] *= scale[1];
2345  J_A[2] *= scale[2];
2346  J_A[3] *= scale[3];
2347  J_A[4] *= scale[4];
2348  J_A[5] *= scale[5];
2349 
2350  A[0] = -J_A[0] - J_A[1] - J_A[2];
2351  A[1] = -J_A[1] - J_A[3] - J_A[4];
2352  A[2] = -J_A[2] - J_A[4] - J_A[5];
2353 
2354  h_obj[0][2][2] = -A[0] - A[1] - A[2];
2355  h_obj[1][2][2] = A[0];
2356  h_obj[2][2][2] = A[1];
2357  h_obj[3][2][2] = A[2];
2358 
2359  h_obj[4][2][2] = J_A[0];
2360  h_obj[5][2][2] = J_A[1];
2361  h_obj[6][2][2] = J_A[2];
2362 
2363  h_obj[7][2][2] = J_A[3];
2364  h_obj[8][2][2] = J_A[4];
2365 
2366  h_obj[9][2][2] = J_A[5];
2367 
2368  // completes diagonal blocks.
2369  h_obj[0].fill_lower_triangle();
2370  h_obj[4].fill_lower_triangle();
2371  h_obj[7].fill_lower_triangle();
2372  h_obj[9].fill_lower_triangle();
2373  return true;
2374 }
NVec< 3, T > cross(const NVec< 3, T > &u, const NVec< 3, T > &v)
const NT & d
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_2 ( double &  obj,
Vector3D  g_obj[3],
Matrix3D  h_obj[6],
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 310 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

318  {
319  double matr[9], f, t1, t2;
320  double matd[9], g, t3, loc1;
321  double adjm[9], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
322  double J_A[6], J_B[10], J_C[10], J_D[6], J_E[10], J_F[6];
323  double A[9];
324 
325  /* Calculate M = A*inv(R). */
326  f = x[1][0] - x[0][0];
327  g = x[2][0] - x[0][0];
328  matr[0] = f*invR[0][0];
329  matr[1] = f*invR[0][1] + g*invR[1][1];
330  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
331 
332  f = x[1][1] - x[0][1];
333  g = x[2][1] - x[0][1];
334  matr[3] = f*invR[0][0];
335  matr[4] = f*invR[0][1] + g*invR[1][1];
336  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
337 
338  f = x[1][2] - x[0][2];
339  g = x[2][2] - x[0][2];
340  matr[6] = f*invR[0][0];
341  matr[7] = f*invR[0][1] + g*invR[1][1];
342  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
343 
344  /* Calculate det(M). */
345  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
346  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
347  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
348  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
349  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
350  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
351  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
352  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
353  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
354 
355  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
356 
357  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
358 
359  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
360  t2 = t1*t1 + 4.0*delta*delta;
361  t3 = sqrt(t2);
362  g = t1 + t3;
363 
364  /* Calculate N = M - beta*Q. */
365  matd[0] = matr[0] - beta*Q[0][0];
366  matd[1] = matr[1] - beta*Q[0][1];
367  matd[2] = matr[2] - beta*Q[0][2];
368  matd[3] = matr[3] - beta*Q[1][0];
369  matd[4] = matr[4] - beta*Q[1][1];
370  matd[5] = matr[5] - beta*Q[1][2];
371  matd[6] = matr[6] - beta*Q[2][0];
372  matd[7] = matr[7] - beta*Q[2][1];
373  matd[8] = matr[8] - beta*Q[2][2];
374 
375  /* Calculate norm(N) */
376  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
377  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
378  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
379 
380  /* Calculate objective function. */
381  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
382  obj = f * loc1;
383 
384  /* Calculate the derivative of the objective function. */
385  t3 = 1.0 / t3;
386  dobj_df = 2.0 * loc1;
387  dobj_dg = -gamma * obj * t3;
388  dobj_dfdg = -gamma * dobj_df * t3;
389  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
390 
391  /* Calculate adjoint matrix */
392  adjm[0] = dobj_df*matd[0] + dobj_dg*dg[0];
393  adjm[1] = dobj_df*matd[1] + dobj_dg*dg[1];
394  adjm[2] = dobj_df*matd[2] + dobj_dg*dg[2];
395  adjm[3] = dobj_df*matd[3] + dobj_dg*dg[3];
396  adjm[4] = dobj_df*matd[4] + dobj_dg*dg[4];
397  adjm[5] = dobj_df*matd[5] + dobj_dg*dg[5];
398  adjm[6] = dobj_df*matd[6] + dobj_dg*dg[6];
399  adjm[7] = dobj_df*matd[7] + dobj_dg*dg[7];
400  adjm[8] = dobj_df*matd[8] + dobj_dg*dg[8];
401 
402  /* Construct gradients */
403  g_obj[1][0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
404  g_obj[2][0] = invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
405  g_obj[0][0] = -g_obj[1][0] - g_obj[2][0];
406 
407  g_obj[1][1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
408  g_obj[2][1] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
409  g_obj[0][1] = -g_obj[1][1] - g_obj[2][1];
410 
411  g_obj[1][2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
412  g_obj[2][2] = invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
413  g_obj[0][2] = -g_obj[1][2] - g_obj[2][2];
414 
415  /* Start of the Hessian evaluation */
416  adjm[0] = dobj_dg*matr[0]; matd[0] *= dobj_dfdg;
417  adjm[1] = dobj_dg*matr[1]; matd[1] *= dobj_dfdg;
418  adjm[2] = dobj_dg*matr[2]; matd[2] *= dobj_dfdg;
419  adjm[3] = dobj_dg*matr[3]; matd[3] *= dobj_dfdg;
420  adjm[4] = dobj_dg*matr[4]; matd[4] *= dobj_dfdg;
421  adjm[5] = dobj_dg*matr[5]; matd[5] *= dobj_dfdg;
422  adjm[6] = dobj_dg*matr[6]; matd[6] *= dobj_dfdg;
423  adjm[7] = dobj_dg*matr[7]; matd[7] *= dobj_dfdg;
424  adjm[8] = dobj_dg*matr[8]; matd[8] *= dobj_dfdg;
425 
426  /* Blocks for the Hessian construction */
427  loc1 = dobj_dgdg*dg[0] + matd[0];
428  J_A[0] = dobj_df + dg[0]*(matd[0] + loc1);
429  J_A[1] = dg[0]*matd[1] + loc1*dg[1];
430  J_A[2] = dg[0]*matd[2] + loc1*dg[2];
431  J_B[0] = dg[0]*matd[3] + loc1*dg[3];
432  J_B[1] = dg[0]*matd[4] + loc1*dg[4] + adjm[8];
433  J_B[2] = dg[0]*matd[5] + loc1*dg[5] - adjm[7];
434  J_C[0] = dg[0]*matd[6] + loc1*dg[6];
435  J_C[1] = dg[0]*matd[7] + loc1*dg[7] - adjm[5];
436  J_C[2] = dg[0]*matd[8] + loc1*dg[8] + adjm[4];
437 
438  loc1 = dobj_dgdg*dg[1] + matd[1];
439  J_A[3] = dobj_df + dg[1]*(matd[1] + loc1);
440  J_A[4] = dg[1]*matd[2] + loc1*dg[2];
441  J_B[3] = dg[1]*matd[3] + loc1*dg[3] - adjm[8];
442  J_B[4] = dg[1]*matd[4] + loc1*dg[4];
443  J_B[5] = dg[1]*matd[5] + loc1*dg[5] + adjm[6];
444  J_C[3] = dg[1]*matd[6] + loc1*dg[6] + adjm[5];
445  J_C[4] = dg[1]*matd[7] + loc1*dg[7];
446  J_C[5] = dg[1]*matd[8] + loc1*dg[8] - adjm[3];
447 
448  loc1 = dobj_dgdg*dg[2] + matd[2];
449  J_A[5] = dobj_df + dg[2]*(matd[2] + loc1);
450  J_B[6] = dg[2]*matd[3] + loc1*dg[3] + adjm[7];
451  J_B[7] = dg[2]*matd[4] + loc1*dg[4] - adjm[6];
452  J_B[8] = dg[2]*matd[5] + loc1*dg[5];
453  J_C[6] = dg[2]*matd[6] + loc1*dg[6] - adjm[4];
454  J_C[7] = dg[2]*matd[7] + loc1*dg[7] + adjm[3];
455  J_C[8] = dg[2]*matd[8] + loc1*dg[8];
456 
457  loc1 = dobj_dgdg*dg[3] + matd[3];
458  J_D[0] = dobj_df + dg[3]*(matd[3] + loc1);
459  J_D[1] = dg[3]*matd[4] + loc1*dg[4];
460  J_D[2] = dg[3]*matd[5] + loc1*dg[5];
461  J_E[0] = dg[3]*matd[6] + loc1*dg[6];
462  J_E[1] = dg[3]*matd[7] + loc1*dg[7] + adjm[2];
463  J_E[2] = dg[3]*matd[8] + loc1*dg[8] - adjm[1];
464 
465  loc1 = dobj_dgdg*dg[4] + matd[4];
466  J_D[3] = dobj_df + dg[4]*(matd[4] + loc1);
467  J_D[4] = dg[4]*matd[5] + loc1*dg[5];
468  J_E[3] = dg[4]*matd[6] + loc1*dg[6] - adjm[2];
469  J_E[4] = dg[4]*matd[7] + loc1*dg[7];
470  J_E[5] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
471 
472  loc1 = dobj_dgdg*dg[5] + matd[5];
473  J_D[5] = dobj_df + dg[5]*(matd[5] + loc1);
474  J_E[6] = dg[5]*matd[6] + loc1*dg[6] + adjm[1];
475  J_E[7] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
476  J_E[8] = dg[5]*matd[8] + loc1*dg[8];
477 
478  loc1 = dobj_dgdg*dg[6] + matd[6];
479  J_F[0] = dobj_df + dg[6]*(matd[6] + loc1);
480  J_F[1] = dg[6]*matd[7] + loc1*dg[7];
481  J_F[2] = dg[6]*matd[8] + loc1*dg[8];
482 
483  loc1 = dobj_dgdg*dg[7] + matd[7];
484  J_F[3] = dobj_df + dg[7]*(matd[7] + loc1);
485  J_F[4] = dg[7]*matd[8] + loc1*dg[8];
486 
487  J_F[5] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
488 
489  /* Assemble matrix products */
490 
491  /* dx / dx */
492  A[1] = J_A[0]*invR[0][0] + J_A[1]*invR[0][1] + J_A[2]*invR[0][2];
493  A[2] = J_A[1]*invR[1][1] + J_A[2]*invR[1][2];
494  A[0] = -A[1] - A[2];
495 
496  A[4] = J_A[1]*invR[0][0] + J_A[3]*invR[0][1] + J_A[4]*invR[0][2];
497  A[5] = J_A[3]*invR[1][1] + J_A[4]*invR[1][2];
498  A[3] = -A[4] - A[5];
499 
500  A[7] = J_A[2]*invR[0][0] + J_A[4]*invR[0][1] + J_A[5]*invR[0][2];
501  A[8] = J_A[4]*invR[1][1] + J_A[5]*invR[1][2];
502  A[6] = -A[7] - A[8];
503 
504  h_obj[1][0][0] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
505  h_obj[2][0][0] = A[3]*invR[1][1] + A[6]*invR[1][2];
506  h_obj[0][0][0] = -h_obj[1][0][0] - h_obj[2][0][0];
507 
508  h_obj[3][0][0] = A[1]*invR[0][0] + A[4]*invR[0][1] + A[7]*invR[0][2];
509  h_obj[4][0][0] = A[4]*invR[1][1] + A[7]*invR[1][2];
510 
511  h_obj[5][0][0] = A[5]*invR[1][1] + A[8]*invR[1][2];
512 
513  /* dx / dy */
514  A[1] = J_B[0]*invR[0][0] + J_B[1]*invR[0][1] + J_B[2]*invR[0][2];
515  A[2] = J_B[1]*invR[1][1] + J_B[2]*invR[1][2];
516  A[0] = -A[1] - A[2];
517 
518  A[4] = J_B[3]*invR[0][0] + J_B[4]*invR[0][1] + J_B[5]*invR[0][2];
519  A[5] = J_B[4]*invR[1][1] + J_B[5]*invR[1][2];
520  A[3] = -A[4] - A[5];
521 
522  A[7] = J_B[6]*invR[0][0] + J_B[7]*invR[0][1] + J_B[8]*invR[0][2];
523  A[8] = J_B[7]*invR[1][1] + J_B[8]*invR[1][2];
524  A[6] = -A[7] - A[8];
525 
526  h_obj[1][1][0] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
527  h_obj[3][0][1] = A[1]*invR[0][0] + A[4]*invR[0][1] + A[7]*invR[0][2];
528  h_obj[4][0][1] = A[2]*invR[0][0] + A[5]*invR[0][1] + A[8]*invR[0][2];
529 
530  h_obj[2][1][0] = A[3]*invR[1][1] + A[6]*invR[1][2];
531  h_obj[4][1][0] = A[4]*invR[1][1] + A[7]*invR[1][2];
532  h_obj[5][0][1] = A[5]*invR[1][1] + A[8]*invR[1][2];
533 
534  h_obj[0][0][1] = -h_obj[1][1][0] - h_obj[2][1][0];
535  h_obj[1][0][1] = -h_obj[3][0][1] - h_obj[4][1][0];
536  h_obj[2][0][1] = -h_obj[4][0][1] - h_obj[5][0][1];
537 
538  /* dx / dz */
539  A[1] = J_C[0]*invR[0][0] + J_C[1]*invR[0][1] + J_C[2]*invR[0][2];
540  A[2] = J_C[1]*invR[1][1] + J_C[2]*invR[1][2];
541  A[0] = -A[1] - A[2];
542 
543  A[4] = J_C[3]*invR[0][0] + J_C[4]*invR[0][1] + J_C[5]*invR[0][2];
544  A[5] = J_C[4]*invR[1][1] + J_C[5]*invR[1][2];
545  A[3] = -A[4] - A[5];
546 
547  A[7] = J_C[6]*invR[0][0] + J_C[7]*invR[0][1] + J_C[8]*invR[0][2];
548  A[8] = J_C[7]*invR[1][1] + J_C[8]*invR[1][2];
549  A[6] = -A[7] - A[8];
550 
551  h_obj[1][2][0] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
552  h_obj[3][0][2] = A[1]*invR[0][0] + A[4]*invR[0][1] + A[7]*invR[0][2];
553  h_obj[4][0][2] = A[2]*invR[0][0] + A[5]*invR[0][1] + A[8]*invR[0][2];
554 
555  h_obj[2][2][0] = A[3]*invR[1][1] + A[6]*invR[1][2];
556  h_obj[4][2][0] = A[4]*invR[1][1] + A[7]*invR[1][2];
557  h_obj[5][0][2] = A[5]*invR[1][1] + A[8]*invR[1][2];
558 
559  h_obj[0][0][2] = -h_obj[1][2][0] - h_obj[2][2][0];
560  h_obj[1][0][2] = -h_obj[3][0][2] - h_obj[4][2][0];
561  h_obj[2][0][2] = -h_obj[4][0][2] - h_obj[5][0][2];
562 
563  /* dy / dy */
564  A[1] = J_D[0]*invR[0][0] + J_D[1]*invR[0][1] + J_D[2]*invR[0][2];
565  A[2] = J_D[1]*invR[1][1] + J_D[2]*invR[1][2];
566  A[0] = -A[1] - A[2];
567 
568  A[4] = J_D[1]*invR[0][0] + J_D[3]*invR[0][1] + J_D[4]*invR[0][2];
569  A[5] = J_D[3]*invR[1][1] + J_D[4]*invR[1][2];
570  A[3] = -A[4] - A[5];
571 
572  A[7] = J_D[2]*invR[0][0] + J_D[4]*invR[0][1] + J_D[5]*invR[0][2];
573  A[8] = J_D[4]*invR[1][1] + J_D[5]*invR[1][2];
574  A[6] = -A[7] - A[8];
575 
576  h_obj[1][1][1] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
577  h_obj[2][1][1] = A[3]*invR[1][1] + A[6]*invR[1][2];
578  h_obj[0][1][1] = -h_obj[1][1][1] - h_obj[2][1][1];
579 
580  h_obj[3][1][1] = A[1]*invR[0][0] + A[4]*invR[0][1] + A[7]*invR[0][2];
581  h_obj[4][1][1] = A[4]*invR[1][1] + A[7]*invR[1][2];
582 
583  h_obj[5][1][1] = A[5]*invR[1][1] + A[8]*invR[1][2];
584 
585  /* dy / dz */
586  A[1] = J_E[0]*invR[0][0] + J_E[1]*invR[0][1] + J_E[2]*invR[0][2];
587  A[2] = J_E[1]*invR[1][1] + J_E[2]*invR[1][2];
588  A[0] = -A[1] - A[2];
589 
590  A[4] = J_E[3]*invR[0][0] + J_E[4]*invR[0][1] + J_E[5]*invR[0][2];
591  A[5] = J_E[4]*invR[1][1] + J_E[5]*invR[1][2];
592  A[3] = -A[4] - A[5];
593 
594  A[7] = J_E[6]*invR[0][0] + J_E[7]*invR[0][1] + J_E[8]*invR[0][2];
595  A[8] = J_E[7]*invR[1][1] + J_E[8]*invR[1][2];
596  A[6] = -A[7] - A[8];
597 
598  h_obj[1][2][1] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
599  h_obj[3][1][2] = A[1]*invR[0][0] + A[4]*invR[0][1] + A[7]*invR[0][2];
600  h_obj[4][1][2] = A[2]*invR[0][0] + A[5]*invR[0][1] + A[8]*invR[0][2];
601 
602  h_obj[2][2][1] = A[3]*invR[1][1] + A[6]*invR[1][2];
603  h_obj[4][2][1] = A[4]*invR[1][1] + A[7]*invR[1][2];
604  h_obj[5][1][2] = A[5]*invR[1][1] + A[8]*invR[1][2];
605 
606  h_obj[0][1][2] = -h_obj[1][2][1] - h_obj[2][2][1];
607  h_obj[1][1][2] = -h_obj[3][1][2] - h_obj[4][2][1];
608  h_obj[2][1][2] = -h_obj[4][1][2] - h_obj[5][1][2];
609 
610  /* dz / dz */
611  A[1] = J_F[0]*invR[0][0] + J_F[1]*invR[0][1] + J_F[2]*invR[0][2];
612  A[2] = J_F[1]*invR[1][1] + J_F[2]*invR[1][2];
613  A[0] = -A[1] - A[2];
614 
615  A[4] = J_F[1]*invR[0][0] + J_F[3]*invR[0][1] + J_F[4]*invR[0][2];
616  A[5] = J_F[3]*invR[1][1] + J_F[4]*invR[1][2];
617  A[3] = -A[4] - A[5];
618 
619  A[7] = J_F[2]*invR[0][0] + J_F[4]*invR[0][1] + J_F[5]*invR[0][2];
620  A[8] = J_F[4]*invR[1][1] + J_F[5]*invR[1][2];
621  A[6] = -A[7] - A[8];
622 
623  h_obj[1][2][2] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
624  h_obj[2][2][2] = A[3]*invR[1][1] + A[6]*invR[1][2];
625  h_obj[0][2][2] = -h_obj[1][2][2] - h_obj[2][2][2];
626 
627  h_obj[3][2][2] = A[1]*invR[0][0] + A[4]*invR[0][1] + A[7]*invR[0][2];
628  h_obj[4][2][2] = A[4]*invR[1][1] + A[7]*invR[1][2];
629 
630  h_obj[5][2][2] = A[5]*invR[1][1] + A[8]*invR[1][2];
631 
632  /* Complete diagonal blocks */
633  h_obj[0].fill_lower_triangle();
634  h_obj[3].fill_lower_triangle();
635  h_obj[5].fill_lower_triangle();
636  return true;
637  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_2_v0 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 1497 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

1505  {
1506  double matr[9], f, t1, t2;
1507  double matd[9], g, t3, loc1;
1508  double adjm[9], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
1509  double J_A[6], J_B[10], J_C[10], J_D[6], J_E[10], J_F[6];
1510  double A[9];
1511 
1512  /* Calculate M = A*inv(R). */
1513  f = x[1][0] - x[0][0];
1514  g = x[2][0] - x[0][0];
1515  matr[0] = f*invR[0][0];
1516  matr[1] = f*invR[0][1] + g*invR[1][1];
1517  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
1518 
1519  f = x[1][1] - x[0][1];
1520  g = x[2][1] - x[0][1];
1521  matr[3] = f*invR[0][0];
1522  matr[4] = f*invR[0][1] + g*invR[1][1];
1523  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
1524 
1525  f = x[1][2] - x[0][2];
1526  g = x[2][2] - x[0][2];
1527  matr[6] = f*invR[0][0];
1528  matr[7] = f*invR[0][1] + g*invR[1][1];
1529  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
1530 
1531  /* Calculate det(M). */
1532  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
1533  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
1534  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
1535  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
1536  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
1537  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
1538  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
1539  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
1540  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
1541 
1542  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
1543 
1544  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
1545 
1546  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
1547  t2 = t1*t1 + 4.0*delta*delta;
1548  t3 = sqrt(t2);
1549  g = t1 + t3;
1550 
1551  /* Calculate N = M - beta*Q. */
1552  matd[0] = matr[0] - beta*Q[0][0];
1553  matd[1] = matr[1] - beta*Q[0][1];
1554  matd[2] = matr[2] - beta*Q[0][2];
1555  matd[3] = matr[3] - beta*Q[1][0];
1556  matd[4] = matr[4] - beta*Q[1][1];
1557  matd[5] = matr[5] - beta*Q[1][2];
1558  matd[6] = matr[6] - beta*Q[2][0];
1559  matd[7] = matr[7] - beta*Q[2][1];
1560  matd[8] = matr[8] - beta*Q[2][2];
1561 
1562  /* Calculate norm(N) */
1563  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
1564  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
1565  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
1566 
1567  /* Calculate objective function. */
1568  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
1569  obj = f * loc1;
1570 
1571  /* Calculate the derivative of the objective function. */
1572  t3 = 1.0 / t3;
1573  dobj_df = 2.0 * loc1;
1574  dobj_dg = -gamma * obj * t3;
1575  dobj_dfdg = -gamma * dobj_df * t3;
1576  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
1577 
1578  /* Calculate adjoint matrix */
1579  adjm[0] = dobj_df*matd[0] + dobj_dg*dg[0];
1580  adjm[1] = dobj_df*matd[1] + dobj_dg*dg[1];
1581  adjm[2] = dobj_df*matd[2] + dobj_dg*dg[2];
1582  adjm[3] = dobj_df*matd[3] + dobj_dg*dg[3];
1583  adjm[4] = dobj_df*matd[4] + dobj_dg*dg[4];
1584  adjm[5] = dobj_df*matd[5] + dobj_dg*dg[5];
1585  adjm[6] = dobj_df*matd[6] + dobj_dg*dg[6];
1586  adjm[7] = dobj_df*matd[7] + dobj_dg*dg[7];
1587  adjm[8] = dobj_df*matd[8] + dobj_dg*dg[8];
1588 
1589  /* Construct gradients */
1590  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
1591  g_obj[0] += invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
1592  g_obj[0] = -g_obj[0];
1593 
1594  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
1595  g_obj[1] += invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
1596  g_obj[1] = -g_obj[1];
1597 
1598  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
1599  g_obj[2] += invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
1600  g_obj[2] = -g_obj[2];
1601 
1602  /* Start of the Hessian evaluation */
1603  adjm[0] = dobj_dg*matr[0]; matd[0] *= dobj_dfdg;
1604  adjm[1] = dobj_dg*matr[1]; matd[1] *= dobj_dfdg;
1605  adjm[2] = dobj_dg*matr[2]; matd[2] *= dobj_dfdg;
1606  adjm[3] = dobj_dg*matr[3]; matd[3] *= dobj_dfdg;
1607  adjm[4] = dobj_dg*matr[4]; matd[4] *= dobj_dfdg;
1608  adjm[5] = dobj_dg*matr[5]; matd[5] *= dobj_dfdg;
1609  adjm[6] = dobj_dg*matr[6]; matd[6] *= dobj_dfdg;
1610  adjm[7] = dobj_dg*matr[7]; matd[7] *= dobj_dfdg;
1611  adjm[8] = dobj_dg*matr[8]; matd[8] *= dobj_dfdg;
1612 
1613  /* Blocks for the Hessian construction */
1614  loc1 = dobj_dgdg*dg[0] + matd[0];
1615  J_A[0] = dobj_df + dg[0]*(matd[0] + loc1);
1616  J_A[1] = dg[0]*matd[1] + loc1*dg[1];
1617  J_A[2] = dg[0]*matd[2] + loc1*dg[2];
1618  J_B[0] = dg[0]*matd[3] + loc1*dg[3];
1619  J_B[1] = dg[0]*matd[4] + loc1*dg[4] + adjm[8];
1620  J_B[2] = dg[0]*matd[5] + loc1*dg[5] - adjm[7];
1621  J_C[0] = dg[0]*matd[6] + loc1*dg[6];
1622  J_C[1] = dg[0]*matd[7] + loc1*dg[7] - adjm[5];
1623  J_C[2] = dg[0]*matd[8] + loc1*dg[8] + adjm[4];
1624 
1625  loc1 = dobj_dgdg*dg[1] + matd[1];
1626  J_A[3] = dobj_df + dg[1]*(matd[1] + loc1);
1627  J_A[4] = dg[1]*matd[2] + loc1*dg[2];
1628  J_B[3] = dg[1]*matd[3] + loc1*dg[3] - adjm[8];
1629  J_B[4] = dg[1]*matd[4] + loc1*dg[4];
1630  J_B[5] = dg[1]*matd[5] + loc1*dg[5] + adjm[6];
1631  J_C[3] = dg[1]*matd[6] + loc1*dg[6] + adjm[5];
1632  J_C[4] = dg[1]*matd[7] + loc1*dg[7];
1633  J_C[5] = dg[1]*matd[8] + loc1*dg[8] - adjm[3];
1634 
1635  loc1 = dobj_dgdg*dg[2] + matd[2];
1636  J_A[5] = dobj_df + dg[2]*(matd[2] + loc1);
1637  J_B[6] = dg[2]*matd[3] + loc1*dg[3] + adjm[7];
1638  J_B[7] = dg[2]*matd[4] + loc1*dg[4] - adjm[6];
1639  J_B[8] = dg[2]*matd[5] + loc1*dg[5];
1640  J_C[6] = dg[2]*matd[6] + loc1*dg[6] - adjm[4];
1641  J_C[7] = dg[2]*matd[7] + loc1*dg[7] + adjm[3];
1642  J_C[8] = dg[2]*matd[8] + loc1*dg[8];
1643 
1644  loc1 = dobj_dgdg*dg[3] + matd[3];
1645  J_D[0] = dobj_df + dg[3]*(matd[3] + loc1);
1646  J_D[1] = dg[3]*matd[4] + loc1*dg[4];
1647  J_D[2] = dg[3]*matd[5] + loc1*dg[5];
1648  J_E[0] = dg[3]*matd[6] + loc1*dg[6];
1649  J_E[1] = dg[3]*matd[7] + loc1*dg[7] + adjm[2];
1650  J_E[2] = dg[3]*matd[8] + loc1*dg[8] - adjm[1];
1651 
1652  loc1 = dobj_dgdg*dg[4] + matd[4];
1653  J_D[3] = dobj_df + dg[4]*(matd[4] + loc1);
1654  J_D[4] = dg[4]*matd[5] + loc1*dg[5];
1655  J_E[3] = dg[4]*matd[6] + loc1*dg[6] - adjm[2];
1656  J_E[4] = dg[4]*matd[7] + loc1*dg[7];
1657  J_E[5] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
1658 
1659  loc1 = dobj_dgdg*dg[5] + matd[5];
1660  J_D[5] = dobj_df + dg[5]*(matd[5] + loc1);
1661  J_E[6] = dg[5]*matd[6] + loc1*dg[6] + adjm[1];
1662  J_E[7] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
1663  J_E[8] = dg[5]*matd[8] + loc1*dg[8];
1664 
1665  loc1 = dobj_dgdg*dg[6] + matd[6];
1666  J_F[0] = dobj_df + dg[6]*(matd[6] + loc1);
1667  J_F[1] = dg[6]*matd[7] + loc1*dg[7];
1668  J_F[2] = dg[6]*matd[8] + loc1*dg[8];
1669 
1670  loc1 = dobj_dgdg*dg[7] + matd[7];
1671  J_F[3] = dobj_df + dg[7]*(matd[7] + loc1);
1672  J_F[4] = dg[7]*matd[8] + loc1*dg[8];
1673 
1674  J_F[5] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
1675 
1676  /* Assemble matrix products */
1677 
1678  /* dx / dx */
1679  A[1] = J_A[0]*invR[0][0] + J_A[1]*invR[0][1] + J_A[2]*invR[0][2];
1680  A[2] = J_A[1]*invR[1][1] + J_A[2]*invR[1][2];
1681  A[0] = -A[1] - A[2];
1682 
1683  A[4] = J_A[1]*invR[0][0] + J_A[3]*invR[0][1] + J_A[4]*invR[0][2];
1684  A[5] = J_A[3]*invR[1][1] + J_A[4]*invR[1][2];
1685  A[3] = -A[4] - A[5];
1686 
1687  A[7] = J_A[2]*invR[0][0] + J_A[4]*invR[0][1] + J_A[5]*invR[0][2];
1688  A[8] = J_A[4]*invR[1][1] + J_A[5]*invR[1][2];
1689  A[6] = -A[7] - A[8];
1690 
1691  h_obj[0][0] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
1692  h_obj[0][0] += A[3]*invR[1][1] + A[6]*invR[1][2];
1693  h_obj[0][0] = -h_obj[0][0];
1694 
1695  /* dx / dy */
1696  A[1] = J_B[0]*invR[0][0] + J_B[1]*invR[0][1] + J_B[2]*invR[0][2];
1697  A[2] = J_B[1]*invR[1][1] + J_B[2]*invR[1][2];
1698  A[0] = -A[1] - A[2];
1699 
1700  A[4] = J_B[3]*invR[0][0] + J_B[4]*invR[0][1] + J_B[5]*invR[0][2];
1701  A[5] = J_B[4]*invR[1][1] + J_B[5]*invR[1][2];
1702  A[3] = -A[4] - A[5];
1703 
1704  A[7] = J_B[6]*invR[0][0] + J_B[7]*invR[0][1] + J_B[8]*invR[0][2];
1705  A[8] = J_B[7]*invR[1][1] + J_B[8]*invR[1][2];
1706  A[6] = -A[7] - A[8];
1707 
1708  h_obj[0][1] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
1709  h_obj[0][1] += A[3]*invR[1][1] + A[6]*invR[1][2];
1710  h_obj[0][1] = -h_obj[0][1];
1711 
1712  /* dx / dz */
1713  A[1] = J_C[0]*invR[0][0] + J_C[1]*invR[0][1] + J_C[2]*invR[0][2];
1714  A[2] = J_C[1]*invR[1][1] + J_C[2]*invR[1][2];
1715  A[0] = -A[1] - A[2];
1716 
1717  A[4] = J_C[3]*invR[0][0] + J_C[4]*invR[0][1] + J_C[5]*invR[0][2];
1718  A[5] = J_C[4]*invR[1][1] + J_C[5]*invR[1][2];
1719  A[3] = -A[4] - A[5];
1720 
1721  A[7] = J_C[6]*invR[0][0] + J_C[7]*invR[0][1] + J_C[8]*invR[0][2];
1722  A[8] = J_C[7]*invR[1][1] + J_C[8]*invR[1][2];
1723  A[6] = -A[7] - A[8];
1724 
1725  h_obj[0][2] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
1726  h_obj[0][2] += A[3]*invR[1][1] + A[6]*invR[1][2];
1727  h_obj[0][2] = -h_obj[0][2];
1728 
1729  /* dy / dy */
1730  A[1] = J_D[0]*invR[0][0] + J_D[1]*invR[0][1] + J_D[2]*invR[0][2];
1731  A[2] = J_D[1]*invR[1][1] + J_D[2]*invR[1][2];
1732  A[0] = -A[1] - A[2];
1733 
1734  A[4] = J_D[1]*invR[0][0] + J_D[3]*invR[0][1] + J_D[4]*invR[0][2];
1735  A[5] = J_D[3]*invR[1][1] + J_D[4]*invR[1][2];
1736  A[3] = -A[4] - A[5];
1737 
1738  A[7] = J_D[2]*invR[0][0] + J_D[4]*invR[0][1] + J_D[5]*invR[0][2];
1739  A[8] = J_D[4]*invR[1][1] + J_D[5]*invR[1][2];
1740  A[6] = -A[7] - A[8];
1741 
1742  h_obj[1][1] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
1743  h_obj[1][1] += A[3]*invR[1][1] + A[6]*invR[1][2];
1744  h_obj[1][1] = -h_obj[1][1];
1745 
1746  /* dy / dz */
1747  A[1] = J_E[0]*invR[0][0] + J_E[1]*invR[0][1] + J_E[2]*invR[0][2];
1748  A[2] = J_E[1]*invR[1][1] + J_E[2]*invR[1][2];
1749  A[0] = -A[1] - A[2];
1750 
1751  A[4] = J_E[3]*invR[0][0] + J_E[4]*invR[0][1] + J_E[5]*invR[0][2];
1752  A[5] = J_E[4]*invR[1][1] + J_E[5]*invR[1][2];
1753  A[3] = -A[4] - A[5];
1754 
1755  A[7] = J_E[6]*invR[0][0] + J_E[7]*invR[0][1] + J_E[8]*invR[0][2];
1756  A[8] = J_E[7]*invR[1][1] + J_E[8]*invR[1][2];
1757  A[6] = -A[7] - A[8];
1758 
1759  h_obj[1][2] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
1760  h_obj[1][2] += A[3]*invR[1][1] + A[6]*invR[1][2];
1761  h_obj[1][2] = -h_obj[1][2];
1762 
1763  /* dz / dz */
1764  A[1] = J_F[0]*invR[0][0] + J_F[1]*invR[0][1] + J_F[2]*invR[0][2];
1765  A[2] = J_F[1]*invR[1][1] + J_F[2]*invR[1][2];
1766  A[0] = -A[1] - A[2];
1767 
1768  A[4] = J_F[1]*invR[0][0] + J_F[3]*invR[0][1] + J_F[4]*invR[0][2];
1769  A[5] = J_F[3]*invR[1][1] + J_F[4]*invR[1][2];
1770  A[3] = -A[4] - A[5];
1771 
1772  A[7] = J_F[2]*invR[0][0] + J_F[4]*invR[0][1] + J_F[5]*invR[0][2];
1773  A[8] = J_F[4]*invR[1][1] + J_F[5]*invR[1][2];
1774  A[6] = -A[7] - A[8];
1775 
1776  h_obj[2][2] = A[0]*invR[0][0] + A[3]*invR[0][1] + A[6]*invR[0][2];
1777  h_obj[2][2] += A[3]*invR[1][1] + A[6]*invR[1][2];
1778  h_obj[2][2] = -h_obj[2][2];
1779 
1780  /* Complete diagonal blocks */
1781  h_obj.fill_lower_triangle();
1782  return true;
1783  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_2_v1 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 1785 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

1793  {
1794  double matr[9], f, t1, t2;
1795  double matd[9], g, t3, loc1;
1796  double adjm[9], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
1797  double J_A[6], J_B[10], J_C[10], J_D[6], J_E[10], J_F[6];
1798  double A[3];
1799 
1800  /* Calculate M = A*inv(R). */
1801  f = x[1][0] - x[0][0];
1802  g = x[2][0] - x[0][0];
1803  matr[0] = f*invR[0][0];
1804  matr[1] = f*invR[0][1] + g*invR[1][1];
1805  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
1806 
1807  f = x[1][1] - x[0][1];
1808  g = x[2][1] - x[0][1];
1809  matr[3] = f*invR[0][0];
1810  matr[4] = f*invR[0][1] + g*invR[1][1];
1811  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
1812 
1813  f = x[1][2] - x[0][2];
1814  g = x[2][2] - x[0][2];
1815  matr[6] = f*invR[0][0];
1816  matr[7] = f*invR[0][1] + g*invR[1][1];
1817  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
1818 
1819  /* Calculate det(M). */
1820  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
1821  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
1822  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
1823  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
1824  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
1825  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
1826  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
1827  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
1828  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
1829 
1830  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
1831 
1832  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
1833 
1834  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
1835  t2 = t1*t1 + 4.0*delta*delta;
1836  t3 = sqrt(t2);
1837  g = t1 + t3;
1838 
1839  /* Calculate N = M - beta*Q. */
1840  matd[0] = matr[0] - beta*Q[0][0];
1841  matd[1] = matr[1] - beta*Q[0][1];
1842  matd[2] = matr[2] - beta*Q[0][2];
1843  matd[3] = matr[3] - beta*Q[1][0];
1844  matd[4] = matr[4] - beta*Q[1][1];
1845  matd[5] = matr[5] - beta*Q[1][2];
1846  matd[6] = matr[6] - beta*Q[2][0];
1847  matd[7] = matr[7] - beta*Q[2][1];
1848  matd[8] = matr[8] - beta*Q[2][2];
1849 
1850  /* Calculate norm(N) */
1851  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
1852  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
1853  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
1854 
1855  /* Calculate objective function. */
1856  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
1857  obj = f * loc1;
1858 
1859  /* Calculate the derivative of the objective function. */
1860  t3 = 1.0 / t3;
1861  dobj_df = 2.0 * loc1;
1862  dobj_dg = -gamma * obj * t3;
1863  dobj_dfdg = -gamma * dobj_df * t3;
1864  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
1865 
1866  /* Calculate adjoint matrix */
1867  adjm[0] = dobj_df*matd[0] + dobj_dg*dg[0];
1868  adjm[1] = dobj_df*matd[1] + dobj_dg*dg[1];
1869  adjm[2] = dobj_df*matd[2] + dobj_dg*dg[2];
1870  adjm[3] = dobj_df*matd[3] + dobj_dg*dg[3];
1871  adjm[4] = dobj_df*matd[4] + dobj_dg*dg[4];
1872  adjm[5] = dobj_df*matd[5] + dobj_dg*dg[5];
1873  adjm[6] = dobj_df*matd[6] + dobj_dg*dg[6];
1874  adjm[7] = dobj_df*matd[7] + dobj_dg*dg[7];
1875  adjm[8] = dobj_df*matd[8] + dobj_dg*dg[8];
1876 
1877  /* Construct gradients */
1878  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
1879  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
1880  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
1881 
1882  /* Start of the Hessian evaluation */
1883  adjm[0] = dobj_dg*matr[0]; matd[0] *= dobj_dfdg;
1884  adjm[1] = dobj_dg*matr[1]; matd[1] *= dobj_dfdg;
1885  adjm[2] = dobj_dg*matr[2]; matd[2] *= dobj_dfdg;
1886  adjm[3] = dobj_dg*matr[3]; matd[3] *= dobj_dfdg;
1887  adjm[4] = dobj_dg*matr[4]; matd[4] *= dobj_dfdg;
1888  adjm[5] = dobj_dg*matr[5]; matd[5] *= dobj_dfdg;
1889  adjm[6] = dobj_dg*matr[6]; matd[6] *= dobj_dfdg;
1890  adjm[7] = dobj_dg*matr[7]; matd[7] *= dobj_dfdg;
1891  adjm[8] = dobj_dg*matr[8]; matd[8] *= dobj_dfdg;
1892 
1893  /* Blocks for the Hessian construction */
1894  loc1 = dobj_dgdg*dg[0] + matd[0];
1895  J_A[0] = dobj_df + dg[0]*(matd[0] + loc1);
1896  J_A[1] = dg[0]*matd[1] + loc1*dg[1];
1897  J_A[2] = dg[0]*matd[2] + loc1*dg[2];
1898  J_B[0] = dg[0]*matd[3] + loc1*dg[3];
1899  J_B[1] = dg[0]*matd[4] + loc1*dg[4] + adjm[8];
1900  J_B[2] = dg[0]*matd[5] + loc1*dg[5] - adjm[7];
1901  J_C[0] = dg[0]*matd[6] + loc1*dg[6];
1902  J_C[1] = dg[0]*matd[7] + loc1*dg[7] - adjm[5];
1903  J_C[2] = dg[0]*matd[8] + loc1*dg[8] + adjm[4];
1904 
1905  loc1 = dobj_dgdg*dg[1] + matd[1];
1906  J_A[3] = dobj_df + dg[1]*(matd[1] + loc1);
1907  J_A[4] = dg[1]*matd[2] + loc1*dg[2];
1908  J_B[3] = dg[1]*matd[3] + loc1*dg[3] - adjm[8];
1909  J_B[4] = dg[1]*matd[4] + loc1*dg[4];
1910  J_B[5] = dg[1]*matd[5] + loc1*dg[5] + adjm[6];
1911  J_C[3] = dg[1]*matd[6] + loc1*dg[6] + adjm[5];
1912  J_C[4] = dg[1]*matd[7] + loc1*dg[7];
1913  J_C[5] = dg[1]*matd[8] + loc1*dg[8] - adjm[3];
1914 
1915  loc1 = dobj_dgdg*dg[2] + matd[2];
1916  J_A[5] = dobj_df + dg[2]*(matd[2] + loc1);
1917  J_B[6] = dg[2]*matd[3] + loc1*dg[3] + adjm[7];
1918  J_B[7] = dg[2]*matd[4] + loc1*dg[4] - adjm[6];
1919  J_B[8] = dg[2]*matd[5] + loc1*dg[5];
1920  J_C[6] = dg[2]*matd[6] + loc1*dg[6] - adjm[4];
1921  J_C[7] = dg[2]*matd[7] + loc1*dg[7] + adjm[3];
1922  J_C[8] = dg[2]*matd[8] + loc1*dg[8];
1923 
1924  loc1 = dobj_dgdg*dg[3] + matd[3];
1925  J_D[0] = dobj_df + dg[3]*(matd[3] + loc1);
1926  J_D[1] = dg[3]*matd[4] + loc1*dg[4];
1927  J_D[2] = dg[3]*matd[5] + loc1*dg[5];
1928  J_E[0] = dg[3]*matd[6] + loc1*dg[6];
1929  J_E[1] = dg[3]*matd[7] + loc1*dg[7] + adjm[2];
1930  J_E[2] = dg[3]*matd[8] + loc1*dg[8] - adjm[1];
1931 
1932  loc1 = dobj_dgdg*dg[4] + matd[4];
1933  J_D[3] = dobj_df + dg[4]*(matd[4] + loc1);
1934  J_D[4] = dg[4]*matd[5] + loc1*dg[5];
1935  J_E[3] = dg[4]*matd[6] + loc1*dg[6] - adjm[2];
1936  J_E[4] = dg[4]*matd[7] + loc1*dg[7];
1937  J_E[5] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
1938 
1939  loc1 = dobj_dgdg*dg[5] + matd[5];
1940  J_D[5] = dobj_df + dg[5]*(matd[5] + loc1);
1941  J_E[6] = dg[5]*matd[6] + loc1*dg[6] + adjm[1];
1942  J_E[7] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
1943  J_E[8] = dg[5]*matd[8] + loc1*dg[8];
1944 
1945  loc1 = dobj_dgdg*dg[6] + matd[6];
1946  J_F[0] = dobj_df + dg[6]*(matd[6] + loc1);
1947  J_F[1] = dg[6]*matd[7] + loc1*dg[7];
1948  J_F[2] = dg[6]*matd[8] + loc1*dg[8];
1949 
1950  loc1 = dobj_dgdg*dg[7] + matd[7];
1951  J_F[3] = dobj_df + dg[7]*(matd[7] + loc1);
1952  J_F[4] = dg[7]*matd[8] + loc1*dg[8];
1953 
1954  J_F[5] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
1955 
1956  /* Assemble matrix products */
1957 
1958  /* dx / dx */
1959  A[0] = J_A[0]*invR[0][0] + J_A[1]*invR[0][1] + J_A[2]*invR[0][2];
1960  A[1] = J_A[1]*invR[0][0] + J_A[3]*invR[0][1] + J_A[4]*invR[0][2];
1961  A[2] = J_A[2]*invR[0][0] + J_A[4]*invR[0][1] + J_A[5]*invR[0][2];
1962  h_obj[0][0] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
1963 
1964  /* dx / dy */
1965  A[0] = J_B[0]*invR[0][0] + J_B[1]*invR[0][1] + J_B[2]*invR[0][2];
1966  A[1] = J_B[3]*invR[0][0] + J_B[4]*invR[0][1] + J_B[5]*invR[0][2];
1967  A[2] = J_B[6]*invR[0][0] + J_B[7]*invR[0][1] + J_B[8]*invR[0][2];
1968  h_obj[0][1] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
1969 
1970  /* dx / dz */
1971  A[0] = J_C[0]*invR[0][0] + J_C[1]*invR[0][1] + J_C[2]*invR[0][2];
1972  A[1] = J_C[3]*invR[0][0] + J_C[4]*invR[0][1] + J_C[5]*invR[0][2];
1973  A[2] = J_C[6]*invR[0][0] + J_C[7]*invR[0][1] + J_C[8]*invR[0][2];
1974  h_obj[0][2] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
1975 
1976  /* dy / dy */
1977  A[0] = J_D[0]*invR[0][0] + J_D[1]*invR[0][1] + J_D[2]*invR[0][2];
1978  A[1] = J_D[1]*invR[0][0] + J_D[3]*invR[0][1] + J_D[4]*invR[0][2];
1979  A[2] = J_D[2]*invR[0][0] + J_D[4]*invR[0][1] + J_D[5]*invR[0][2];
1980  h_obj[1][1] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
1981 
1982  /* dy / dz */
1983  A[0] = J_E[0]*invR[0][0] + J_E[1]*invR[0][1] + J_E[2]*invR[0][2];
1984  A[1] = J_E[3]*invR[0][0] + J_E[4]*invR[0][1] + J_E[5]*invR[0][2];
1985  A[2] = J_E[6]*invR[0][0] + J_E[7]*invR[0][1] + J_E[8]*invR[0][2];
1986  h_obj[1][2] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
1987 
1988  /* dz / dz */
1989  A[0] = J_F[0]*invR[0][0] + J_F[1]*invR[0][1] + J_F[2]*invR[0][2];
1990  A[1] = J_F[1]*invR[0][0] + J_F[3]*invR[0][1] + J_F[4]*invR[0][2];
1991  A[2] = J_F[2]*invR[0][0] + J_F[4]*invR[0][1] + J_F[5]*invR[0][2];
1992  h_obj[2][2] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
1993 
1994  /* Complete diagonal blocks */
1995  h_obj.fill_lower_triangle();
1996  return true;
1997  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_2_v2 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 1999 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

2007  {
2008  double matr[9], f, t1, t2;
2009  double matd[9], g, t3, loc1;
2010  double adjm[6], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
2011  double J_A[3], J_B[4], J_C[4], J_D[3], J_E[4], J_F[3];
2012  double A[2];
2013 
2014  /* Calculate M = A*inv(R). */
2015  f = x[1][0] - x[0][0];
2016  g = x[2][0] - x[0][0];
2017  matr[0] = f*invR[0][0];
2018  matr[1] = f*invR[0][1] + g*invR[1][1];
2019  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
2020 
2021  f = x[1][1] - x[0][1];
2022  g = x[2][1] - x[0][1];
2023  matr[3] = f*invR[0][0];
2024  matr[4] = f*invR[0][1] + g*invR[1][1];
2025  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
2026 
2027  f = x[1][2] - x[0][2];
2028  g = x[2][2] - x[0][2];
2029  matr[6] = f*invR[0][0];
2030  matr[7] = f*invR[0][1] + g*invR[1][1];
2031  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
2032 
2033  /* Calculate det(M). */
2034  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
2035  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
2036  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
2037  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
2038  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
2039  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
2040  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
2041 
2042  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
2043 
2044  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
2045 
2046  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
2047  t2 = t1*t1 + 4.0*delta*delta;
2048  t3 = sqrt(t2);
2049  g = t1 + t3;
2050 
2051  /* Calculate N = M - beta*Q. */
2052  matd[0] = matr[0] - beta*Q[0][0];
2053  matd[1] = matr[1] - beta*Q[0][1];
2054  matd[2] = matr[2] - beta*Q[0][2];
2055  matd[3] = matr[3] - beta*Q[1][0];
2056  matd[4] = matr[4] - beta*Q[1][1];
2057  matd[5] = matr[5] - beta*Q[1][2];
2058  matd[6] = matr[6] - beta*Q[2][0];
2059  matd[7] = matr[7] - beta*Q[2][1];
2060  matd[8] = matr[8] - beta*Q[2][2];
2061 
2062  /* Calculate norm(N) */
2063  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
2064  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
2065  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
2066 
2067  /* Calculate objective function. */
2068  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
2069  obj = f * loc1;
2070 
2071  /* Calculate the derivative of the objective function. */
2072  t3 = 1.0 / t3;
2073  dobj_df = 2.0 * loc1;
2074  dobj_dg = -gamma * obj * t3;
2075  dobj_dfdg = -gamma * dobj_df * t3;
2076  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
2077 
2078  /* Calculate adjoint matrix */
2079  adjm[0] = dobj_df*matd[1] + dobj_dg*dg[1];
2080  adjm[1] = dobj_df*matd[2] + dobj_dg*dg[2];
2081  adjm[2] = dobj_df*matd[4] + dobj_dg*dg[4];
2082  adjm[3] = dobj_df*matd[5] + dobj_dg*dg[5];
2083  adjm[4] = dobj_df*matd[7] + dobj_dg*dg[7];
2084  adjm[5] = dobj_df*matd[8] + dobj_dg*dg[8];
2085 
2086  /* Construct gradients */
2087  g_obj[0] = invR[1][1]*adjm[0]+invR[1][2]*adjm[1];
2088  g_obj[1] = invR[1][1]*adjm[2]+invR[1][2]*adjm[3];
2089  g_obj[2] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
2090 
2091  /* Start of the Hessian evaluation */
2092  adjm[0] = dobj_dg*matr[0];
2093  adjm[1] = dobj_dg*matr[3];
2094  adjm[2] = dobj_dg*matr[6];
2095 
2096  matd[1] *= dobj_dfdg;
2097  matd[2] *= dobj_dfdg;
2098  matd[4] *= dobj_dfdg;
2099  matd[5] *= dobj_dfdg;
2100  matd[7] *= dobj_dfdg;
2101  matd[8] *= dobj_dfdg;
2102 
2103  /* Blocks for the Hessian construction */
2104  loc1 = dobj_dgdg*dg[1] + matd[1];
2105  J_A[0] = dobj_df + dg[1]*(matd[1] + loc1);
2106  J_A[1] = dg[1]*matd[2] + loc1*dg[2];
2107  J_B[0] = dg[1]*matd[4] + loc1*dg[4];
2108  J_B[1] = dg[1]*matd[5] + loc1*dg[5] + adjm[2];
2109  J_C[0] = dg[1]*matd[7] + loc1*dg[7];
2110  J_C[1] = dg[1]*matd[8] + loc1*dg[8] - adjm[1];
2111 
2112  loc1 = dobj_dgdg*dg[2] + matd[2];
2113  J_A[2] = dobj_df + dg[2]*(matd[2] + loc1);
2114  J_B[2] = dg[2]*matd[4] + loc1*dg[4] - adjm[2];
2115  J_B[3] = dg[2]*matd[5] + loc1*dg[5];
2116  J_C[2] = dg[2]*matd[7] + loc1*dg[7] + adjm[1];
2117  J_C[3] = dg[2]*matd[8] + loc1*dg[8];
2118 
2119  loc1 = dobj_dgdg*dg[4] + matd[4];
2120  J_D[0] = dobj_df + dg[4]*(matd[4] + loc1);
2121  J_D[1] = dg[4]*matd[5] + loc1*dg[5];
2122  J_E[0] = dg[4]*matd[7] + loc1*dg[7];
2123  J_E[1] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
2124 
2125  loc1 = dobj_dgdg*dg[5] + matd[5];
2126  J_D[2] = dobj_df + dg[5]*(matd[5] + loc1);
2127  J_E[2] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
2128  J_E[3] = dg[5]*matd[8] + loc1*dg[8];
2129 
2130  loc1 = dobj_dgdg*dg[7] + matd[7];
2131  J_F[0] = dobj_df + dg[7]*(matd[7] + loc1);
2132  J_F[1] = dg[7]*matd[8] + loc1*dg[8];
2133 
2134  J_F[2] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
2135 
2136  /* Assemble matrix products */
2137 
2138  /* dx / dx */
2139  A[0] = J_A[0]*invR[1][1] + J_A[1]*invR[1][2];
2140  A[1] = J_A[1]*invR[1][1] + J_A[2]*invR[1][2];
2141  h_obj[0][0] = A[0]*invR[1][1] + A[1]*invR[1][2];
2142 
2143  /* dx / dy */
2144  A[0] = J_B[0]*invR[1][1] + J_B[1]*invR[1][2];
2145  A[1] = J_B[2]*invR[1][1] + J_B[3]*invR[1][2];
2146  h_obj[0][1] = A[0]*invR[1][1] + A[1]*invR[1][2];
2147 
2148  /* dx / dz */
2149  A[0] = J_C[0]*invR[1][1] + J_C[1]*invR[1][2];
2150  A[1] = J_C[2]*invR[1][1] + J_C[3]*invR[1][2];
2151  h_obj[0][2] = A[0]*invR[1][1] + A[1]*invR[1][2];
2152 
2153  /* dy / dy */
2154  A[0] = J_D[0]*invR[1][1] + J_D[1]*invR[1][2];
2155  A[1] = J_D[1]*invR[1][1] + J_D[2]*invR[1][2];
2156  h_obj[1][1] = A[0]*invR[1][1] + A[1]*invR[1][2];
2157 
2158  /* dy / dz */
2159  A[0] = J_E[0]*invR[1][1] + J_E[1]*invR[1][2];
2160  A[1] = J_E[2]*invR[1][1] + J_E[3]*invR[1][2];
2161  h_obj[1][2] = A[0]*invR[1][1] + A[1]*invR[1][2];
2162 
2163  /* dz / dz */
2164  A[0] = J_F[0]*invR[1][1] + J_F[1]*invR[1][2];
2165  A[1] = J_F[1]*invR[1][1] + J_F[2]*invR[1][2];
2166  h_obj[2][2] = A[0]*invR[1][1] + A[1]*invR[1][2];
2167 
2168  /* Complete diagonal blocks */
2169  h_obj.fill_lower_triangle();
2170  return true;
2171  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_3 ( double &  obj,
Vector3D  g_obj[4],
Matrix3D  h_obj[10],
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 815 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

823  {
824  double matr[9], f, t1, t2;
825  double matd[9], g, t3, loc1;
826  double adjm[9], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
827  double J_A[6], J_B[10], J_C[10], J_D[6], J_E[10], J_F[6];
828  double A[12];
829 
830  /* Calculate M = A*inv(R). */
831  f = x[1][0] - x[0][0];
832  g = x[2][0] - x[0][0];
833  t1 = x[3][0] - x[0][0];
834  matr[0] = f*invR[0][0];
835  matr[1] = f*invR[0][1] + g*invR[1][1];
836  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
837 
838  f = x[1][1] - x[0][1];
839  g = x[2][1] - x[0][1];
840  t1 = x[3][1] - x[0][1];
841  matr[3] = f*invR[0][0];
842  matr[4] = f*invR[0][1] + g*invR[1][1];
843  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
844 
845  f = x[1][2] - x[0][2];
846  g = x[2][2] - x[0][2];
847  t1 = x[3][2] - x[0][2];
848  matr[6] = f*invR[0][0];
849  matr[7] = f*invR[0][1] + g*invR[1][1];
850  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
851 
852  /* Calculate det(M). */
853  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
854  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
855  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
856  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
857  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
858  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
859  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
860  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
861  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
862 
863  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
864 
865  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
866 
867  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
868  t2 = t1*t1 + 4.0*delta*delta;
869  t3 = sqrt(t2);
870  g = t1 + t3;
871 
872  /* Calculate N = M - beta*Q. */
873  matd[0] = matr[0] - beta*Q[0][0];
874  matd[1] = matr[1] - beta*Q[0][1];
875  matd[2] = matr[2] - beta*Q[0][2];
876  matd[3] = matr[3] - beta*Q[1][0];
877  matd[4] = matr[4] - beta*Q[1][1];
878  matd[5] = matr[5] - beta*Q[1][2];
879  matd[6] = matr[6] - beta*Q[2][0];
880  matd[7] = matr[7] - beta*Q[2][1];
881  matd[8] = matr[8] - beta*Q[2][2];
882 
883  /* Calculate norm(N) */
884  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
885  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
886  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
887 
888  /* Calculate objective function. */
889  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
890  obj = f * loc1;
891 
892  /* Calculate the derivative of the objective function. */
893  t3 = 1.0 / t3;
894  dobj_df = 2.0 * loc1;
895  dobj_dg = -gamma * obj * t3;
896  dobj_dfdg = -gamma * dobj_df * t3;
897  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
898 
899  /* Calculate adjoint matrix */
900  adjm[0] = dobj_df*matd[0] + dobj_dg*dg[0];
901  adjm[1] = dobj_df*matd[1] + dobj_dg*dg[1];
902  adjm[2] = dobj_df*matd[2] + dobj_dg*dg[2];
903  adjm[3] = dobj_df*matd[3] + dobj_dg*dg[3];
904  adjm[4] = dobj_df*matd[4] + dobj_dg*dg[4];
905  adjm[5] = dobj_df*matd[5] + dobj_dg*dg[5];
906  adjm[6] = dobj_df*matd[6] + dobj_dg*dg[6];
907  adjm[7] = dobj_df*matd[7] + dobj_dg*dg[7];
908  adjm[8] = dobj_df*matd[8] + dobj_dg*dg[8];
909 
910  /* Construct gradients */
911  g_obj[1][0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
912  g_obj[2][0] = invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
913  g_obj[3][0] = invR[2][2]*adjm[2];
914  g_obj[0][0] = -g_obj[1][0] - g_obj[2][0] - g_obj[3][0];
915 
916  g_obj[1][1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
917  g_obj[2][1] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
918  g_obj[3][1] = invR[2][2]*adjm[5];
919  g_obj[0][1] = -g_obj[1][1] - g_obj[2][1] - g_obj[3][1];
920 
921  g_obj[1][2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
922  g_obj[2][2] = invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
923  g_obj[3][2] = invR[2][2]*adjm[8];
924  g_obj[0][2] = -g_obj[1][2] - g_obj[2][2] - g_obj[3][2];
925 
926  /* Start of the Hessian evaluation */
927  adjm[0] = dobj_dg*matr[0]; matd[0] *= dobj_dfdg;
928  adjm[1] = dobj_dg*matr[1]; matd[1] *= dobj_dfdg;
929  adjm[2] = dobj_dg*matr[2]; matd[2] *= dobj_dfdg;
930  adjm[3] = dobj_dg*matr[3]; matd[3] *= dobj_dfdg;
931  adjm[4] = dobj_dg*matr[4]; matd[4] *= dobj_dfdg;
932  adjm[5] = dobj_dg*matr[5]; matd[5] *= dobj_dfdg;
933  adjm[6] = dobj_dg*matr[6]; matd[6] *= dobj_dfdg;
934  adjm[7] = dobj_dg*matr[7]; matd[7] *= dobj_dfdg;
935  adjm[8] = dobj_dg*matr[8]; matd[8] *= dobj_dfdg;
936 
937  /* Blocks for the Hessian construction */
938  loc1 = dobj_dgdg*dg[0] + matd[0];
939  J_A[0] = dobj_df + dg[0]*(matd[0] + loc1);
940  J_A[1] = dg[0]*matd[1] + loc1*dg[1];
941  J_A[2] = dg[0]*matd[2] + loc1*dg[2];
942  J_B[0] = dg[0]*matd[3] + loc1*dg[3];
943  J_B[1] = dg[0]*matd[4] + loc1*dg[4] + adjm[8];
944  J_B[2] = dg[0]*matd[5] + loc1*dg[5] - adjm[7];
945  J_C[0] = dg[0]*matd[6] + loc1*dg[6];
946  J_C[1] = dg[0]*matd[7] + loc1*dg[7] - adjm[5];
947  J_C[2] = dg[0]*matd[8] + loc1*dg[8] + adjm[4];
948 
949  loc1 = dobj_dgdg*dg[1] + matd[1];
950  J_A[3] = dobj_df + dg[1]*(matd[1] + loc1);
951  J_A[4] = dg[1]*matd[2] + loc1*dg[2];
952  J_B[3] = dg[1]*matd[3] + loc1*dg[3] - adjm[8];
953  J_B[4] = dg[1]*matd[4] + loc1*dg[4];
954  J_B[5] = dg[1]*matd[5] + loc1*dg[5] + adjm[6];
955  J_C[3] = dg[1]*matd[6] + loc1*dg[6] + adjm[5];
956  J_C[4] = dg[1]*matd[7] + loc1*dg[7];
957  J_C[5] = dg[1]*matd[8] + loc1*dg[8] - adjm[3];
958 
959  loc1 = dobj_dgdg*dg[2] + matd[2];
960  J_A[5] = dobj_df + dg[2]*(matd[2] + loc1);
961  J_B[6] = dg[2]*matd[3] + loc1*dg[3] + adjm[7];
962  J_B[7] = dg[2]*matd[4] + loc1*dg[4] - adjm[6];
963  J_B[8] = dg[2]*matd[5] + loc1*dg[5];
964  J_C[6] = dg[2]*matd[6] + loc1*dg[6] - adjm[4];
965  J_C[7] = dg[2]*matd[7] + loc1*dg[7] + adjm[3];
966  J_C[8] = dg[2]*matd[8] + loc1*dg[8];
967 
968  loc1 = dobj_dgdg*dg[3] + matd[3];
969  J_D[0] = dobj_df + dg[3]*(matd[3] + loc1);
970  J_D[1] = dg[3]*matd[4] + loc1*dg[4];
971  J_D[2] = dg[3]*matd[5] + loc1*dg[5];
972  J_E[0] = dg[3]*matd[6] + loc1*dg[6];
973  J_E[1] = dg[3]*matd[7] + loc1*dg[7] + adjm[2];
974  J_E[2] = dg[3]*matd[8] + loc1*dg[8] - adjm[1];
975 
976  loc1 = dobj_dgdg*dg[4] + matd[4];
977  J_D[3] = dobj_df + dg[4]*(matd[4] + loc1);
978  J_D[4] = dg[4]*matd[5] + loc1*dg[5];
979  J_E[3] = dg[4]*matd[6] + loc1*dg[6] - adjm[2];
980  J_E[4] = dg[4]*matd[7] + loc1*dg[7];
981  J_E[5] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
982 
983  loc1 = dobj_dgdg*dg[5] + matd[5];
984  J_D[5] = dobj_df + dg[5]*(matd[5] + loc1);
985  J_E[6] = dg[5]*matd[6] + loc1*dg[6] + adjm[1];
986  J_E[7] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
987  J_E[8] = dg[5]*matd[8] + loc1*dg[8];
988 
989  loc1 = dobj_dgdg*dg[6] + matd[6];
990  J_F[0] = dobj_df + dg[6]*(matd[6] + loc1);
991  J_F[1] = dg[6]*matd[7] + loc1*dg[7];
992  J_F[2] = dg[6]*matd[8] + loc1*dg[8];
993 
994  loc1 = dobj_dgdg*dg[7] + matd[7];
995  J_F[3] = dobj_df + dg[7]*(matd[7] + loc1);
996  J_F[4] = dg[7]*matd[8] + loc1*dg[8];
997 
998  J_F[5] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
999 
1000  /* Assemble matrix products */
1001 
1002  /* dx / dx */
1003  A[1] = J_A[0]*invR[0][0] + J_A[1]*invR[0][1] + J_A[2]*invR[0][2];
1004  A[2] = J_A[1]*invR[1][1] + J_A[2]*invR[1][2];
1005  A[3] = J_A[2]*invR[2][2];
1006  A[0] = -A[1] - A[2] - A[3];
1007 
1008  A[5] = J_A[1]*invR[0][0] + J_A[3]*invR[0][1] + J_A[4]*invR[0][2];
1009  A[6] = J_A[3]*invR[1][1] + J_A[4]*invR[1][2];
1010  A[7] = J_A[4]*invR[2][2];
1011  A[4] = -A[5] - A[6] - A[7];
1012 
1013  A[9] = J_A[2]*invR[0][0] + J_A[4]*invR[0][1] + J_A[5]*invR[0][2];
1014  A[10] = J_A[4]*invR[1][1] + J_A[5]*invR[1][2];
1015  A[11] = J_A[5]*invR[2][2];
1016  A[8] = -A[9] - A[10] - A[11];
1017 
1018  h_obj[1][0][0] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
1019  h_obj[2][0][0] = A[4]*invR[1][1] + A[8]*invR[1][2];
1020  h_obj[3][0][0] = A[8]*invR[2][2];
1021  h_obj[0][0][0] = -h_obj[1][0][0] - h_obj[2][0][0] - h_obj[3][0][0];
1022 
1023  h_obj[4][0][0] = A[1]*invR[0][0] + A[5]*invR[0][1] + A[9]*invR[0][2];
1024  h_obj[5][0][0] = A[5]*invR[1][1] + A[9]*invR[1][2];
1025  h_obj[6][0][0] = A[9]*invR[2][2];
1026 
1027  h_obj[7][0][0] = A[6]*invR[1][1] + A[10]*invR[1][2];
1028  h_obj[8][0][0] = A[10]*invR[2][2];
1029 
1030  h_obj[9][0][0] = A[11]*invR[2][2];
1031 
1032  /* dx / dy */
1033  A[1] = J_B[0]*invR[0][0] + J_B[1]*invR[0][1] + J_B[2]*invR[0][2];
1034  A[2] = J_B[1]*invR[1][1] + J_B[2]*invR[1][2];
1035  A[3] = J_B[2]*invR[2][2];
1036  A[0] = -A[1] - A[2] - A[3];
1037 
1038  A[5] = J_B[3]*invR[0][0] + J_B[4]*invR[0][1] + J_B[5]*invR[0][2];
1039  A[6] = J_B[4]*invR[1][1] + J_B[5]*invR[1][2];
1040  A[7] = J_B[5]*invR[2][2];
1041  A[4] = -A[5] - A[6] - A[7];
1042 
1043  A[9] = J_B[6]*invR[0][0] + J_B[7]*invR[0][1] + J_B[8]*invR[0][2];
1044  A[10] = J_B[7]*invR[1][1] + J_B[8]*invR[1][2];
1045  A[11] = J_B[8]*invR[2][2];
1046  A[8] = -A[9] - A[10] - A[11];
1047 
1048  h_obj[1][1][0] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
1049  h_obj[4][0][1] = A[1]*invR[0][0] + A[5]*invR[0][1] + A[9]*invR[0][2];
1050  h_obj[5][0][1] = A[2]*invR[0][0] + A[6]*invR[0][1] + A[10]*invR[0][2];
1051  h_obj[6][0][1] = A[3]*invR[0][0] + A[7]*invR[0][1] + A[11]*invR[0][2];
1052 
1053  h_obj[2][1][0] = A[4]*invR[1][1] + A[8]*invR[1][2];
1054  h_obj[5][1][0] = A[5]*invR[1][1] + A[9]*invR[1][2];
1055  h_obj[7][0][1] = A[6]*invR[1][1] + A[10]*invR[1][2];
1056  h_obj[8][0][1] = A[7]*invR[1][1] + A[11]*invR[1][2];
1057 
1058  h_obj[3][1][0] = A[8]*invR[2][2];
1059  h_obj[6][1][0] = A[9]*invR[2][2];
1060  h_obj[8][1][0] = A[10]*invR[2][2];
1061  h_obj[9][0][1] = A[11]*invR[2][2];
1062 
1063  h_obj[0][0][1] = -h_obj[1][1][0] - h_obj[2][1][0] - h_obj[3][1][0];
1064  h_obj[1][0][1] = -h_obj[4][0][1] - h_obj[5][1][0] - h_obj[6][1][0];
1065  h_obj[2][0][1] = -h_obj[5][0][1] - h_obj[7][0][1] - h_obj[8][1][0];
1066  h_obj[3][0][1] = -h_obj[6][0][1] - h_obj[8][0][1] - h_obj[9][0][1];
1067 
1068  /* dx / dz */
1069  A[1] = J_C[0]*invR[0][0] + J_C[1]*invR[0][1] + J_C[2]*invR[0][2];
1070  A[2] = J_C[1]*invR[1][1] + J_C[2]*invR[1][2];
1071  A[3] = J_C[2]*invR[2][2];
1072  A[0] = -A[1] - A[2] - A[3];
1073 
1074  A[5] = J_C[3]*invR[0][0] + J_C[4]*invR[0][1] + J_C[5]*invR[0][2];
1075  A[6] = J_C[4]*invR[1][1] + J_C[5]*invR[1][2];
1076  A[7] = J_C[5]*invR[2][2];
1077  A[4] = -A[5] - A[6] - A[7];
1078 
1079  A[9] = J_C[6]*invR[0][0] + J_C[7]*invR[0][1] + J_C[8]*invR[0][2];
1080  A[10] = J_C[7]*invR[1][1] + J_C[8]*invR[1][2];
1081  A[11] = J_C[8]*invR[2][2];
1082  A[8] = -A[9] - A[10] - A[11];
1083 
1084  h_obj[1][2][0] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
1085  h_obj[4][0][2] = A[1]*invR[0][0] + A[5]*invR[0][1] + A[9]*invR[0][2];
1086  h_obj[5][0][2] = A[2]*invR[0][0] + A[6]*invR[0][1] + A[10]*invR[0][2];
1087  h_obj[6][0][2] = A[3]*invR[0][0] + A[7]*invR[0][1] + A[11]*invR[0][2];
1088 
1089  h_obj[2][2][0] = A[4]*invR[1][1] + A[8]*invR[1][2];
1090  h_obj[5][2][0] = A[5]*invR[1][1] + A[9]*invR[1][2];
1091  h_obj[7][0][2] = A[6]*invR[1][1] + A[10]*invR[1][2];
1092  h_obj[8][0][2] = A[7]*invR[1][1] + A[11]*invR[1][2];
1093 
1094  h_obj[3][2][0] = A[8]*invR[2][2];
1095  h_obj[6][2][0] = A[9]*invR[2][2];
1096  h_obj[8][2][0] = A[10]*invR[2][2];
1097  h_obj[9][0][2] = A[11]*invR[2][2];
1098 
1099  h_obj[0][0][2] = -h_obj[1][2][0] - h_obj[2][2][0] - h_obj[3][2][0];
1100  h_obj[1][0][2] = -h_obj[4][0][2] - h_obj[5][2][0] - h_obj[6][2][0];
1101  h_obj[2][0][2] = -h_obj[5][0][2] - h_obj[7][0][2] - h_obj[8][2][0];
1102  h_obj[3][0][2] = -h_obj[6][0][2] - h_obj[8][0][2] - h_obj[9][0][2];
1103 
1104  /* dy / dy */
1105  A[1] = J_D[0]*invR[0][0] + J_D[1]*invR[0][1] + J_D[2]*invR[0][2];
1106  A[2] = J_D[1]*invR[1][1] + J_D[2]*invR[1][2];
1107  A[3] = J_D[2]*invR[2][2];
1108  A[0] = -A[1] - A[2] - A[3];
1109 
1110  A[5] = J_D[1]*invR[0][0] + J_D[3]*invR[0][1] + J_D[4]*invR[0][2];
1111  A[6] = J_D[3]*invR[1][1] + J_D[4]*invR[1][2];
1112  A[7] = J_D[4]*invR[2][2];
1113  A[4] = -A[5] - A[6] - A[7];
1114 
1115  A[9] = J_D[2]*invR[0][0] + J_D[4]*invR[0][1] + J_D[5]*invR[0][2];
1116  A[10] = J_D[4]*invR[1][1] + J_D[5]*invR[1][2];
1117  A[11] = J_D[5]*invR[2][2];
1118  A[8] = -A[9] - A[10] - A[11];
1119 
1120  h_obj[1][1][1] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
1121  h_obj[2][1][1] = A[4]*invR[1][1] + A[8]*invR[1][2];
1122  h_obj[3][1][1] = A[8]*invR[2][2];
1123  h_obj[0][1][1] = -h_obj[1][1][1] - h_obj[2][1][1] - h_obj[3][1][1];
1124 
1125  h_obj[4][1][1] = A[1]*invR[0][0] + A[5]*invR[0][1] + A[9]*invR[0][2];
1126  h_obj[5][1][1] = A[5]*invR[1][1] + A[9]*invR[1][2];
1127  h_obj[6][1][1] = A[9]*invR[2][2];
1128 
1129  h_obj[7][1][1] = A[6]*invR[1][1] + A[10]*invR[1][2];
1130  h_obj[8][1][1] = A[10]*invR[2][2];
1131 
1132  h_obj[9][1][1] = A[11]*invR[2][2];
1133 
1134  /* dy / dz */
1135  A[1] = J_E[0]*invR[0][0] + J_E[1]*invR[0][1] + J_E[2]*invR[0][2];
1136  A[2] = J_E[1]*invR[1][1] + J_E[2]*invR[1][2];
1137  A[3] = J_E[2]*invR[2][2];
1138  A[0] = -A[1] - A[2] - A[3];
1139 
1140  A[5] = J_E[3]*invR[0][0] + J_E[4]*invR[0][1] + J_E[5]*invR[0][2];
1141  A[6] = J_E[4]*invR[1][1] + J_E[5]*invR[1][2];
1142  A[7] = J_E[5]*invR[2][2];
1143  A[4] = -A[5] - A[6] - A[7];
1144 
1145  A[9] = J_E[6]*invR[0][0] + J_E[7]*invR[0][1] + J_E[8]*invR[0][2];
1146  A[10] = J_E[7]*invR[1][1] + J_E[8]*invR[1][2];
1147  A[11] = J_E[8]*invR[2][2];
1148  A[8] = -A[9] - A[10] - A[11];
1149 
1150  h_obj[1][2][1] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
1151  h_obj[4][1][2] = A[1]*invR[0][0] + A[5]*invR[0][1] + A[9]*invR[0][2];
1152  h_obj[5][1][2] = A[2]*invR[0][0] + A[6]*invR[0][1] + A[10]*invR[0][2];
1153  h_obj[6][1][2] = A[3]*invR[0][0] + A[7]*invR[0][1] + A[11]*invR[0][2];
1154 
1155  h_obj[2][2][1] = A[4]*invR[1][1] + A[8]*invR[1][2];
1156  h_obj[5][2][1] = A[5]*invR[1][1] + A[9]*invR[1][2];
1157  h_obj[7][1][2] = A[6]*invR[1][1] + A[10]*invR[1][2];
1158  h_obj[8][1][2] = A[7]*invR[1][1] + A[11]*invR[1][2];
1159 
1160  h_obj[3][2][1] = A[8]*invR[2][2];
1161  h_obj[6][2][1] = A[9]*invR[2][2];
1162  h_obj[8][2][1] = A[10]*invR[2][2];
1163  h_obj[9][1][2] = A[11]*invR[2][2];
1164 
1165  h_obj[0][1][2] = -h_obj[1][2][1] - h_obj[2][2][1] - h_obj[3][2][1];
1166  h_obj[1][1][2] = -h_obj[4][1][2] - h_obj[5][2][1] - h_obj[6][2][1];
1167  h_obj[2][1][2] = -h_obj[5][1][2] - h_obj[7][1][2] - h_obj[8][2][1];
1168  h_obj[3][1][2] = -h_obj[6][1][2] - h_obj[8][1][2] - h_obj[9][1][2];
1169 
1170  /* dz / dz */
1171  A[1] = J_F[0]*invR[0][0] + J_F[1]*invR[0][1] + J_F[2]*invR[0][2];
1172  A[2] = J_F[1]*invR[1][1] + J_F[2]*invR[1][2];
1173  A[3] = J_F[2]*invR[2][2];
1174  A[0] = -A[1] - A[2] - A[3];
1175 
1176  A[5] = J_F[1]*invR[0][0] + J_F[3]*invR[0][1] + J_F[4]*invR[0][2];
1177  A[6] = J_F[3]*invR[1][1] + J_F[4]*invR[1][2];
1178  A[7] = J_F[4]*invR[2][2];
1179  A[4] = -A[5] - A[6] - A[7];
1180 
1181  A[9] = J_F[2]*invR[0][0] + J_F[4]*invR[0][1] + J_F[5]*invR[0][2];
1182  A[10] = J_F[4]*invR[1][1] + J_F[5]*invR[1][2];
1183  A[11] = J_F[5]*invR[2][2];
1184  A[8] = -A[9] - A[10] - A[11];
1185 
1186  h_obj[1][2][2] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
1187  h_obj[2][2][2] = A[4]*invR[1][1] + A[8]*invR[1][2];
1188  h_obj[3][2][2] = A[8]*invR[2][2];
1189  h_obj[0][2][2] = -h_obj[1][2][2] - h_obj[2][2][2] - h_obj[3][2][2];
1190 
1191  h_obj[4][2][2] = A[1]*invR[0][0] + A[5]*invR[0][1] + A[9]*invR[0][2];
1192  h_obj[5][2][2] = A[5]*invR[1][1] + A[9]*invR[1][2];
1193  h_obj[6][2][2] = A[9]*invR[2][2];
1194 
1195  h_obj[7][2][2] = A[6]*invR[1][1] + A[10]*invR[1][2];
1196  h_obj[8][2][2] = A[10]*invR[2][2];
1197 
1198  h_obj[9][2][2] = A[11]*invR[2][2];
1199 
1200  /* Complete diagonal blocks */
1201  h_obj[0].fill_lower_triangle();
1202  h_obj[4].fill_lower_triangle();
1203  h_obj[7].fill_lower_triangle();
1204  h_obj[9].fill_lower_triangle();
1205  return true;
1206  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_3_v0 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 2547 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

2555  {
2556  double matr[9], f, t1, t2;
2557  double matd[9], g, t3, loc1;
2558  double adjm[9], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
2559  double J_A[6], J_B[10], J_C[10], J_D[6], J_E[10], J_F[6];
2560  double A[12];
2561 
2562  /* Calculate M = A*inv(R). */
2563  f = x[1][0] - x[0][0];
2564  g = x[2][0] - x[0][0];
2565  t1 = x[3][0] - x[0][0];
2566  matr[0] = f*invR[0][0];
2567  matr[1] = f*invR[0][1] + g*invR[1][1];
2568  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2569 
2570  f = x[1][1] - x[0][1];
2571  g = x[2][1] - x[0][1];
2572  t1 = x[3][1] - x[0][1];
2573  matr[3] = f*invR[0][0];
2574  matr[4] = f*invR[0][1] + g*invR[1][1];
2575  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2576 
2577  f = x[1][2] - x[0][2];
2578  g = x[2][2] - x[0][2];
2579  t1 = x[3][2] - x[0][2];
2580  matr[6] = f*invR[0][0];
2581  matr[7] = f*invR[0][1] + g*invR[1][1];
2582  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2583 
2584  /* Calculate det(M). */
2585  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
2586  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
2587  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
2588  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
2589  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
2590  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
2591  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
2592  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
2593  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
2594 
2595  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
2596 
2597  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
2598 
2599  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
2600  t2 = t1*t1 + 4.0*delta*delta;
2601  t3 = sqrt(t2);
2602  g = t1 + t3;
2603 
2604  /* Calculate N = M - beta*Q. */
2605  matd[0] = matr[0] - beta*Q[0][0];
2606  matd[1] = matr[1] - beta*Q[0][1];
2607  matd[2] = matr[2] - beta*Q[0][2];
2608  matd[3] = matr[3] - beta*Q[1][0];
2609  matd[4] = matr[4] - beta*Q[1][1];
2610  matd[5] = matr[5] - beta*Q[1][2];
2611  matd[6] = matr[6] - beta*Q[2][0];
2612  matd[7] = matr[7] - beta*Q[2][1];
2613  matd[8] = matr[8] - beta*Q[2][2];
2614 
2615  /* Calculate norm(N) */
2616  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
2617  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
2618  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
2619 
2620  /* Calculate objective function. */
2621  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
2622  obj = f * loc1;
2623 
2624  /* Calculate the derivative of the objective function. */
2625  t3 = 1.0 / t3;
2626  dobj_df = 2.0 * loc1;
2627  dobj_dg = -gamma * obj * t3;
2628  dobj_dfdg = -gamma * dobj_df * t3;
2629  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
2630 
2631  /* Calculate adjoint matrix */
2632  adjm[0] = dobj_df*matd[0] + dobj_dg*dg[0];
2633  adjm[1] = dobj_df*matd[1] + dobj_dg*dg[1];
2634  adjm[2] = dobj_df*matd[2] + dobj_dg*dg[2];
2635  adjm[3] = dobj_df*matd[3] + dobj_dg*dg[3];
2636  adjm[4] = dobj_df*matd[4] + dobj_dg*dg[4];
2637  adjm[5] = dobj_df*matd[5] + dobj_dg*dg[5];
2638  adjm[6] = dobj_df*matd[6] + dobj_dg*dg[6];
2639  adjm[7] = dobj_df*matd[7] + dobj_dg*dg[7];
2640  adjm[8] = dobj_df*matd[8] + dobj_dg*dg[8];
2641 
2642  /* Construct gradients */
2643  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
2644  g_obj[0] += invR[1][1]*adjm[1]+invR[1][2]*adjm[2];
2645  g_obj[0] += invR[2][2]*adjm[2];
2646  g_obj[0] = -g_obj[0];
2647 
2648  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
2649  g_obj[1] += invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
2650  g_obj[1] += invR[2][2]*adjm[5];
2651  g_obj[1] = -g_obj[1];
2652 
2653  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
2654  g_obj[2] += invR[1][1]*adjm[7]+invR[1][2]*adjm[8];
2655  g_obj[2] += invR[2][2]*adjm[8];
2656  g_obj[2] = -g_obj[2];
2657 
2658  /* Start of the Hessian evaluation */
2659  adjm[0] = dobj_dg*matr[0]; matd[0] *= dobj_dfdg;
2660  adjm[1] = dobj_dg*matr[1]; matd[1] *= dobj_dfdg;
2661  adjm[2] = dobj_dg*matr[2]; matd[2] *= dobj_dfdg;
2662  adjm[3] = dobj_dg*matr[3]; matd[3] *= dobj_dfdg;
2663  adjm[4] = dobj_dg*matr[4]; matd[4] *= dobj_dfdg;
2664  adjm[5] = dobj_dg*matr[5]; matd[5] *= dobj_dfdg;
2665  adjm[6] = dobj_dg*matr[6]; matd[6] *= dobj_dfdg;
2666  adjm[7] = dobj_dg*matr[7]; matd[7] *= dobj_dfdg;
2667  adjm[8] = dobj_dg*matr[8]; matd[8] *= dobj_dfdg;
2668 
2669  /* Blocks for the Hessian construction */
2670  loc1 = dobj_dgdg*dg[0] + matd[0];
2671  J_A[0] = dobj_df + dg[0]*(matd[0] + loc1);
2672  J_A[1] = dg[0]*matd[1] + loc1*dg[1];
2673  J_A[2] = dg[0]*matd[2] + loc1*dg[2];
2674  J_B[0] = dg[0]*matd[3] + loc1*dg[3];
2675  J_B[1] = dg[0]*matd[4] + loc1*dg[4] + adjm[8];
2676  J_B[2] = dg[0]*matd[5] + loc1*dg[5] - adjm[7];
2677  J_C[0] = dg[0]*matd[6] + loc1*dg[6];
2678  J_C[1] = dg[0]*matd[7] + loc1*dg[7] - adjm[5];
2679  J_C[2] = dg[0]*matd[8] + loc1*dg[8] + adjm[4];
2680 
2681  loc1 = dobj_dgdg*dg[1] + matd[1];
2682  J_A[3] = dobj_df + dg[1]*(matd[1] + loc1);
2683  J_A[4] = dg[1]*matd[2] + loc1*dg[2];
2684  J_B[3] = dg[1]*matd[3] + loc1*dg[3] - adjm[8];
2685  J_B[4] = dg[1]*matd[4] + loc1*dg[4];
2686  J_B[5] = dg[1]*matd[5] + loc1*dg[5] + adjm[6];
2687  J_C[3] = dg[1]*matd[6] + loc1*dg[6] + adjm[5];
2688  J_C[4] = dg[1]*matd[7] + loc1*dg[7];
2689  J_C[5] = dg[1]*matd[8] + loc1*dg[8] - adjm[3];
2690 
2691  loc1 = dobj_dgdg*dg[2] + matd[2];
2692  J_A[5] = dobj_df + dg[2]*(matd[2] + loc1);
2693  J_B[6] = dg[2]*matd[3] + loc1*dg[3] + adjm[7];
2694  J_B[7] = dg[2]*matd[4] + loc1*dg[4] - adjm[6];
2695  J_B[8] = dg[2]*matd[5] + loc1*dg[5];
2696  J_C[6] = dg[2]*matd[6] + loc1*dg[6] - adjm[4];
2697  J_C[7] = dg[2]*matd[7] + loc1*dg[7] + adjm[3];
2698  J_C[8] = dg[2]*matd[8] + loc1*dg[8];
2699 
2700  loc1 = dobj_dgdg*dg[3] + matd[3];
2701  J_D[0] = dobj_df + dg[3]*(matd[3] + loc1);
2702  J_D[1] = dg[3]*matd[4] + loc1*dg[4];
2703  J_D[2] = dg[3]*matd[5] + loc1*dg[5];
2704  J_E[0] = dg[3]*matd[6] + loc1*dg[6];
2705  J_E[1] = dg[3]*matd[7] + loc1*dg[7] + adjm[2];
2706  J_E[2] = dg[3]*matd[8] + loc1*dg[8] - adjm[1];
2707 
2708  loc1 = dobj_dgdg*dg[4] + matd[4];
2709  J_D[3] = dobj_df + dg[4]*(matd[4] + loc1);
2710  J_D[4] = dg[4]*matd[5] + loc1*dg[5];
2711  J_E[3] = dg[4]*matd[6] + loc1*dg[6] - adjm[2];
2712  J_E[4] = dg[4]*matd[7] + loc1*dg[7];
2713  J_E[5] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
2714 
2715  loc1 = dobj_dgdg*dg[5] + matd[5];
2716  J_D[5] = dobj_df + dg[5]*(matd[5] + loc1);
2717  J_E[6] = dg[5]*matd[6] + loc1*dg[6] + adjm[1];
2718  J_E[7] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
2719  J_E[8] = dg[5]*matd[8] + loc1*dg[8];
2720 
2721  loc1 = dobj_dgdg*dg[6] + matd[6];
2722  J_F[0] = dobj_df + dg[6]*(matd[6] + loc1);
2723  J_F[1] = dg[6]*matd[7] + loc1*dg[7];
2724  J_F[2] = dg[6]*matd[8] + loc1*dg[8];
2725 
2726  loc1 = dobj_dgdg*dg[7] + matd[7];
2727  J_F[3] = dobj_df + dg[7]*(matd[7] + loc1);
2728  J_F[4] = dg[7]*matd[8] + loc1*dg[8];
2729 
2730  J_F[5] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
2731 
2732  /* Assemble matrix products */
2733 
2734  /* dx / dx */
2735  A[1] = J_A[0]*invR[0][0] + J_A[1]*invR[0][1] + J_A[2]*invR[0][2];
2736  A[2] = J_A[1]*invR[1][1] + J_A[2]*invR[1][2];
2737  A[3] = J_A[2]*invR[2][2];
2738  A[0] = -A[1] - A[2] - A[3];
2739 
2740  A[5] = J_A[1]*invR[0][0] + J_A[3]*invR[0][1] + J_A[4]*invR[0][2];
2741  A[6] = J_A[3]*invR[1][1] + J_A[4]*invR[1][2];
2742  A[7] = J_A[4]*invR[2][2];
2743  A[4] = -A[5] - A[6] - A[7];
2744 
2745  A[9] = J_A[2]*invR[0][0] + J_A[4]*invR[0][1] + J_A[5]*invR[0][2];
2746  A[10] = J_A[4]*invR[1][1] + J_A[5]*invR[1][2];
2747  A[11] = J_A[5]*invR[2][2];
2748  A[8] = -A[9] - A[10] - A[11];
2749 
2750  h_obj[0][0] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
2751  h_obj[0][0] += A[4]*invR[1][1] + A[8]*invR[1][2];
2752  h_obj[0][0] += A[8]*invR[2][2];
2753  h_obj[0][0] = -h_obj[0][0];
2754 
2755  /* dx / dy */
2756  A[1] = J_B[0]*invR[0][0] + J_B[1]*invR[0][1] + J_B[2]*invR[0][2];
2757  A[2] = J_B[1]*invR[1][1] + J_B[2]*invR[1][2];
2758  A[3] = J_B[2]*invR[2][2];
2759  A[0] = -A[1] - A[2] - A[3];
2760 
2761  A[5] = J_B[3]*invR[0][0] + J_B[4]*invR[0][1] + J_B[5]*invR[0][2];
2762  A[6] = J_B[4]*invR[1][1] + J_B[5]*invR[1][2];
2763  A[7] = J_B[5]*invR[2][2];
2764  A[4] = -A[5] - A[6] - A[7];
2765 
2766  A[9] = J_B[6]*invR[0][0] + J_B[7]*invR[0][1] + J_B[8]*invR[0][2];
2767  A[10] = J_B[7]*invR[1][1] + J_B[8]*invR[1][2];
2768  A[11] = J_B[8]*invR[2][2];
2769  A[8] = -A[9] - A[10] - A[11];
2770 
2771  h_obj[0][1] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
2772  h_obj[0][1] += A[4]*invR[1][1] + A[8]*invR[1][2];
2773  h_obj[0][1] += A[8]*invR[2][2];
2774  h_obj[0][1] = -h_obj[0][1];
2775 
2776  /* dx / dz */
2777  A[1] = J_C[0]*invR[0][0] + J_C[1]*invR[0][1] + J_C[2]*invR[0][2];
2778  A[2] = J_C[1]*invR[1][1] + J_C[2]*invR[1][2];
2779  A[3] = J_C[2]*invR[2][2];
2780  A[0] = -A[1] - A[2] - A[3];
2781 
2782  A[5] = J_C[3]*invR[0][0] + J_C[4]*invR[0][1] + J_C[5]*invR[0][2];
2783  A[6] = J_C[4]*invR[1][1] + J_C[5]*invR[1][2];
2784  A[7] = J_C[5]*invR[2][2];
2785  A[4] = -A[5] - A[6] - A[7];
2786 
2787  A[9] = J_C[6]*invR[0][0] + J_C[7]*invR[0][1] + J_C[8]*invR[0][2];
2788  A[10] = J_C[7]*invR[1][1] + J_C[8]*invR[1][2];
2789  A[11] = J_C[8]*invR[2][2];
2790  A[8] = -A[9] - A[10] - A[11];
2791 
2792  h_obj[0][2] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
2793  h_obj[0][2] += A[4]*invR[1][1] + A[8]*invR[1][2];
2794  h_obj[0][2] += A[8]*invR[2][2];
2795  h_obj[0][2] = -h_obj[0][2];
2796 
2797  /* dy / dy */
2798  A[1] = J_D[0]*invR[0][0] + J_D[1]*invR[0][1] + J_D[2]*invR[0][2];
2799  A[2] = J_D[1]*invR[1][1] + J_D[2]*invR[1][2];
2800  A[3] = J_D[2]*invR[2][2];
2801  A[0] = -A[1] - A[2] - A[3];
2802 
2803  A[5] = J_D[1]*invR[0][0] + J_D[3]*invR[0][1] + J_D[4]*invR[0][2];
2804  A[6] = J_D[3]*invR[1][1] + J_D[4]*invR[1][2];
2805  A[7] = J_D[4]*invR[2][2];
2806  A[4] = -A[5] - A[6] - A[7];
2807 
2808  A[9] = J_D[2]*invR[0][0] + J_D[4]*invR[0][1] + J_D[5]*invR[0][2];
2809  A[10] = J_D[4]*invR[1][1] + J_D[5]*invR[1][2];
2810  A[11] = J_D[5]*invR[2][2];
2811  A[8] = -A[9] - A[10] - A[11];
2812 
2813  h_obj[1][1] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
2814  h_obj[1][1] += A[4]*invR[1][1] + A[8]*invR[1][2];
2815  h_obj[1][1] += A[8]*invR[2][2];
2816  h_obj[1][1] = -h_obj[1][1];
2817 
2818  /* dy / dz */
2819  A[1] = J_E[0]*invR[0][0] + J_E[1]*invR[0][1] + J_E[2]*invR[0][2];
2820  A[2] = J_E[1]*invR[1][1] + J_E[2]*invR[1][2];
2821  A[3] = J_E[2]*invR[2][2];
2822  A[0] = -A[1] - A[2] - A[3];
2823 
2824  A[5] = J_E[3]*invR[0][0] + J_E[4]*invR[0][1] + J_E[5]*invR[0][2];
2825  A[6] = J_E[4]*invR[1][1] + J_E[5]*invR[1][2];
2826  A[7] = J_E[5]*invR[2][2];
2827  A[4] = -A[5] - A[6] - A[7];
2828 
2829  A[9] = J_E[6]*invR[0][0] + J_E[7]*invR[0][1] + J_E[8]*invR[0][2];
2830  A[10] = J_E[7]*invR[1][1] + J_E[8]*invR[1][2];
2831  A[11] = J_E[8]*invR[2][2];
2832  A[8] = -A[9] - A[10] - A[11];
2833 
2834  h_obj[1][2] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
2835  h_obj[1][2] += A[4]*invR[1][1] + A[8]*invR[1][2];
2836  h_obj[1][2] += A[8]*invR[2][2];
2837  h_obj[1][2] = -h_obj[1][2];
2838 
2839  /* dz / dz */
2840  A[1] = J_F[0]*invR[0][0] + J_F[1]*invR[0][1] + J_F[2]*invR[0][2];
2841  A[2] = J_F[1]*invR[1][1] + J_F[2]*invR[1][2];
2842  A[3] = J_F[2]*invR[2][2];
2843  A[0] = -A[1] - A[2] - A[3];
2844 
2845  A[5] = J_F[1]*invR[0][0] + J_F[3]*invR[0][1] + J_F[4]*invR[0][2];
2846  A[6] = J_F[3]*invR[1][1] + J_F[4]*invR[1][2];
2847  A[7] = J_F[4]*invR[2][2];
2848  A[4] = -A[5] - A[6] - A[7];
2849 
2850  A[9] = J_F[2]*invR[0][0] + J_F[4]*invR[0][1] + J_F[5]*invR[0][2];
2851  A[10] = J_F[4]*invR[1][1] + J_F[5]*invR[1][2];
2852  A[11] = J_F[5]*invR[2][2];
2853  A[8] = -A[9] - A[10] - A[11];
2854 
2855  h_obj[2][2] = A[0]*invR[0][0] + A[4]*invR[0][1] + A[8]*invR[0][2];
2856  h_obj[2][2] += A[4]*invR[1][1] + A[8]*invR[1][2];
2857  h_obj[2][2] += A[8]*invR[2][2];
2858  h_obj[2][2] = -h_obj[2][2];
2859 
2860  /* Complete diagonal blocks */
2861  h_obj.fill_lower_triangle();
2862  return true;
2863  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_3_v1 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 2865 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

2873  {
2874  double matr[9], f, t1, t2;
2875  double matd[9], g, t3, loc1;
2876  double adjm[9], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
2877  double J_A[6], J_B[10], J_C[10], J_D[6], J_E[10], J_F[6];
2878  double A[12];
2879 
2880  /* Calculate M = A*inv(R). */
2881  f = x[1][0] - x[0][0];
2882  g = x[2][0] - x[0][0];
2883  t1 = x[3][0] - x[0][0];
2884  matr[0] = f*invR[0][0];
2885  matr[1] = f*invR[0][1] + g*invR[1][1];
2886  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2887 
2888  f = x[1][1] - x[0][1];
2889  g = x[2][1] - x[0][1];
2890  t1 = x[3][1] - x[0][1];
2891  matr[3] = f*invR[0][0];
2892  matr[4] = f*invR[0][1] + g*invR[1][1];
2893  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2894 
2895  f = x[1][2] - x[0][2];
2896  g = x[2][2] - x[0][2];
2897  t1 = x[3][2] - x[0][2];
2898  matr[6] = f*invR[0][0];
2899  matr[7] = f*invR[0][1] + g*invR[1][1];
2900  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
2901 
2902  /* Calculate det(M). */
2903  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
2904  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
2905  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
2906  dg[3] = matr[2]*matr[7] - matr[1]*matr[8];
2907  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
2908  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
2909  dg[6] = matr[1]*matr[5] - matr[2]*matr[4];
2910  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
2911  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
2912 
2913  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
2914 
2915  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
2916 
2917  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
2918  t2 = t1*t1 + 4.0*delta*delta;
2919  t3 = sqrt(t2);
2920  g = t1 + t3;
2921 
2922  /* Calculate N = M - beta*Q. */
2923  matd[0] = matr[0] - beta*Q[0][0];
2924  matd[1] = matr[1] - beta*Q[0][1];
2925  matd[2] = matr[2] - beta*Q[0][2];
2926  matd[3] = matr[3] - beta*Q[1][0];
2927  matd[4] = matr[4] - beta*Q[1][1];
2928  matd[5] = matr[5] - beta*Q[1][2];
2929  matd[6] = matr[6] - beta*Q[2][0];
2930  matd[7] = matr[7] - beta*Q[2][1];
2931  matd[8] = matr[8] - beta*Q[2][2];
2932 
2933  /* Calculate norm(N) */
2934  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
2935  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
2936  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
2937 
2938  /* Calculate objective function. */
2939  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
2940  obj = f * loc1;
2941 
2942  /* Calculate the derivative of the objective function. */
2943  t3 = 1.0 / t3;
2944  dobj_df = 2.0 * loc1;
2945  dobj_dg = -gamma * obj * t3;
2946  dobj_dfdg = -gamma * dobj_df * t3;
2947  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
2948 
2949  /* Calculate adjoint matrix */
2950  adjm[0] = dobj_df*matd[0] + dobj_dg*dg[0];
2951  adjm[1] = dobj_df*matd[1] + dobj_dg*dg[1];
2952  adjm[2] = dobj_df*matd[2] + dobj_dg*dg[2];
2953  adjm[3] = dobj_df*matd[3] + dobj_dg*dg[3];
2954  adjm[4] = dobj_df*matd[4] + dobj_dg*dg[4];
2955  adjm[5] = dobj_df*matd[5] + dobj_dg*dg[5];
2956  adjm[6] = dobj_df*matd[6] + dobj_dg*dg[6];
2957  adjm[7] = dobj_df*matd[7] + dobj_dg*dg[7];
2958  adjm[8] = dobj_df*matd[8] + dobj_dg*dg[8];
2959 
2960  /* Construct gradients */
2961  g_obj[0] = invR[0][0]*adjm[0]+invR[0][1]*adjm[1]+invR[0][2]*adjm[2];
2962  g_obj[1] = invR[0][0]*adjm[3]+invR[0][1]*adjm[4]+invR[0][2]*adjm[5];
2963  g_obj[2] = invR[0][0]*adjm[6]+invR[0][1]*adjm[7]+invR[0][2]*adjm[8];
2964 
2965  /* Start of the Hessian evaluation */
2966  adjm[0] = dobj_dg*matr[0]; matd[0] *= dobj_dfdg;
2967  adjm[1] = dobj_dg*matr[1]; matd[1] *= dobj_dfdg;
2968  adjm[2] = dobj_dg*matr[2]; matd[2] *= dobj_dfdg;
2969  adjm[3] = dobj_dg*matr[3]; matd[3] *= dobj_dfdg;
2970  adjm[4] = dobj_dg*matr[4]; matd[4] *= dobj_dfdg;
2971  adjm[5] = dobj_dg*matr[5]; matd[5] *= dobj_dfdg;
2972  adjm[6] = dobj_dg*matr[6]; matd[6] *= dobj_dfdg;
2973  adjm[7] = dobj_dg*matr[7]; matd[7] *= dobj_dfdg;
2974  adjm[8] = dobj_dg*matr[8]; matd[8] *= dobj_dfdg;
2975 
2976  /* Blocks for the Hessian construction */
2977  loc1 = dobj_dgdg*dg[0] + matd[0];
2978  J_A[0] = dobj_df + dg[0]*(matd[0] + loc1);
2979  J_A[1] = dg[0]*matd[1] + loc1*dg[1];
2980  J_A[2] = dg[0]*matd[2] + loc1*dg[2];
2981  J_B[0] = dg[0]*matd[3] + loc1*dg[3];
2982  J_B[1] = dg[0]*matd[4] + loc1*dg[4] + adjm[8];
2983  J_B[2] = dg[0]*matd[5] + loc1*dg[5] - adjm[7];
2984  J_C[0] = dg[0]*matd[6] + loc1*dg[6];
2985  J_C[1] = dg[0]*matd[7] + loc1*dg[7] - adjm[5];
2986  J_C[2] = dg[0]*matd[8] + loc1*dg[8] + adjm[4];
2987 
2988  loc1 = dobj_dgdg*dg[1] + matd[1];
2989  J_A[3] = dobj_df + dg[1]*(matd[1] + loc1);
2990  J_A[4] = dg[1]*matd[2] + loc1*dg[2];
2991  J_B[3] = dg[1]*matd[3] + loc1*dg[3] - adjm[8];
2992  J_B[4] = dg[1]*matd[4] + loc1*dg[4];
2993  J_B[5] = dg[1]*matd[5] + loc1*dg[5] + adjm[6];
2994  J_C[3] = dg[1]*matd[6] + loc1*dg[6] + adjm[5];
2995  J_C[4] = dg[1]*matd[7] + loc1*dg[7];
2996  J_C[5] = dg[1]*matd[8] + loc1*dg[8] - adjm[3];
2997 
2998  loc1 = dobj_dgdg*dg[2] + matd[2];
2999  J_A[5] = dobj_df + dg[2]*(matd[2] + loc1);
3000  J_B[6] = dg[2]*matd[3] + loc1*dg[3] + adjm[7];
3001  J_B[7] = dg[2]*matd[4] + loc1*dg[4] - adjm[6];
3002  J_B[8] = dg[2]*matd[5] + loc1*dg[5];
3003  J_C[6] = dg[2]*matd[6] + loc1*dg[6] - adjm[4];
3004  J_C[7] = dg[2]*matd[7] + loc1*dg[7] + adjm[3];
3005  J_C[8] = dg[2]*matd[8] + loc1*dg[8];
3006 
3007  loc1 = dobj_dgdg*dg[3] + matd[3];
3008  J_D[0] = dobj_df + dg[3]*(matd[3] + loc1);
3009  J_D[1] = dg[3]*matd[4] + loc1*dg[4];
3010  J_D[2] = dg[3]*matd[5] + loc1*dg[5];
3011  J_E[0] = dg[3]*matd[6] + loc1*dg[6];
3012  J_E[1] = dg[3]*matd[7] + loc1*dg[7] + adjm[2];
3013  J_E[2] = dg[3]*matd[8] + loc1*dg[8] - adjm[1];
3014 
3015  loc1 = dobj_dgdg*dg[4] + matd[4];
3016  J_D[3] = dobj_df + dg[4]*(matd[4] + loc1);
3017  J_D[4] = dg[4]*matd[5] + loc1*dg[5];
3018  J_E[3] = dg[4]*matd[6] + loc1*dg[6] - adjm[2];
3019  J_E[4] = dg[4]*matd[7] + loc1*dg[7];
3020  J_E[5] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
3021 
3022  loc1 = dobj_dgdg*dg[5] + matd[5];
3023  J_D[5] = dobj_df + dg[5]*(matd[5] + loc1);
3024  J_E[6] = dg[5]*matd[6] + loc1*dg[6] + adjm[1];
3025  J_E[7] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
3026  J_E[8] = dg[5]*matd[8] + loc1*dg[8];
3027 
3028  loc1 = dobj_dgdg*dg[6] + matd[6];
3029  J_F[0] = dobj_df + dg[6]*(matd[6] + loc1);
3030  J_F[1] = dg[6]*matd[7] + loc1*dg[7];
3031  J_F[2] = dg[6]*matd[8] + loc1*dg[8];
3032 
3033  loc1 = dobj_dgdg*dg[7] + matd[7];
3034  J_F[3] = dobj_df + dg[7]*(matd[7] + loc1);
3035  J_F[4] = dg[7]*matd[8] + loc1*dg[8];
3036 
3037  J_F[5] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
3038 
3039  /* Assemble matrix products */
3040 
3041  /* dx / dx */
3042  A[0] = J_A[0]*invR[0][0] + J_A[1]*invR[0][1] + J_A[2]*invR[0][2];
3043  A[1] = J_A[1]*invR[0][0] + J_A[3]*invR[0][1] + J_A[4]*invR[0][2];
3044  A[2] = J_A[2]*invR[0][0] + J_A[4]*invR[0][1] + J_A[5]*invR[0][2];
3045  h_obj[0][0] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
3046 
3047  /* dx / dy */
3048  A[0] = J_B[0]*invR[0][0] + J_B[1]*invR[0][1] + J_B[2]*invR[0][2];
3049  A[1] = J_B[3]*invR[0][0] + J_B[4]*invR[0][1] + J_B[5]*invR[0][2];
3050  A[2] = J_B[6]*invR[0][0] + J_B[7]*invR[0][1] + J_B[8]*invR[0][2];
3051  h_obj[0][1] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
3052 
3053  /* dx / dz */
3054  A[0] = J_C[0]*invR[0][0] + J_C[1]*invR[0][1] + J_C[2]*invR[0][2];
3055  A[1] = J_C[3]*invR[0][0] + J_C[4]*invR[0][1] + J_C[5]*invR[0][2];
3056  A[2] = J_C[6]*invR[0][0] + J_C[7]*invR[0][1] + J_C[8]*invR[0][2];
3057  h_obj[0][2] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
3058 
3059  /* dy / dy */
3060  A[0] = J_D[0]*invR[0][0] + J_D[1]*invR[0][1] + J_D[2]*invR[0][2];
3061  A[1] = J_D[1]*invR[0][0] + J_D[3]*invR[0][1] + J_D[4]*invR[0][2];
3062  A[2] = J_D[2]*invR[0][0] + J_D[4]*invR[0][1] + J_D[5]*invR[0][2];
3063  h_obj[1][1] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
3064 
3065  /* dy / dz */
3066  A[0] = J_E[0]*invR[0][0] + J_E[1]*invR[0][1] + J_E[2]*invR[0][2];
3067  A[1] = J_E[3]*invR[0][0] + J_E[4]*invR[0][1] + J_E[5]*invR[0][2];
3068  A[2] = J_E[6]*invR[0][0] + J_E[7]*invR[0][1] + J_E[8]*invR[0][2];
3069  h_obj[1][2] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
3070 
3071  /* dz / dz */
3072  A[0] = J_F[0]*invR[0][0] + J_F[1]*invR[0][1] + J_F[2]*invR[0][2];
3073  A[1] = J_F[1]*invR[0][0] + J_F[3]*invR[0][1] + J_F[4]*invR[0][2];
3074  A[2] = J_F[2]*invR[0][0] + J_F[4]*invR[0][1] + J_F[5]*invR[0][2];
3075  h_obj[2][2] = A[0]*invR[0][0] + A[1]*invR[0][1] + A[2]*invR[0][2];
3076 
3077  /* Complete diagonal blocks */
3078  h_obj.fill_lower_triangle();
3079  return true;
3080  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_3_v2 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 3082 of file includeLinks/I_DFTFamilyFunctions.hpp.

References A, Matrix3D::fill_lower_triangle(), MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

3090  {
3091  double matr[9], f, t1, t2;
3092  double matd[9], g, t3, loc1;
3093  double adjm[6], dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
3094  double J_A[3], J_B[4], J_C[4], J_D[3], J_E[4], J_F[3];
3095  double A[2];
3096 
3097  /* Calculate M = A*inv(R). */
3098  f = x[1][0] - x[0][0];
3099  g = x[2][0] - x[0][0];
3100  t1 = x[3][0] - x[0][0];
3101  matr[0] = f*invR[0][0];
3102  matr[1] = f*invR[0][1] + g*invR[1][1];
3103  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
3104 
3105  f = x[1][1] - x[0][1];
3106  g = x[2][1] - x[0][1];
3107  t1 = x[3][1] - x[0][1];
3108  matr[3] = f*invR[0][0];
3109  matr[4] = f*invR[0][1] + g*invR[1][1];
3110  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
3111 
3112  f = x[1][2] - x[0][2];
3113  g = x[2][2] - x[0][2];
3114  t1 = x[3][2] - x[0][2];
3115  matr[6] = f*invR[0][0];
3116  matr[7] = f*invR[0][1] + g*invR[1][1];
3117  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
3118 
3119  /* Calculate det(M). */
3120  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
3121  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
3122  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
3123  dg[4] = matr[0]*matr[8] - matr[2]*matr[6];
3124  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
3125  dg[7] = matr[2]*matr[3] - matr[0]*matr[5];
3126  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
3127 
3128  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
3129 
3130  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
3131 
3132  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
3133  t2 = t1*t1 + 4.0*delta*delta;
3134  t3 = sqrt(t2);
3135  g = t1 + t3;
3136 
3137  /* Calculate N = M - beta*Q. */
3138  matd[0] = matr[0] - beta*Q[0][0];
3139  matd[1] = matr[1] - beta*Q[0][1];
3140  matd[2] = matr[2] - beta*Q[0][2];
3141  matd[3] = matr[3] - beta*Q[1][0];
3142  matd[4] = matr[4] - beta*Q[1][1];
3143  matd[5] = matr[5] - beta*Q[1][2];
3144  matd[6] = matr[6] - beta*Q[2][0];
3145  matd[7] = matr[7] - beta*Q[2][1];
3146  matd[8] = matr[8] - beta*Q[2][2];
3147 
3148  /* Calculate norm(N) */
3149  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
3150  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
3151  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
3152 
3153  /* Calculate objective function. */
3154  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
3155  obj = f * loc1;
3156 
3157  /* Calculate the derivative of the objective function. */
3158  t3 = 1.0 / t3;
3159  dobj_df = 2.0 * loc1;
3160  dobj_dg = -gamma * obj * t3;
3161  dobj_dfdg = -gamma * dobj_df * t3;
3162  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
3163 
3164  /* Calculate adjoint matrix */
3165  adjm[0] = dobj_df*matd[1] + dobj_dg*dg[1];
3166  adjm[1] = dobj_df*matd[2] + dobj_dg*dg[2];
3167  adjm[2] = dobj_df*matd[4] + dobj_dg*dg[4];
3168  adjm[3] = dobj_df*matd[5] + dobj_dg*dg[5];
3169  adjm[4] = dobj_df*matd[7] + dobj_dg*dg[7];
3170  adjm[5] = dobj_df*matd[8] + dobj_dg*dg[8];
3171 
3172  /* Construct gradients */
3173  g_obj[0] = invR[1][1]*adjm[0]+invR[1][2]*adjm[1];
3174  g_obj[1] = invR[1][1]*adjm[2]+invR[1][2]*adjm[3];
3175  g_obj[2] = invR[1][1]*adjm[4]+invR[1][2]*adjm[5];
3176 
3177  /* Start of the Hessian evaluation */
3178  adjm[0] = dobj_dg*matr[0];
3179  adjm[1] = dobj_dg*matr[3];
3180  adjm[2] = dobj_dg*matr[6];
3181 
3182  matd[1] *= dobj_dfdg;
3183  matd[2] *= dobj_dfdg;
3184  matd[4] *= dobj_dfdg;
3185  matd[5] *= dobj_dfdg;
3186  matd[7] *= dobj_dfdg;
3187  matd[8] *= dobj_dfdg;
3188 
3189  /* Blocks for the Hessian construction */
3190  loc1 = dobj_dgdg*dg[1] + matd[1];
3191  J_A[0] = dobj_df + dg[1]*(matd[1] + loc1);
3192  J_A[1] = dg[1]*matd[2] + loc1*dg[2];
3193  J_B[0] = dg[1]*matd[4] + loc1*dg[4];
3194  J_B[1] = dg[1]*matd[5] + loc1*dg[5] + adjm[2];
3195  J_C[0] = dg[1]*matd[7] + loc1*dg[7];
3196  J_C[1] = dg[1]*matd[8] + loc1*dg[8] - adjm[1];
3197 
3198  loc1 = dobj_dgdg*dg[2] + matd[2];
3199  J_A[2] = dobj_df + dg[2]*(matd[2] + loc1);
3200  J_B[2] = dg[2]*matd[4] + loc1*dg[4] - adjm[2];
3201  J_B[3] = dg[2]*matd[5] + loc1*dg[5];
3202  J_C[2] = dg[2]*matd[7] + loc1*dg[7] + adjm[1];
3203  J_C[3] = dg[2]*matd[8] + loc1*dg[8];
3204 
3205  loc1 = dobj_dgdg*dg[4] + matd[4];
3206  J_D[0] = dobj_df + dg[4]*(matd[4] + loc1);
3207  J_D[1] = dg[4]*matd[5] + loc1*dg[5];
3208  J_E[0] = dg[4]*matd[7] + loc1*dg[7];
3209  J_E[1] = dg[4]*matd[8] + loc1*dg[8] + adjm[0];
3210 
3211  loc1 = dobj_dgdg*dg[5] + matd[5];
3212  J_D[2] = dobj_df + dg[5]*(matd[5] + loc1);
3213  J_E[2] = dg[5]*matd[7] + loc1*dg[7] - adjm[0];
3214  J_E[3] = dg[5]*matd[8] + loc1*dg[8];
3215 
3216  loc1 = dobj_dgdg*dg[7] + matd[7];
3217  J_F[0] = dobj_df + dg[7]*(matd[7] + loc1);
3218  J_F[1] = dg[7]*matd[8] + loc1*dg[8];
3219 
3220  J_F[2] = dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]);
3221 
3222  /* Assemble matrix products */
3223 
3224  /* dx / dx */
3225  A[0] = J_A[0]*invR[1][1] + J_A[1]*invR[1][2];
3226  A[1] = J_A[1]*invR[1][1] + J_A[2]*invR[1][2];
3227  h_obj[0][0] = A[0]*invR[1][1] + A[1]*invR[1][2];
3228 
3229  /* dx / dy */
3230  A[0] = J_B[0]*invR[1][1] + J_B[1]*invR[1][2];
3231  A[1] = J_B[2]*invR[1][1] + J_B[3]*invR[1][2];
3232  h_obj[0][1] = A[0]*invR[1][1] + A[1]*invR[1][2];
3233 
3234  /* dx / dz */
3235  A[0] = J_C[0]*invR[1][1] + J_C[1]*invR[1][2];
3236  A[1] = J_C[2]*invR[1][1] + J_C[3]*invR[1][2];
3237  h_obj[0][2] = A[0]*invR[1][1] + A[1]*invR[1][2];
3238 
3239  /* dy / dy */
3240  A[0] = J_D[0]*invR[1][1] + J_D[1]*invR[1][2];
3241  A[1] = J_D[1]*invR[1][1] + J_D[2]*invR[1][2];
3242  h_obj[1][1] = A[0]*invR[1][1] + A[1]*invR[1][2];
3243 
3244  /* dy / dz */
3245  A[0] = J_E[0]*invR[1][1] + J_E[1]*invR[1][2];
3246  A[1] = J_E[2]*invR[1][1] + J_E[3]*invR[1][2];
3247  h_obj[1][2] = A[0]*invR[1][1] + A[1]*invR[1][2];
3248 
3249  /* dz / dz */
3250  A[0] = J_F[0]*invR[1][1] + J_F[1]*invR[1][2];
3251  A[1] = J_F[1]*invR[1][1] + J_F[2]*invR[1][2];
3252  h_obj[2][2] = A[0]*invR[1][1] + A[1]*invR[1][2];
3253 
3254  /* Complete diagonal blocks */
3255  h_obj.fill_lower_triangle();
3256  return true;
3257  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool h_gdft_3_v3 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 3259 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_hessian().

3267  {
3268  double matr[9], f, t1, t2;
3269  double matd[9], g, t3, loc1;
3270  double dg[9], dobj_df, dobj_dfdg, dobj_dg, dobj_dgdg;
3271 
3272  /* Calculate M = A*inv(R). */
3273  f = x[1][0] - x[0][0];
3274  g = x[2][0] - x[0][0];
3275  t1 = x[3][0] - x[0][0];
3276  matr[0] = f*invR[0][0];
3277  matr[1] = f*invR[0][1] + g*invR[1][1];
3278  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
3279 
3280  f = x[1][1] - x[0][1];
3281  g = x[2][1] - x[0][1];
3282  t1 = x[3][1] - x[0][1];
3283  matr[3] = f*invR[0][0];
3284  matr[4] = f*invR[0][1] + g*invR[1][1];
3285  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
3286 
3287  f = x[1][2] - x[0][2];
3288  g = x[2][2] - x[0][2];
3289  t1 = x[3][2] - x[0][2];
3290  matr[6] = f*invR[0][0];
3291  matr[7] = f*invR[0][1] + g*invR[1][1];
3292  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
3293 
3294  /* Calculate det(M). */
3295  dg[0] = matr[4]*matr[8] - matr[5]*matr[7];
3296  dg[1] = matr[5]*matr[6] - matr[3]*matr[8];
3297  dg[2] = matr[3]*matr[7] - matr[4]*matr[6];
3298  dg[5] = matr[1]*matr[6] - matr[0]*matr[7];
3299  dg[8] = matr[0]*matr[4] - matr[1]*matr[3];
3300 
3301  t1 = matr[0]*dg[0] + matr[1]*dg[1] + matr[2]*dg[2];
3302 
3303  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
3304 
3305  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
3306  t2 = t1*t1 + 4.0*delta*delta;
3307  t3 = sqrt(t2);
3308  g = t1 + t3;
3309 
3310  /* Calculate N = M - beta*Q. */
3311  matd[0] = matr[0] - beta*Q[0][0];
3312  matd[1] = matr[1] - beta*Q[0][1];
3313  matd[2] = matr[2] - beta*Q[0][2];
3314  matd[3] = matr[3] - beta*Q[1][0];
3315  matd[4] = matr[4] - beta*Q[1][1];
3316  matd[5] = matr[5] - beta*Q[1][2];
3317  matd[6] = matr[6] - beta*Q[2][0];
3318  matd[7] = matr[7] - beta*Q[2][1];
3319  matd[8] = matr[8] - beta*Q[2][2];
3320 
3321  /* Calculate norm(N) */
3322  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
3323  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
3324  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
3325 
3326  /* Calculate objective function. */
3327  loc1 = alpha * pow(2.0, gamma) / pow(g, gamma);
3328  obj = f * loc1;
3329 
3330  /* Calculate the derivative of the objective function. */
3331  t3 = 1.0 / t3;
3332  dobj_df = 2.0 * loc1;
3333  dobj_dg = -gamma * obj * t3;
3334  dobj_dfdg = -gamma * dobj_df * t3;
3335  dobj_dgdg = dobj_dg * ((-gamma - 1.0)*t3 + 4.0*delta*delta/(t2*g));
3336 
3337  /* Construct gradients */
3338  g_obj[0] = invR[2][2]*(dobj_df*matd[2] + dobj_dg*dg[2]);
3339  g_obj[1] = invR[2][2]*(dobj_df*matd[5] + dobj_dg*dg[5]);
3340  g_obj[2] = invR[2][2]*(dobj_df*matd[8] + dobj_dg*dg[8]);
3341 
3342  /* Start of the Hessian evaluation */
3343  t1 = invR[2][2]*invR[2][2];
3344  matd[2] *= dobj_dfdg;
3345  matd[5] *= dobj_dfdg;
3346  matd[8] *= dobj_dfdg;
3347 
3348  /* Blocks for the Hessian construction */
3349  loc1 = dobj_dgdg*dg[2] + matd[2];
3350  h_obj[0][0] = t1*(dobj_df + dg[2]*(matd[2] + loc1));
3351  h_obj[0][1] = t1*(dg[2]*matd[5] + loc1*dg[5]);
3352  h_obj[0][2] = t1*(dg[2]*matd[8] + loc1*dg[8]);
3353 
3354  loc1 = dobj_dgdg*dg[5] + matd[5];
3355  h_obj[1][1] = t1*(dobj_df + dg[5]*(matd[5] + loc1));
3356  h_obj[1][2] = t1*(dg[5]*matd[8] + loc1*dg[8]);
3357 
3358  h_obj[2][2] = t1*(dobj_df + dg[8]*(2.0*matd[8] + dobj_dgdg*dg[8]));
3359 
3360  /* Complete diagonal blocks */
3361  h_obj.fill_lower_triangle();
3362  return true;
3363  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

double inner ( const Vector3D  lhs[],
const Vector3D  rhs[],
int  n 
)
inline

Dot product for arrays of Vector3Ds. see also operator% .

Definition at line 340 of file includeLinks/Vector3D.hpp.

References i, and n.

Referenced by MsqHessian::cg_solver(), and FeasibleNewton::optimize_vertex_positions().

342  {
343  int i;
344  double dot=0;
345  for (i=0; i<n; ++i)
346  dot+= lhs[i].mCoords[0] * rhs[i].mCoords[0] +
347  lhs[i].mCoords[1] * rhs[i].mCoords[1] +
348  lhs[i].mCoords[2] * rhs[i].mCoords[2];
349  return dot;
350  }
NT rhs
blockLoc i
Definition: read.cpp:79
const NT & n

Here is the caller graph for this function:

void inv ( Matrix3D &  Ainv,
const Matrix3D &  A 
)
inline

Definition at line 555 of file includeLinks/Matrix3D.hpp.

References det(), and Matrix3D::v_.

Referenced by circumcenterC3(), RI_DFT::compute_element_analytical_gradient(), I_DFT::compute_element_analytical_gradient(), RI_DFT::compute_element_analytical_hessian(), I_DFT::compute_element_analytical_hessian(), RI_DFT::evaluate_element(), and I_DFT::evaluate_element().

555  {
556  double inv_detA = 1 / (det(A));
557 
558  Ainv[0][0] = inv_detA*( A.v_[4]*A.v_[8]-A.v_[5]*A.v_[7] );
559  Ainv[0][1] = inv_detA*( A.v_[2]*A.v_[7]-A.v_[8]*A.v_[1] );
560  Ainv[0][2] = inv_detA*( A.v_[1]*A.v_[5]-A.v_[4]*A.v_[2] );
561 
562  Ainv[1][0] = inv_detA*( A.v_[5]*A.v_[6]-A.v_[8]*A.v_[3] );
563  Ainv[1][1] = inv_detA*( A.v_[0]*A.v_[8]-A.v_[6]*A.v_[2] );
564  Ainv[1][2] = inv_detA*( A.v_[2]*A.v_[3]-A.v_[5]*A.v_[0] );
565 
566  Ainv[2][0] = inv_detA*( A.v_[3]*A.v_[7]-A.v_[6]*A.v_[4] );
567  Ainv[2][1] = inv_detA*( A.v_[1]*A.v_[6]-A.v_[7]*A.v_[0] );
568  Ainv[2][2] = inv_detA*( A.v_[0]*A.v_[4]-A.v_[3]*A.v_[1] );
569  return;
570  }
rational * A
Definition: vinci_lass.c:67
double det(const Matrix3D &A)

Here is the call graph for this function:

Here is the caller graph for this function:

double length ( Vector3D *const  v,
int  n 
)
inline

Definition at line 400 of file includeLinks/Vector3D.hpp.

References j, n, and sqrt().

Referenced by TerminationCriterion::accumulate_inner(), Rocblas::axpy_gen(), CImg< uintT >::blur_anisotropic(), Rocblas::calc(), Rocblas::calcDot(), MsqHessian::cg_solver(), COM_F_FUNC2(), GeneralizedConditionNumberQualityMetric::compute_condition_number(), MsqMeshEntity::compute_corner_normals(), MsqMeshEntity::compute_unsigned_area(), In_place_list_n< T, managed >::destroy(), CImg< uintT >::draw_arrow(), AspectRatioGammaQualityMetric::evaluate_element(), Rocblas::gen2arg(), init_structured_mesh(), init_unstructure_mesh(), initUnstructuredMesh(), io_hdf_data(), io_pane_connectivity(), main(), In_place_list_n< T, managed >::merge(), SphericalDomain::normal_at(), FeasibleNewton::optimize_vertex_positions(), tpz_ordered::parse_data(), tpz_fequad::parse_data(), Rocmop::perturb_stationary(), Randomize::randomize_vertex(), TerminationCriterion::reset_inner(), HDF4::SDgetdatastrs(), squared_sum(), MesqPane::tag_create(), and MeshTSTTImpl::tag_create().

401  {
402  double l=0;
403  for (int j=0; j<n; ++j)
404  l += v[j].mCoords[0]*v[j].mCoords[0] +
405  v[j].mCoords[1]*v[j].mCoords[1] +
406  v[j].mCoords[2]*v[j].mCoords[2];
407  return msq_stdc::sqrt(l);
408  }
double sqrt(double d)
Definition: double.h:73
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
const NT & n
j indices j
Definition: Indexing.h:6

Here is the call graph for this function:

Here is the caller graph for this function:

double Linf ( Vector3D *const  v,
int  n 
)
inline

Definition at line 409 of file includeLinks/Vector3D.hpp.

References i, max(), and n.

Referenced by ConjugateGradient::optimize_vertex_positions(), and TerminationCriterion::reset_inner().

410  {
411  double max=0;
412  //loop over the length of the array
413  for(int i=0;i<n;++i){
414  if ( max < msq_stdc::fabs(v[i][0]) ) max=msq_stdc::fabs(v[i][0]) ;
415  if ( max < msq_stdc::fabs(v[i][1]) ) max=msq_stdc::fabs(v[i][1]) ;
416  if ( max < msq_stdc::fabs(v[i][2]) ) max=msq_stdc::fabs(v[i][2]) ;
417  }
418  //return the value of the largest entry in the array
419  return max;
420  }
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
blockLoc i
Definition: read.cpp:79
const NT & n

Here is the call graph for this function:

Here is the caller graph for this function:

bool m_fcn_2e ( double &  obj,
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 131 of file includeLinks/MeanRatioFunctions.hpp.

References isqrt3, MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::evaluate_element(), and IdealWeightMeanRatio::evaluate_element().

133 {
134  double matr[9], f;
135  double g;
136 
137  /* Calculate M = [A*inv(W) n] */
138  matr[0] = x[1][0] - x[0][0];
139  matr[1] = (2.0*x[2][0] - x[1][0] - x[0][0])*isqrt3;
140  matr[2] = n[0];
141 
142  matr[3] = x[1][1] - x[0][1];
143  matr[4] = (2.0*x[2][1] - x[1][1] - x[0][1])*isqrt3;
144  matr[5] = n[1];
145 
146  matr[6] = x[1][2] - x[0][2];
147  matr[7] = (2.0*x[2][2] - x[1][2] - x[0][2])*isqrt3;
148  matr[8] = n[2];
149 
150  /* Calculate det(M). */
151  g = matr[0]*(matr[4]*matr[8] - matr[5]*matr[7]) +
152  matr[3]*(matr[2]*matr[7] - matr[1]*matr[8]) +
153  matr[6]*(matr[1]*matr[5] - matr[2]*matr[4]);
154  if (g < MSQ_MIN) { obj = g; return false; }
155 
156  /* Calculate norm(M). */
157  f = matr[0]*matr[0] + matr[1]*matr[1] +
158  matr[3]*matr[3] + matr[4]*matr[4] +
159  matr[6]*matr[6] + matr[7]*matr[7];
160 
161  /* Calculate objective function. */
162  obj = a * pow(f, b) * pow(g, c);
163  return true;
164 }
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool m_fcn_2i ( double &  obj,
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
)
inline

Definition at line 543 of file includeLinks/MeanRatioFunctions.hpp.

References MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::evaluate_element(), and IdealWeightMeanRatio::evaluate_element().

546 {
547  double matr[9];
548  double f;
549  double g;
550 
551  /* Calculate M = A*inv(W). */
552  matr[0] = d[0]*(x[1][0] - x[0][0]);
553  matr[1] = d[1]*(x[2][0] - x[0][0]);
554  matr[2] = n[0];
555 
556  matr[3] = d[0]*(x[1][1] - x[0][1]);
557  matr[4] = d[1]*(x[2][1] - x[0][1]);
558  matr[5] = n[1];
559 
560  matr[6] = d[0]*(x[1][2] - x[0][2]);
561  matr[7] = d[1]*(x[2][2] - x[0][2]);
562  matr[8] = n[2];
563 
564  /* Calculate det(M). */
565  g = matr[0]*(matr[4]*matr[8] - matr[5]*matr[7]) +
566  matr[3]*(matr[2]*matr[7] - matr[1]*matr[8]) +
567  matr[6]*(matr[1]*matr[5] - matr[2]*matr[4]);
568  if (g < MSQ_MIN) { obj = g; return false; }
569 
570  /* Calculate norm(M). */
571  f = matr[0]*matr[0] + matr[1]*matr[1] +
572  matr[3]*matr[3] + matr[4]*matr[4] +
573  matr[6]*matr[6] + matr[7]*matr[7];
574 
575  /* Calculate objective function. */
576  obj = a * pow(f, b) * pow(g, c);
577  return true;
578 }
const NT & d
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool m_fcn_3e ( double &  obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
)
inline

Definition at line 931 of file includeLinks/MeanRatioFunctions.hpp.

References isqrt3, isqrt6, MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::evaluate_element(), and IdealWeightMeanRatio::evaluate_element().

933 {
934  double matr[9], f;
935  double g;
936 
937  /* Calculate M = A*inv(W). */
938  f = x[1][0] + x[0][0];
939  matr[0] = x[1][0] - x[0][0];
940  matr[1] = (2.0*x[2][0] - f)*isqrt3;
941  matr[2] = (3.0*x[3][0] - x[2][0] - f)*isqrt6;
942 
943  f = x[1][1] + x[0][1];
944  matr[3] = x[1][1] - x[0][1];
945  matr[4] = (2.0*x[2][1] - f)*isqrt3;
946  matr[5] = (3.0*x[3][1] - x[2][1] - f)*isqrt6;
947 
948  f = x[1][2] + x[0][2];
949  matr[6] = x[1][2] - x[0][2];
950  matr[7] = (2.0*x[2][2] - f)*isqrt3;
951  matr[8] = (3.0*x[3][2] - x[2][2] - f)*isqrt6;
952 
953  /* Calculate det(M). */
954  g = matr[0]*(matr[4]*matr[8] - matr[5]*matr[7]) +
955  matr[1]*(matr[5]*matr[6] - matr[3]*matr[8]) +
956  matr[2]*(matr[3]*matr[7] - matr[4]*matr[6]);
957  if (g < MSQ_MIN) { obj = g; return false; }
958 
959  /* Calculate norm(M). */
960  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
961  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
962  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
963 
964  /* Calculate objective function. */
965  obj = a * pow(f, b) * pow(g, c);
966  return true;
967 }
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool m_fcn_3i ( double &  obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
)
inline

Definition at line 1855 of file includeLinks/MeanRatioFunctions.hpp.

References MSQ_MIN, and pow().

Referenced by IdealWeightInverseMeanRatio::evaluate_element(), and IdealWeightMeanRatio::evaluate_element().

1858 {
1859  double matr[9], f;
1860  double g;
1861 
1862  /* Calculate M = A*inv(W). */
1863  matr[0] = d[0]*(x[1][0] - x[0][0]);
1864  matr[1] = d[1]*(x[2][0] - x[0][0]);
1865  matr[2] = d[2]*(x[3][0] - x[0][0]);
1866 
1867  matr[3] = d[0]*(x[1][1] - x[0][1]);
1868  matr[4] = d[1]*(x[2][1] - x[0][1]);
1869  matr[5] = d[2]*(x[3][1] - x[0][1]);
1870 
1871  matr[6] = d[0]*(x[1][2] - x[0][2]);
1872  matr[7] = d[1]*(x[2][2] - x[0][2]);
1873  matr[8] = d[2]*(x[3][2] - x[0][2]);
1874 
1875  /* Calculate det(M). */
1876  g = matr[0]*(matr[4]*matr[8] - matr[5]*matr[7]) +
1877  matr[1]*(matr[5]*matr[6] - matr[3]*matr[8]) +
1878  matr[2]*(matr[3]*matr[7] - matr[4]*matr[6]);
1879  if (g < MSQ_MIN) { obj = g; return false; }
1880 
1881  /* Calculate norm(M). */
1882  f = matr[0]*matr[0] + matr[1]*matr[1] + matr[2]*matr[2] +
1883  matr[3]*matr[3] + matr[4]*matr[4] + matr[5]*matr[5] +
1884  matr[6]*matr[6] + matr[7]*matr[7] + matr[8]*matr[8];
1885 
1886  /* Calculate objective function. */
1887  obj = a * pow(f, b) * pow(g, c);
1888  return true;
1889 }
const NT & d
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool m_gdft_2 ( double &  obj,
const Vector3D  x[3],
const Vector3D &  n,
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 0.5,
const Exponent &  gamma = 1.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 147 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient(), I_DFT::compute_element_analytical_hessian(), and I_DFT::evaluate_element().

155  {
156  double matr[9], f, t1, t2;
157  double matd[9], g;
158 
159  /* Calculate M = A*inv(R). */
160  f = x[1][0] - x[0][0];
161  g = x[2][0] - x[0][0];
162  matr[0] = f*invR[0][0];
163  matr[1] = f*invR[0][1] + g*invR[1][1];
164  matr[2] = f*invR[0][2] + g*invR[1][2] + n[0]*invR[2][2];
165 
166  f = x[1][1] - x[0][1];
167  g = x[2][1] - x[0][1];
168  matr[3] = f*invR[0][0];
169  matr[4] = f*invR[0][1] + g*invR[1][1];
170  matr[5] = f*invR[0][2] + g*invR[1][2] + n[1]*invR[2][2];
171 
172  f = x[1][2] - x[0][2];
173  g = x[2][2] - x[0][2];
174  matr[6] = f*invR[0][0];
175  matr[7] = f*invR[0][1] + g*invR[1][1];
176  matr[8] = f*invR[0][2] + g*invR[1][2] + n[2]*invR[2][2];
177 
178  /* Calculate det(M). */
179  t1 = matr[0]*(matr[4]*matr[8] - matr[5]*matr[7]) +
180  matr[3]*(matr[2]*matr[7] - matr[1]*matr[8]) +
181  matr[6]*(matr[1]*matr[5] - matr[2]*matr[4]);
182 
183  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
184 
185  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
186  t2 = sqrt(t1*t1 + 4.0*delta*delta);
187  g = t1 + t2;
188 
189  /* Calculate N = M - beta*Q. */
190  matd[0] = matr[0] - beta*Q[0][0];
191  matd[1] = matr[1] - beta*Q[0][1];
192  matd[2] = matr[2] - beta*Q[0][2];
193  matd[3] = matr[3] - beta*Q[1][0];
194  matd[4] = matr[4] - beta*Q[1][1];
195  matd[5] = matr[5] - beta*Q[1][2];
196  matd[6] = matr[6] - beta*Q[2][0];
197  matd[7] = matr[7] - beta*Q[2][1];
198  matd[8] = matr[8] - beta*Q[2][2];
199 
200  /* Calculate norm(N) */
201  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
202  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
203  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
204 
205  /* Calculate objective function. */
206  obj = alpha * pow(2.0, gamma) * f / pow(g, gamma);
207  return true;
208  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
const NT & n
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool m_gdft_3 ( double &  obj,
const Vector3D  x[4],
const Matrix3D &  invR,
const Matrix3D &  Q,
const double  alpha = 1.0/3.0,
const Exponent &  gamma = 2.0/3.0,
const double  delta = 0.0,
const double  beta = 0.0 
)
inline

Definition at line 643 of file includeLinks/I_DFTFamilyFunctions.hpp.

References MSQ_MIN, pow(), and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient(), I_DFT::compute_element_analytical_hessian(), and I_DFT::evaluate_element().

651  {
652  double matr[9], f, t1, t2;
653  double matd[9], g;
654 
655  /* Calculate M = A*inv(R). */
656  f = x[1][0] - x[0][0];
657  g = x[2][0] - x[0][0];
658  t1 = x[3][0] - x[0][0];
659  matr[0] = f*invR[0][0];
660  matr[1] = f*invR[0][1] + g*invR[1][1];
661  matr[2] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
662 
663  f = x[1][1] - x[0][1];
664  g = x[2][1] - x[0][1];
665  t1 = x[3][1] - x[0][1];
666  matr[3] = f*invR[0][0];
667  matr[4] = f*invR[0][1] + g*invR[1][1];
668  matr[5] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
669 
670  f = x[1][2] - x[0][2];
671  g = x[2][2] - x[0][2];
672  t1 = x[3][2] - x[0][2];
673  matr[6] = f*invR[0][0];
674  matr[7] = f*invR[0][1] + g*invR[1][1];
675  matr[8] = f*invR[0][2] + g*invR[1][2] + t1*invR[2][2];
676 
677  /* Calculate det(M). */
678  t1 = matr[0]*(matr[4]*matr[8] - matr[5]*matr[7]) +
679  matr[3]*(matr[2]*matr[7] - matr[1]*matr[8]) +
680  matr[6]*(matr[1]*matr[5] - matr[2]*matr[4]);
681 
682  if ((0.0 == delta) && (t1 < MSQ_MIN)) { obj = t1; return false; }
683 
684  /* Calculate sqrt(det(M)^2 + 4*delta^2) and denominator. */
685  t2 = sqrt(t1*t1 + 4.0*delta*delta);
686  g = t1 + t2;
687 
688  /* Calculate N = M - beta*Q. */
689  matd[0] = matr[0] - beta*Q[0][0];
690  matd[1] = matr[1] - beta*Q[0][1];
691  matd[2] = matr[2] - beta*Q[0][2];
692  matd[3] = matr[3] - beta*Q[1][0];
693  matd[4] = matr[4] - beta*Q[1][1];
694  matd[5] = matr[5] - beta*Q[1][2];
695  matd[6] = matr[6] - beta*Q[2][0];
696  matd[7] = matr[7] - beta*Q[2][1];
697  matd[8] = matr[8] - beta*Q[2][2];
698 
699  /* Calculate norm(N) */
700  f = matd[0]*matd[0] + matd[1]*matd[1] + matd[2]*matd[2] +
701  matd[3]*matd[3] + matd[4]*matd[4] + matd[5]*matd[5] +
702  matd[6]*matd[6] + matd[7]*matd[7] + matd[8]*matd[8];
703 
704  /* Calculate objective function. */
705  obj = alpha * pow(2.0, gamma) * f / pow(g, gamma);
706  return true;
707  }
double sqrt(double d)
Definition: double.h:73
void int int REAL * x
Definition: read.cpp:74
double pow(double value, const Exponent &exp)

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int major_version_number ( )

Definition at line 46 of file Misc/MesquiteVersion.cpp.

References MSQ_MAJOR_VERSION.

47 {
48  return MSQ_MAJOR_VERSION;
49 }
#define MSQ_MAJOR_VERSION
int matmult ( Matrix3D &  C,
const Matrix3D &  A,
const Matrix3D &  B 
)
inline

$ C = A \times B $

Definition at line 470 of file includeLinks/Matrix3D.hpp.

References i, j, and k.

472  {
473  double sum;
474  const double* row_i;
475  const double* col_k;
476  for (size_t i=0; i<3; ++i)
477  for (size_t k=0; k<3; ++k)
478  {
479  row_i = &(A[i][0]);
480  col_k = &(B[0][k]);
481  sum = 0;
482  for (size_t j=0; j<3; ++j)
483  {
484  sum += *row_i * *col_k;
485  row_i++;
486  col_k += 3;
487  }
488  C[i][k] = sum;
489  }
490  return 0;
491  }
j indices k indices k
Definition: Indexing.h:6
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
unsigned int minor_version_number ( )

Definition at line 51 of file Misc/MesquiteVersion.cpp.

References MSQ_MINOR_VERSION.

52 {
53  return MSQ_MINOR_VERSION;
54 }
#define MSQ_MINOR_VERSION
T Mesquite::MSQ_MAX_2 ( a,
b 
)
inline

Definition at line 178 of file Mesquite.hpp.

178 { return a > b ? a : b; }
T Mesquite::MSQ_MIN_2 ( a,
b 
)
inline

Definition at line 177 of file Mesquite.hpp.

177 { return a < b ? a : b; }
void msq_sigint_handler ( int  )

Definition at line 38 of file Misc/MsqInterrupt.cpp.

References oldHandler, MsqInterrupt::set_handler(), and MsqInterrupt::set_interrupt().

Referenced by MsqInterrupt::set_handler().

39 {
40  MsqInterrupt::set_interrupt();
41  if (oldHandler != SIG_DFL && oldHandler != SIG_IGN)
42  oldHandler( SIGINT );
43  MsqInterrupt::set_handler();
44 }
msq_sig_handler_t oldHandler

Here is the call graph for this function:

Here is the caller graph for this function:

const Matrix3D mult_element ( const Matrix3D &  A,
const Matrix3D &  B 
)
inline

Multiplies entry by entry. This is NOT a matrix multiplication.

Definition at line 312 of file includeLinks/Matrix3D.hpp.

References i.

314  {
315  Matrix3D tmp;
316  size_t i;
317  for (i=0; i<3; ++i) {
318  tmp[i][0] = A[i][0] * B[i][0];
319  tmp[i][1] = A[i][1] * B[i][1];
320  tmp[i][2] = A[i][2] * B[i][2];
321  }
322  return tmp;
323  }
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
bool operator!= ( const Matrix3D &  lhs,
const Matrix3D &  rhs 
)
inline

Definition at line 278 of file includeLinks/Matrix3D.hpp.

References Matrix3D::v_.

279  {
280  return (memcmp(lhs.v_, rhs.v_, 9*sizeof(double)) != 0);
281  }
NT rhs
bool operator!= ( const Vector3D &  v1,
const Vector3D &  v2 
)
inline

Definition at line 442 of file includeLinks/Vector3D.hpp.

References Vector3D::mCoords.

443  { return v1.mCoords[0] != v2.mCoords[0] ||
444  v1.mCoords[1] != v2.mCoords[1] ||
445  v1.mCoords[2] != v2.mCoords[2]; }
double operator% ( const Vector3D &  lhs,
const Vector3D &  rhs 
)
inline

Definition at line 331 of file includeLinks/Vector3D.hpp.

References Vector3D::mCoords.

333  {
334  return( lhs.mCoords[0] * rhs.mCoords[0] +
335  lhs.mCoords[1] * rhs.mCoords[1] +
336  lhs.mCoords[2] * rhs.mCoords[2] );
337  }
NT rhs
double operator% ( const double  scalar,
const Vector3D &  rhs 
)
inline

Definition at line 352 of file includeLinks/Vector3D.hpp.

References Vector3D::mCoords.

354  {
355  return( scalar * (rhs.mCoords[0] + rhs.mCoords[1] + rhs.mCoords[2]) );
356  }
NT rhs
double operator% ( const Vector3D &  lhs,
const double  scalar 
)
inline

Definition at line 357 of file includeLinks/Vector3D.hpp.

References Vector3D::mCoords.

359  {
360  return( scalar * (lhs.mCoords[0] + lhs.mCoords[1] + lhs.mCoords[2]) );
361  }
const Vector3D operator* ( const Vector3D &  lhs,
const double  scalar 
)
inline

Definition at line 309 of file includeLinks/Vector3D.hpp.

References Vector3D::x(), Vector3D::y(), and Vector3D::z().

311  {
312  return Vector3D(lhs.x() * scalar,
313  lhs.y() * scalar,
314  lhs.z() * scalar);
315  }
NVec< 3, double > Vector3D

Here is the call graph for this function:

const Vector3D operator* ( const double  scalar,
const Vector3D &  rhs 
)
inline

Definition at line 316 of file includeLinks/Vector3D.hpp.

References Vector3D::x(), Vector3D::y(), and Vector3D::z().

318  {
319  return Vector3D(rhs.x() * scalar,
320  rhs.y() * scalar,
321  rhs.z() * scalar);
322  }
NT rhs
NVec< 3, double > Vector3D

Here is the call graph for this function:

const Vector3D operator* ( const Vector3D &  lhs,
const Vector3D &  rhs 
)
inline

Definition at line 362 of file includeLinks/Vector3D.hpp.

References Vector3D::mCoords.

364  {
365  return Vector3D(lhs.mCoords[1]*rhs.mCoords[2]-lhs.mCoords[2]*rhs.mCoords[1],
366  lhs.mCoords[2]*rhs.mCoords[0]-lhs.mCoords[0]*rhs.mCoords[2],
367  lhs.mCoords[0]*rhs.mCoords[1]-lhs.mCoords[1]*rhs.mCoords[0]);
368  }
NT rhs
NVec< 3, double > Vector3D
const Matrix3D operator* ( const Matrix3D &  A,
const Matrix3D &  B 
)
inline
Returns
A*B

Definition at line 436 of file includeLinks/Matrix3D.hpp.

References i, j, and k.

438  {
439  Matrix3D tmp;
440  double sum;
441  for (size_t i=0; i<3; ++i)
442  for (size_t k=0; k<3; ++k)
443  {
444  sum = 0;
445  for (size_t j=0; j<3; j++)
446  sum = sum + A[i][j] * B[j][k];
447  tmp[i][k] = sum;
448  }
449  return tmp;
450  }
j indices k indices k
Definition: Indexing.h:6
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
const Matrix3D operator* ( const double &  s,
const Matrix3D &  A 
)
inline

friend function to allow for commutatative property of scalar mulitplication.

Definition at line 463 of file includeLinks/Matrix3D.hpp.

464  {
465  return (A.operator*(s));
466  }
double s
Definition: blastest.C:80
rational * A
Definition: vinci_lass.c:67
const Vector3D operator* ( const Matrix3D &  A,
const Vector3D &  x 
)
inline

Computes $ A v $ .

Definition at line 494 of file includeLinks/Matrix3D.hpp.

References i.

495  {
496  Vector3D tmp; // initializes to 0
497  for (size_t i=0; i<3; ++i)
498  {
499  const double* rowi = A[i];
500  tmp[i] = rowi[0]*x[0] + rowi[1]*x[1] + rowi[2]*x[2];
501  }
502  return tmp;
503  }
rational * A
Definition: vinci_lass.c:67
NVec< 3, double > Vector3D
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
const Vector3D operator* ( const Vector3D &  x,
const Matrix3D &  A 
)
inline

Computes $ v^T A $ .

This function implicitly considers the transpose of vector x times the matrix A and it is implicit that the returned vector must be transposed.

Definition at line 510 of file includeLinks/Matrix3D.hpp.

References i, and j.

511  {
512  Vector3D res(0., 0., 0.);
513  for (size_t i=0; i<3; ++i)
514  {
515  const double* rowi = A[i];
516  for (size_t j=0; j<3; ++j)
517  res[j] += rowi[j] * x[i];
518  }
519  return res;
520  }
rational * A
Definition: vinci_lass.c:67
NVec< 3, double > Vector3D
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
j indices j
Definition: Indexing.h:6
const Matrix3D operator+ ( const Matrix3D &  A,
const Matrix3D &  B 
)
inline
Returns
A+B

Definition at line 284 of file includeLinks/Matrix3D.hpp.

References i.

286  {
287  Matrix3D tmp;
288  size_t i;
289  for (i=0; i<3; ++i) {
290  tmp[i][0] = A[i][0] + B[i][0];
291  tmp[i][1] = A[i][1] + B[i][1];
292  tmp[i][2] = A[i][2] + B[i][2];
293  }
294  return tmp;
295  }
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
const Vector3D operator+ ( const Vector3D &  lhs,
const Vector3D &  rhs 
)
inline

Definition at line 295 of file includeLinks/Vector3D.hpp.

References Vector3D::x(), Vector3D::y(), and Vector3D::z().

297  {
298  return Vector3D(lhs.x() + rhs.x(),
299  lhs.y() + rhs.y(),
300  lhs.z() + rhs.z());
301  }
NT rhs
NVec< 3, double > Vector3D

Here is the call graph for this function:

const Matrix3D operator- ( const Matrix3D &  A,
const Matrix3D &  B 
)
inline
Returns
A-B

Definition at line 298 of file includeLinks/Matrix3D.hpp.

References i.

300  {
301  Matrix3D tmp;
302  size_t i;
303  for (i=0; i<3; ++i) {
304  tmp[i][0] = A[i][0] - B[i][0];
305  tmp[i][1] = A[i][1] - B[i][1];
306  tmp[i][2] = A[i][2] - B[i][2];
307  }
308  return tmp;
309  }
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
const Vector3D operator- ( const Vector3D &  lhs,
const Vector3D &  rhs 
)
inline

Definition at line 302 of file includeLinks/Vector3D.hpp.

References Vector3D::x(), Vector3D::y(), and Vector3D::z().

304  {
305  return Vector3D(lhs.x() - rhs.x(),
306  lhs.y() - rhs.y(),
307  lhs.z() - rhs.z());
308  }
NT rhs
NVec< 3, double > Vector3D

Here is the call graph for this function:

const Vector3D operator/ ( const Vector3D &  lhs,
const double  scalar 
)
inline

Definition at line 323 of file includeLinks/Vector3D.hpp.

References Vector3D::x(), Vector3D::y(), and Vector3D::z().

325  {
326  assert (scalar != 0);
327  return Vector3D(lhs.x() / scalar,
328  lhs.y() / scalar,
329  lhs.z() / scalar);
330  }
NVec< 3, double > Vector3D

Here is the call graph for this function:

msq_stdio::ostream & operator<< ( msq_stdio::ostream &  str,
Mesquite::StopWatchCollection coll 
)

Definition at line 311 of file Misc/MsqTimer.cpp.

References StopWatchCollection::get_keys_sorted_by_time(), StopWatchCollection::get_string(), i, StopWatchCollection::number_of_starts(), and StopWatchCollection::total_time().

313 {
314  msq_std::vector<Mesquite::StopWatchCollection::Key> sorted_keys;
316  int number_of_keys=sorted_keys.size();
317  int i =0;
318  str<<"\nTIME | NUM. STARTS | TIMER NAME ("<<number_of_keys<<" timers)\n";
319  for(i=0;i<number_of_keys;++i){
320  str<<msq_stdio::setiosflags(msq_stdio::ios::left)
321  <<msq_stdio::setw(13)
322  <<Mesquite::GlobalStopWatches.total_time(sorted_keys[i])
323  <<" "
324  <<msq_stdio::setw(13)
326  <<" "
327  <<Mesquite::GlobalStopWatches.get_string(sorted_keys[i])
328  <<msq_stdio::endl;
329  }
330  return str;
331 }
Mesquite::StopWatchCollection GlobalStopWatches
msq_std::string get_string(const Key key)
Gets the string associated with a key.
void get_keys_sorted_by_time(msq_std::vector< Key > &sorted_keys)
blockLoc i
Definition: read.cpp:79
double total_time(const Key key) const
int number_of_starts(const Key key) const

Here is the call graph for this function:

msq_stdio::ostream & operator<< ( msq_stdio::ostream &  s,
const Matrix3D &  A 
)
inline

Definition at line 250 of file includeLinks/Matrix3D.hpp.

References i, j, and s.

251  {
252  for (size_t i=0; i<3; ++i)
253  {
254  for (size_t j=0; j<3; ++j)
255  s << A[i][j] << " ";
256  s << "\n";
257  }
258  return s;
259  }
double s
Definition: blastest.C:80
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
msq_stdio::ostream & operator<< ( msq_stdio::ostream &  s,
const MsqHessian &  h 
)

Prints out the MsqHessian blocks.

Definition at line 507 of file Misc/MsqHessian.cpp.

References i, j, MsqHessian::mColIndex, MsqHessian::mEntries, MsqHessian::mRowStart, MsqHessian::mSize, and s.

508 {
509  size_t i,j;
510  s << "MsqHessian of size: " << h.mSize <<"x"<< h.mSize << "\n";
511  for (i=0; i<h.mSize; ++i) {
512  s << " ROW " << i << " ------------------------\n";
513  for (j=h.mRowStart[i]; j<h.mRowStart[i+1]; ++j) {
514  s << " column " << h.mColIndex[j] << " ----\n";
515  s << h.mEntries[j];
516  }
517  }
518  return s;
519 }
double s
Definition: blastest.C:80
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
msq_stdio::ostream & operator<< ( msq_stdio::ostream &  s,
const Mesquite::Vector3D v 
)

Definition at line 44 of file Misc/Vector3D.cpp.

45 {
46  return s << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' << msq_stdio::endl;
47 }
double s
Definition: blastest.C:80
ostream & operator<< ( ostream &  stream,
const MsqMeshEntity &  entity 
)

Definition at line 919 of file Mesh/MsqMeshEntity.cpp.

References i, MsqMeshEntity::vertex_count(), and MsqMeshEntity::vertexIndices.

920 {
921  size_t num_vert = entity.vertex_count();
922  stream << "MsqMeshEntity " << &entity << " with vertices ";
923  for (size_t i = 0; i < num_vert; ++i)
924  stream << entity.vertexIndices[i] << " ";
925  stream << endl;
926  return stream;
927 }
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

ostream & operator<< ( ostream &  stream,
const PatchData &  pd 
)

Definition at line 1270 of file Mesh/PatchData.cpp.

References PatchData::AVERAGE_DET3D, PatchData::computedInfos, PatchData::domainSet, PatchData::elementArray, PatchData::ELEMENTS_ON_VERTEX_PATCH, PatchData::GLOBAL_PATCH, PatchData::have_computed_info(), PatchData::haveComputedInfos, HEXAHEDRON, i, if(), j, PatchData::MAX_EDGE_LENGTH, PatchData::MAX_UNSIGNED_AREA, PatchData::meshSet, PatchData::MIN_EDGE_LENGTH, PatchData::MIN_UNSIGNED_AREA, PatchData::MINMAX_SIGNED_DET2D, PatchData::MINMAX_SIGNED_DET3D, MsqVertex::MSQ_COORDS_CHANGED, MsqVertex::MSQ_HARD_FIXED, MsqVertex::MSQ_SOFT_FIXED, PatchData::mType, PatchData::num_elements(), PatchData::num_nodes(), PatchData::num_vertices(), POLYGON, POLYHEDRON, PRISM, PYRAMID, QUADRILATERAL, PatchDataMem< X >::size(), TETRAHEDRON, TRIANGLE, PatchData::vertAdjacencyArray, PatchData::vertAdjacencyOffsets, PatchData::vertexArray, and PatchData::VERTICES_ON_VERTEX_PATCH.

1271 {
1272  size_t i;
1273 
1274  stream << "Vertices: " << endl;
1275  for (i = 0; i < pd.num_nodes(); ++i)
1276  {
1277  if (i == pd.num_vertices())
1278  stream << "Higher-Order Nodes: " << endl;
1279 
1280  stream << i << ". ("
1281  << pd.vertexArray[i].x() << ","
1282  << pd.vertexArray[i].y() << ","
1283  << pd.vertexArray[i].z()
1284  << ") ";
1285  if (pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_SOFT_FIXED ))
1286  stream << "S";
1287  if (pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_HARD_FIXED ))
1288  stream << "H";
1289  if (pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_COORDS_CHANGED ))
1290  stream << "C";
1291 
1292  if (pd.vertAdjacencyArray.size())
1293  {
1294  size_t j = pd.vertAdjacencyOffsets[i];
1295  size_t end = pd.vertAdjacencyOffsets[i+1];
1296  for ( ; j < end; ++j )
1297  stream << " " << pd.vertAdjacencyArray[j];
1298  }
1299 
1300  stream << endl;
1301  }
1302 
1303  stream << "Elements: " << endl;
1304  for (i = 0; i < pd.num_elements(); ++i)
1305  {
1306  stream << i << ". ";
1307  switch (pd.elementArray[i].get_element_type()) {
1308  case POLYGON: stream << "Polygon"; break;
1309  case TRIANGLE: stream << "Tri"; break;
1310  case QUADRILATERAL: stream << "Quad"; break;
1311  case POLYHEDRON: stream << "Polyhedron"; break;
1312  case TETRAHEDRON: stream << "Tet"; break;
1313  case HEXAHEDRON: stream << "Hex"; break;
1314  case PRISM: stream << "Wedge"; break;
1315  case PYRAMID: stream << "Pyr"; break;
1316  default: stream << "Unknown"; break;
1317  }
1318  stream << pd.elementArray[i].node_count() << ": ";
1319  for (size_t j = 0; j < pd.elementArray[i].node_count(); ++j)
1320  stream << pd.elementArray[i].get_vertex_index_array()[j] << " ";
1321  stream << endl;
1322  }
1323  stream << endl;
1324 
1325  stream << "MeshSet: " << (pd.meshSet?"yes":"no") << endl;
1326  stream << "domainSet: " << (pd.domainSet?"true":"false") << endl;
1327  stream << "mType: " << (pd.mType==PatchData::VERTICES_ON_VERTEX_PATCH?"vert-on-vert":
1328  pd.mType==PatchData::ELEMENTS_ON_VERTEX_PATCH?"elem-on-vert":
1329  pd.mType==PatchData::GLOBAL_PATCH?"global":"unknown") << endl;
1330 
1331  if (pd.haveComputedInfos)
1332  {
1333  stream << "ComputedInfos:" << endl;
1334  if (pd.have_computed_info(PatchData::MIN_UNSIGNED_AREA))
1335  stream << "\t MIN_UNSINGED_AREA = " << pd.computedInfos[PatchData::MIN_UNSIGNED_AREA] << endl;
1336  if (pd.have_computed_info(PatchData::MAX_UNSIGNED_AREA))
1337  stream << "\t MAX_UNSIGNED_AREA = " << pd.computedInfos[PatchData::MAX_UNSIGNED_AREA] << endl;
1338  if (pd.have_computed_info(PatchData::MIN_EDGE_LENGTH))
1339  stream << "\t MIN_EDGE_LENGTH = " << pd.computedInfos[PatchData::MIN_EDGE_LENGTH] << endl;
1340  if (pd.have_computed_info(PatchData::MAX_EDGE_LENGTH))
1341  stream << "\t MAX_EDGE_LENGTH = " << pd.computedInfos[PatchData::MAX_EDGE_LENGTH] << endl;
1342  if (pd.have_computed_info(PatchData::MINMAX_SIGNED_DET2D))
1343  stream << "\t MINMAX_SIGNED_DET2D = " << pd.computedInfos[PatchData::MINMAX_SIGNED_DET2D] << endl;
1344  if (pd.have_computed_info(PatchData::MINMAX_SIGNED_DET3D))
1345  stream << "\t MINMAX_SIGNED_DET3D = " << pd.computedInfos[PatchData::MINMAX_SIGNED_DET3D] << endl;
1346  if (pd.have_computed_info(PatchData::AVERAGE_DET3D))
1347  stream << "\t AVERAGE_DET3D = " << pd.computedInfos[PatchData::AVERAGE_DET3D] << endl;
1348  }
1349 
1350  return stream << endl;
1351 }
if(dy > dx)
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6

Here is the call graph for this function:

bool operator== ( const Matrix3D &  lhs,
const Matrix3D &  rhs 
)
inline

Definition at line 274 of file includeLinks/Matrix3D.hpp.

References Matrix3D::v_.

275  {
276  return (memcmp(lhs.v_, rhs.v_, 9*sizeof(double)) == 0);
277  }
NT rhs
bool operator== ( const Vector3D &  v1,
const Vector3D &  v2 
)
inline

Definition at line 437 of file includeLinks/Vector3D.hpp.

References Vector3D::mCoords.

438  { return v1.mCoords[0] == v2.mCoords[0] &&
439  v1.mCoords[1] == v2.mCoords[1] &&
440  v1.mCoords[2] == v2.mCoords[2]; }
msq_stdio::istream & operator>> ( msq_stdio::istream &  s,
Matrix3D &  A 
)
inline

Definition at line 261 of file includeLinks/Matrix3D.hpp.

References i, j, and s.

262  {
263  for (size_t i=0; i<3; i++)
264  for (size_t j=0; j<3; j++)
265  {
266  s >> A[i][j];
267  }
268  return s;
269  }
double s
Definition: blastest.C:80
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
void plusEqaA ( Matrix3D &  B,
const double  a,
const Matrix3D &  A 
)
inline

Definition at line 543 of file includeLinks/Matrix3D.hpp.

References Matrix3D::v_.

543  {
544  B.v_[0] += a*A.v_[0]; B.v_[1] += a*A.v_[1]; B.v_[2] += a*A.v_[2];
545  B.v_[3] += a*A.v_[3]; B.v_[4] += a*A.v_[4]; B.v_[5] += a*A.v_[5];
546  B.v_[6] += a*A.v_[6]; B.v_[7] += a*A.v_[7]; B.v_[8] += a*A.v_[8];
547  }
rational * A
Definition: vinci_lass.c:67
void plusEqAx ( Vector3D &  v,
const Matrix3D &  A,
const Vector3D &  x 
)
inline

Definition at line 529 of file includeLinks/Matrix3D.hpp.

References Vector3D::mCoords, and Matrix3D::v_.

Referenced by axpy().

530  {
531  v.mCoords[0] += A.v_[0]*x[0] + A.v_[1]*x.mCoords[1] + A.v_[2]*x.mCoords[2];
532  v.mCoords[1] += A.v_[3]*x[0] + A.v_[4]*x.mCoords[1] + A.v_[5]*x.mCoords[2];
533  v.mCoords[2] += A.v_[6]*x[0] + A.v_[7]*x.mCoords[1] + A.v_[8]*x.mCoords[2];
534  }
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

void plusEqTransAx ( Vector3D &  v,
const Matrix3D &  A,
const Vector3D &  x 
)
inline

Definition at line 536 of file includeLinks/Matrix3D.hpp.

References Vector3D::mCoords, and Matrix3D::v_.

Referenced by axpy().

537  {
538  v.mCoords[0] += A.v_[0]*x.mCoords[0] + A.v_[3]*x.mCoords[1] + A.v_[6]*x.mCoords[2];
539  v.mCoords[1] += A.v_[1]*x.mCoords[0] + A.v_[4]*x.mCoords[1] + A.v_[7]*x.mCoords[2];
540  v.mCoords[2] += A.v_[2]*x.mCoords[0] + A.v_[5]*x.mCoords[1] + A.v_[8]*x.mCoords[2];
541  }
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
rational * A
Definition: vinci_lass.c:67
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

double pow ( double  value,
const Exponent &  exp 
)
inline

Definition at line 89 of file includeLinks/Exponent.hpp.

References Exponent::raise().

Referenced by CImg< uintT >::_draw_ellipse(), QualityMetric::average_metrics(), QualityAssessor::Assessor::calculate_histogram_range(), cbrt(), cbrt_sqr(), IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), Alg_Metric_Base_3::compute_shape(), Alg_Metric_Base_3::compute_skew(), dist(), MVec::distance_between(), CImg< uintT >::draw_axis(), CImg< uintT >::edge_tensors(), CImg< T >::_cimg_math_parser::eval(), sRI_DFT::evaluate_element(), sI_DFT::evaluate_element(), PowerQualityMetric::evaluate_element(), PowerQualityMetric::evaluate_vertex(), g_fcn_2e(), g_fcn_2i(), g_fcn_3e(), g_fcn_3e_v3(), g_fcn_3i(), g_fcn_ridft2(), g_fcn_ridft3(), g_gdft_2(), g_gdft_2_v0(), g_gdft_2_v1(), g_gdft_2_v2(), g_gdft_3(), g_gdft_3_v0(), g_gdft_3_v1(), g_gdft_3_v2(), g_gdft_3_v3(), CImg< uintT >::get_displacement_field(), CImg< uintT >::get_select_graph(), h_fcn_2e(), h_fcn_2i(), h_fcn_3e(), h_fcn_3e_v3(), h_fcn_3i(), h_fcn_ridft2(), h_fcn_ridft3(), h_gdft_2(), h_gdft_2_v0(), h_gdft_2_v1(), h_gdft_2_v2(), h_gdft_3(), h_gdft_3_v0(), h_gdft_3_v1(), h_gdft_3_v2(), h_gdft_3_v3(), TargetCalculator::initialize_default_target_matrices(), CImg< uintT >::LabtoXYZ(), m_fcn_2e(), m_fcn_2i(), m_fcn_3e(), m_fcn_3i(), m_fcn_ridft2(), m_fcn_ridft3(), m_gdft_2(), m_gdft_3(), CImg< uintT >::pow(), CImg< uintT >::RGBtoHSI(), IdealWeightInverseMeanRatio::set_metric_power(), CImg< uintT >::sharpen(), Exponent::std_pow(), and TRAIL_TimeString().

90  { return exp.raise( value ); }
CImg< _cimg_Tfloat > exp(const CImg< T > &instance)
Definition: CImg.h:6016

Here is the call graph for this function:

void print_timing_diagnostics ( int  debugflag)
inline

Definition at line 188 of file includeLinks/MsqTimer.hpp.

References GlobalStopWatches, and MSQ_DBGOUT.

189  { MSQ_DBGOUT(debugflag) << GlobalStopWatches; }
Mesquite::StopWatchCollection GlobalStopWatches
#define MSQ_DBGOUT(flag)
Check debug flag and return ostream associated with flag.
void print_timing_diagnostics ( msq_stdio::ostream &  stream)
inline

Definition at line 191 of file includeLinks/MsqTimer.hpp.

References GlobalStopWatches.

192  { stream << GlobalStopWatches; }
Mesquite::StopWatchCollection GlobalStopWatches
static msq_std::string Mesquite::process_tstt_error ( TSTTB::Error &  tstt_err)
inlinestatic

Definition at line 9 of file src/Mesh/TSTTUtil.hpp.

References MSQ_DBGOUT.

10 {
11  msq_std::string str;
12  msq_std::string result("TSTT ERROR: ");
13  result += tstt_err.getNote();
14  MSQ_DBGOUT(1) << "TSTT Error:" << msq_std::endl;
15  MSQ_DBGOUT(1) << tstt_err.getNote() << msq_std::endl;
16  tstt_err.getDescription(str);
17  MSQ_DBGOUT(1) << str << msq_std::endl;
18  MSQ_DBGOUT(1) << tstt_err.getTrace() << msq_std::endl;
19  return result;
20 }
#define MSQ_DBGOUT(flag)
Check debug flag and return ostream associated with flag.
static msq_std::string Mesquite::process_tstt_error ( TSTTB::Error &  tstt_err)
inlinestatic

Definition at line 9 of file includeLinks/TSTTUtil.hpp.

References MSQ_DBGOUT.

Referenced by MeshTSTTImpl::cache_adjacent_elements(), DomainTSTT::closest_point(), GeomEntTSTT::closest_point(), GeomTSTT::create(), MeshTSTTImpl::element_get_attached_vertex_count(), MeshTSTTImpl::element_get_topology(), MeshTSTTImpl::element_iterator(), MeshTSTTImpl::elements_get_attached_vertices(), MeshTSTTImpl::elements_get_topologies(), MeshTSTTImpl::get_all_mesh(), MeshTSTTImpl::get_all_sizes(), MeshTSTTImpl::get_geometric_dimension(), MeshTSTTImpl::get_vertex_use_count(), MeshTSTTImpl::MeshTSTTImpl(), DomainTSTT::normal_at(), GeomEntTSTT::normal_at(), TSTTIterator::operator++(), TSTTArrIter::operator++(), TSTTIterator::restart(), TSTTArrIter::restart(), MeshTSTTImpl::set_active_set(), MeshTSTTImpl::set_int_tag(), DomainTSTT::snap_to(), GeomEntTSTT::snap_to(), MeshTSTTImpl::tag_create(), MeshTSTTImpl::tag_delete(), MeshTSTTImpl::tag_get(), MeshTSTTImpl::tag_get_data(), MeshTSTTImpl::tag_properties(), MeshTSTTImpl::tag_set_data(), TSTTIterator::TSTTIterator(), MeshTSTTImpl::vertex_get_byte(), MeshTSTTImpl::vertex_is_fixed(), MeshTSTTImpl::vertex_iterator(), MeshTSTTImpl::vertex_set_byte(), MeshTSTTImpl::vertex_set_coordinates(), MeshTSTTImpl::vertices_are_on_boundary(), MeshTSTTImpl::vertices_get_byte(), MeshTSTTImpl::vertices_get_coordinates(), MeshTSTTImpl::vertices_set_byte(), MeshTSTTImpl::~MeshTSTTImpl(), and TSTTArrIter::~TSTTArrIter().

10 {
11  msq_std::string str;
12  msq_std::string result("TSTT ERROR: ");
13  result += tstt_err.getNote();
14  MSQ_DBGOUT(1) << "TSTT Error:" << msq_std::endl;
15  MSQ_DBGOUT(1) << tstt_err.getNote() << msq_std::endl;
16  tstt_err.getDescription(str);
17  MSQ_DBGOUT(1) << str << msq_std::endl;
18  MSQ_DBGOUT(1) << tstt_err.getTrace() << msq_std::endl;
19  return result;
20 }
#define MSQ_DBGOUT(flag)
Check debug flag and return ostream associated with flag.

Here is the caller graph for this function:

void QR ( Matrix3D &  Q,
Matrix3D &  R,
const Matrix3D &  A 
)
inline

Definition at line 593 of file includeLinks/Matrix3D.hpp.

References A, and sqrt().

Referenced by I_DFT::compute_element_analytical_gradient(), I_DFT::compute_element_analytical_hessian(), and I_DFT::evaluate_element().

593  {
594  // Compute the QR factorization of A. This code uses the
595  // Modified Gram-Schmidt method for computing the factorization.
596  // The Householder version is more stable, but costs twice as many
597  // floating point operations.
598 
599  Q = A;
600 
601  R[0][0] = sqrt(Q[0][0]*Q[0][0] + Q[1][0]*Q[1][0] + Q[2][0]*Q[2][0]);
602  R[1][0] = 0.0L;
603  R[2][0] = 0.0L;
604  Q[0][0] /= R[0][0];
605  Q[1][0] /= R[0][0];
606  Q[2][0] /= R[0][0];
607 
608  R[0][1] = Q[0][0]*Q[0][1] + Q[1][0]*Q[1][1] + Q[2][0]*Q[2][1];
609  Q[0][1] -= Q[0][0]*R[0][1];
610  Q[1][1] -= Q[1][0]*R[0][1];
611  Q[2][1] -= Q[2][0]*R[0][1];
612 
613  R[0][2] = Q[0][0]*Q[0][2] + Q[1][0]*Q[1][2] + Q[2][0]*Q[2][2];
614  Q[0][2] -= Q[0][0]*R[0][2];
615  Q[1][2] -= Q[1][0]*R[0][2];
616  Q[2][2] -= Q[2][0]*R[0][2];
617 
618  R[1][1] = sqrt(Q[0][1]*Q[0][1] + Q[1][1]*Q[1][1] + Q[2][1]*Q[2][1]);
619  R[2][1] = 0.0L;
620  Q[0][1] /= R[1][1];
621  Q[1][1] /= R[1][1];
622  Q[2][1] /= R[1][1];
623 
624  R[1][2] = Q[0][1]*Q[0][2] + Q[1][1]*Q[1][2] + Q[2][1]*Q[2][2];
625  Q[0][2] -= Q[0][1]*R[1][2];
626  Q[1][2] -= Q[1][1]*R[1][2];
627  Q[2][2] -= Q[2][1]*R[1][2];
628 
629  R[2][2] = sqrt(Q[0][2]*Q[0][2] + Q[1][2]*Q[1][2] + Q[2][2]*Q[2][2]);
630  Q[0][2] /= R[2][2];
631  Q[1][2] /= R[2][2];
632  Q[2][2] /= R[2][2];
633  return;
634  }
double sqrt(double d)
Definition: double.h:73
rational * A
Definition: vinci_lass.c:67

Here is the call graph for this function:

Here is the caller graph for this function:

Mesquite::ReleaseType release_type ( )

Definition at line 61 of file Misc/MesquiteVersion.cpp.

References ALPHA.

62 {
63  return Mesquite::ALPHA;
64 }
void test_aomd ( void  )
void timesInvA ( Matrix3D &  B,
const Matrix3D &  A 
)
inline

Definition at line 572 of file includeLinks/Matrix3D.hpp.

References det(), and Matrix3D::v_.

Referenced by DistanceFromTarget::compute_T_matrices().

572  {
573 
574  Matrix3D Ainv;
575 
576  double inv_detA = 1 / ( det(A) );
577 
578  Ainv[0][0] = inv_detA*( A.v_[4]*A.v_[8]-A.v_[5]*A.v_[7] );
579  Ainv[0][1] = inv_detA*( A.v_[2]*A.v_[7]-A.v_[8]*A.v_[1] );
580  Ainv[0][2] = inv_detA*( A.v_[1]*A.v_[5]-A.v_[4]*A.v_[2] );
581 
582  Ainv[1][0] = inv_detA*( A.v_[5]*A.v_[6]-A.v_[8]*A.v_[3] );
583  Ainv[1][1] = inv_detA*( A.v_[0]*A.v_[8]-A.v_[6]*A.v_[2] );
584  Ainv[1][2] = inv_detA*( A.v_[2]*A.v_[3]-A.v_[5]*A.v_[0] );
585 
586  Ainv[2][0] = inv_detA*( A.v_[3]*A.v_[7]-A.v_[6]*A.v_[4] );
587  Ainv[2][1] = inv_detA*( A.v_[1]*A.v_[6]-A.v_[7]*A.v_[0] );
588  Ainv[2][2] = inv_detA*( A.v_[0]*A.v_[4]-A.v_[3]*A.v_[1] );
589 
590  B = B*Ainv;
591  }
rational * A
Definition: vinci_lass.c:67
double det(const Matrix3D &A)

Here is the call graph for this function:

Here is the caller graph for this function:

Matrix3D transpose ( const Matrix3D &  A)
inline

Definition at line 335 of file includeLinks/Matrix3D.hpp.

References i.

Referenced by RI_DFT::compute_element_analytical_hessian(), IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), IdealWeightMeanRatio::compute_element_analytical_hessian(), I_DFT::compute_element_analytical_hessian(), and sRI_DFT::evaluate_element().

336  {
337  Matrix3D S;
338  size_t i;
339  for (i=0; i<3; ++i) {
340  S[size_t(0)][i] = A[i][0];
341  S[size_t(1)][i] = A[i][1];
342  S[size_t(2)][i] = A[i][2];
343  }
344  return S;
345  }
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

const char * version_string ( bool  include_build_number = false)

Definition at line 39 of file Misc/MesquiteVersion.cpp.

References MSQ_BUILD_STRING, and MSQ_VERSION_STRING.

Referenced by InstructionQueue::run_instructions().

40 {
41  if (include_build_number)
43  return MSQ_VERSION_STRING;
44 }
#define MSQ_BUILD_STRING
#define MSQ_VERSION_STRING

Here is the caller graph for this function:

size_t vertices_in_topology ( Mesquite::EntityTopology  topo)
inline

Definition at line 530 of file MeshInterface.hpp.

531 {
532  return TopologyInfo::corners( topo );
533 }

Variable Documentation

const int DEFAULT_HISTOGRAM_INTERVALS = 10
const msq_std::vector< size_t > dummy_list
const Vector3D dummy_vtx

Definition at line 38 of file Mesh/MeshImplData.cpp.

Referenced by MeshImplData::get_vertex_coords().

const unsigned long GRAD_FLAGS
Initial value:
= TerminationCriterion::GRADIENT_L2_NORM_ABSOLUTE |
TerminationCriterion::GRADIENT_INF_NORM_ABSOLUTE |
TerminationCriterion::GRADIENT_L2_NORM_RELATIVE |
TerminationCriterion::GRADIENT_INF_NORM_RELATIVE

Definition at line 51 of file Control/TerminationCriterion.cpp.

Referenced by TerminationCriterion::accumulate_inner(), TerminationCriterion::accumulate_outer(), TerminationCriterion::reset_inner(), and TerminationCriterion::reset_outer().

const double MSQ_DBL_MAX = 1.0E30
const int MSQ_HIST_SIZE =7

Definition at line 121 of file Mesquite.hpp.

const int MSQ_INT_MAX = MSQ_UINT_MAX >> 1

Definition at line 141 of file Mesquite.hpp.

const int MSQ_INT_MIN = ~MSQ_INT_MAX

Definition at line 147 of file Mesquite.hpp.

const double MSQ_MAX = MSQ_DBL_MAX

Definition at line 172 of file Mesquite.hpp.

Referenced by NonSmoothSteepestDescent::find_active_set().

const double MSQ_SQRT_THREE_DIV_TWO =MSQ_SQRT_THREE/2.0
static

Definition at line 124 of file Mesquite.hpp.

const double MSQ_SQRT_TWO_DIV_SQRT_THREE =MSQ_SQRT_TWO/MSQ_SQRT_THREE
static

Definition at line 127 of file Mesquite.hpp.

const double MSQ_SQRT_TWO_INV =1.0/MSQ_SQRT_TWO
static

Definition at line 126 of file Mesquite.hpp.

Referenced by MsqMeshEntity::compute_weighted_jacobian().

const double MSQ_TWO_THIRDS = 2.0 / 3.0
static

Definition at line 129 of file Mesquite.hpp.

Referenced by cbrt_sqr(), sI_DFT::evaluate_element(), and I_DFT::I_DFT().

const unsigned MSQ_UINT_MAX = ~(unsigned)0

Definition at line 135 of file Mesquite.hpp.

const unsigned long OF_FLAGS
Initial value:
= TerminationCriterion::QUALITY_IMPROVEMENT_ABSOLUTE |
TerminationCriterion::QUALITY_IMPROVEMENT_RELATIVE |
TerminationCriterion::SUCCESSIVE_IMPROVEMENTS_ABSOLUTE |
TerminationCriterion::SUCCESSIVE_IMPROVEMENTS_RELATIVE

Definition at line 55 of file Control/TerminationCriterion.cpp.

Referenced by TerminationCriterion::accumulate_inner(), TerminationCriterion::accumulate_outer(), TerminationCriterion::reset_inner(), and TerminationCriterion::reset_outer().

const char *const VERTEX_BYTE_TAG_NAME = "MesquiteVertexByte"

The name of the tag (integer) that Mesquite will use to store internal data.

Definition at line 64 of file includeLinks/MeshTSTT.hpp.

Referenced by MeshTSTTImpl::MeshTSTTImpl().

const char *const VERTEX_FIXED_TAG_NAME = "MesquiteVertexFixed"

The name of the tag (integer) Mesquite expects to be non-zero for vertices which are not to be moved by Mesquite.

Definition at line 69 of file includeLinks/MeshTSTT.hpp.

Referenced by MeshTSTTImpl::MeshTSTTImpl().

const char *const vtk_type_names