本文整理汇总了C++中MultiValue::chainRule方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiValue::chainRule方法的具体用法?C++ MultiValue::chainRule怎么用?C++ MultiValue::chainRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiValue
的用法示例。
在下文中一共展示了MultiValue::chainRule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculate
void SpathVessel::calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_index ) const {
double pp=mymap->getPropertyValue( current, getLabel() ), weight=myvals.get(0);
if( weight<getTolerance() ) return;
unsigned nderivatives=getFinalValue()->getNumberOfDerivatives();
buffer[bufstart] += weight*pp; buffer[bufstart+1+nderivatives] += weight;
if( getAction()->derivativesAreRequired() ) {
myvals.chainRule( 0, 0, 1, 0, pp, bufstart, buffer );
myvals.chainRule( 0, 1, 1, 0, 1.0, bufstart, buffer );
}
}
示例2: calculate
void FunctionVessel::calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ) const {
unsigned nderivatives=getFinalValue()->getNumberOfDerivatives();
double weight=myvals.get(0);
plumed_dbg_assert( weight>=getTolerance() );
// This deals with the value
double dval, f=calcTransform( myvals.get(mycomp), dval );
if( norm ){
if( usetol && weight<getTolerance() ) return;
buffer[bufstart+1+nderivatives] += weight;
if( diffweight ) myvals.chainRule( 0, 1, 1, 0, 1.0, bufstart, buffer );
}
double contr=weight*f;
if( usetol && contr<getTolerance() ) return;
buffer[bufstart] += contr;
if( diffweight ) myvals.chainRule( 0, 0, 1, 0, f, bufstart, buffer );
if( getAction()->derivativesAreRequired() && fabs(dval)>0.0 ) myvals.chainRule( mycomp, 0, 1, 0, weight*dval, bufstart, buffer );
return;
}