CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::DiffScalarContainer Struct Reference

#include <DiffClexParamPack.hh>

Detailed Description

container struct for storing a standalone value as 2D arrays of both autodiff Scalars doubles

Definition at line 120 of file DiffClexParamPack.hh.

Public Types

using DiffScalar = DiffClexParamPack_impl::DiffScalar
 

Public Member Functions

 DiffScalarContainer (std::string const &_name, Index param_dim, Index num_params, Index _lbegin, bool _independent)
 DiffSclarContainer constructor. More...
 
Eigen::MatrixXd const & grad (Index f) const
 Gradient of dependent function index f wrt the independent variables contained in here. More...
 
Eigen::MatrixXd const & hess (Index f, Index a) const
 Hessian components of dependent function index f corresponding to independent variable index 'a' and all independent variables managed by this. More...
 
void pre_eval (Index N)
 Must be called on each independent parameter before function evaluation if derivatives are desired. More...
 
void post_eval (Index N)
 Must be called on each dependent parameter after function evaluation if derivatives are desired. More...
 
void eval_double ()
 Copy values of autodiff scalars from m_data to m_data_double (matrix of doubles) in preparation for external access. More...
 
Index linear_index_end () const
 Returns one past end of max linear index range allowed for this parameter set. More...
 

Public Attributes

std::string m_name
 Name of the standalone value stored in this container. Should match name of associated key. More...
 
Index lbegin
 linear offset for start of value index in linear array FADBAD forward (backward) autodiff types reference independent (dependent) via a linear index For a particular entry (i,j) into the 2d container for a specific type (e.g., "occ_site_func"), the linear index is defined as l=lbegin+i*m_cache.cols()+j More...
 
bool m_independent
 Flag, set to true if this container holds independent values (false if dependent) More...
 
std::vector< std::vector< DiffScalar > > m_data
 Stored data represented as autodif scalar type. More...
 
Eigen::MatrixXd m_data_double
 Stored data, represented as matrix of doubles. More...
 
Eigen::MatrixXd m_cache
 Derived data cache, represented as matrix of doubles. More...
 

Member Typedef Documentation

◆ DiffScalar

Constructor & Destructor Documentation

◆ DiffScalarContainer()

CASM::DiffScalarContainer::DiffScalarContainer ( std::string const &  _name,
Index  param_dim,
Index  num_params,
Index  _lbegin,
bool  _independent 
)
inline

DiffSclarContainer constructor.

Parameters
_nameName of the standalone value stored in this container, should match name of associated key
param_dimDimension of vector parameter (e.g., 3 for "disp_var"), corresponds to columns of m_data, m_data_double, etc
num_paramsNumber of vector parameters (e.g., 1 for global DoF, number of sites for local DoF), corresponds to rows of m_data, m_data_double, etc

Definition at line 155 of file DiffClexParamPack.hh.

Member Function Documentation

◆ eval_double()

void CASM::DiffScalarContainer::eval_double ( )
inline

Copy values of autodiff scalars from m_data to m_data_double (matrix of doubles) in preparation for external access.

Definition at line 227 of file DiffClexParamPack.hh.

◆ grad()

Eigen::MatrixXd const& CASM::DiffScalarContainer::grad ( Index  f) const
inline

Gradient of dependent function index f wrt the independent variables contained in here.

Parameters
fsecondary identifier denoting linear index of function F(f) among the set F of all dependent variables
Returns
matrix G, with G(i,j) = Grad[F(f)](l(i,j)), where 'l' is linear index of each (i,j) entry in m_data.

Definition at line 173 of file DiffClexParamPack.hh.

◆ hess()

Eigen::MatrixXd const& CASM::DiffScalarContainer::hess ( Index  f,
Index  a 
) const
inline

Hessian components of dependent function index f corresponding to independent variable index 'a' and all independent variables managed by this.

Parameters
fsecondary identifier denoting linear index of function F(f) among the set F of all dependent variables
asecondary identifier denoting linear index of independent variable 'a' amont the set of all independent variables
Returns
matrix H with M(i,j) = H[F(f)](a,l(i,j)), where 'l' is linear index of each (i,j) entry in m_data.

Definition at line 192 of file DiffClexParamPack.hh.

◆ linear_index_end()

Index CASM::DiffScalarContainer::linear_index_end ( ) const
inline

Returns one past end of max linear index range allowed for this parameter set.

Definition at line 237 of file DiffClexParamPack.hh.

◆ post_eval()

void CASM::DiffScalarContainer::post_eval ( Index  N)
inline

Must be called on each dependent parameter after function evaluation if derivatives are desired.

Parameters
Totalnumber of dependent parameters managed by DiffClexParamPack

Definition at line 216 of file DiffClexParamPack.hh.

◆ pre_eval()

void CASM::DiffScalarContainer::pre_eval ( Index  N)
inline

Must be called on each independent parameter before function evaluation if derivatives are desired.

Parameters
Totalnumber of independent parameters managed by DiffClexParamPack

Definition at line 204 of file DiffClexParamPack.hh.

Member Data Documentation

◆ lbegin

Index CASM::DiffScalarContainer::lbegin

linear offset for start of value index in linear array FADBAD forward (backward) autodiff types reference independent (dependent) via a linear index For a particular entry (i,j) into the 2d container for a specific type (e.g., "occ_site_func"), the linear index is defined as l=lbegin+i*m_cache.cols()+j

Definition at line 132 of file DiffClexParamPack.hh.

◆ m_cache

Eigen::MatrixXd CASM::DiffScalarContainer::m_cache
mutable

Derived data cache, represented as matrix of doubles.

Definition at line 146 of file DiffClexParamPack.hh.

◆ m_data

std::vector<std::vector<DiffScalar> > CASM::DiffScalarContainer::m_data

Stored data represented as autodif scalar type.

Definition at line 140 of file DiffClexParamPack.hh.

◆ m_data_double

Eigen::MatrixXd CASM::DiffScalarContainer::m_data_double
mutable

Stored data, represented as matrix of doubles.

Definition at line 143 of file DiffClexParamPack.hh.

◆ m_independent

bool CASM::DiffScalarContainer::m_independent

Flag, set to true if this container holds independent values (false if dependent)

Definition at line 136 of file DiffClexParamPack.hh.

◆ m_name

std::string CASM::DiffScalarContainer::m_name

Name of the standalone value stored in this container. Should match name of associated key.

Definition at line 125 of file DiffClexParamPack.hh.


The documentation for this struct was generated from the following file: