29 #ifndef SCIMATH_SPARSEDIFF_H
30 #define SCIMATH_SPARSEDIFF_H
45 template <
class T>
class SparseDiff;
279 template <
class T>
class SparseDiff {
359 void derivatives(vector<pair<uInt, T> > &res)
const;
360 const vector<pair<uInt, T> > &
grad()
const {
return rep_p->grad_p; }
361 vector<pair<uInt, T> > &
grad() {
return rep_p->grad_p; }
368 return rep_p->grad_p[which]; }
378 static Bool ltSort(pair<uInt, T> &lhs, pair<uInt, T> &rhs);
393 #ifndef CASACORE_NO_AUTO_TEMPLATES
394 #include <casacore/scimath/Mathematics/SparseDiff.tcc>
395 #endif //# CASACORE_NO_AUTO_TEMPLATES
void operator+=(const SparseDiff< T > &other)
Bool isConstant() const
Is it a constant, i.e., with zero derivatives?
const value_type * const_iterator
Class that computes partial derivatives by automatic differentiation.
const vector< pair< uInt, T > > & grad() const
const value_type & const_reference
vector< pair< uInt, T > > & grad()
void operator+=(const T other)
void operator/=(const T other)
vector< pair< uInt, T > > & derivatives() const
Returns a vector of the derivatives of a SparseDiff.
void operator*=(const T other)
SparseDiff()
Construct a constant with a value of zero.
AutoDiff< T > toAutoDiff(uInt n) const
Convert to an AutoDiff of length n
T & value()
Returns the value of the function.
Representation of data for the spare automatic differentiation calss.
pair< uInt, T > & derivative(uInt which)
Returns a specific derivative.
bool Bool
Define the standard types used by Casacore.
Class that computes partial derivatives by automatic differentiation.
void operator-=(const T other)
const pair< uInt, T > & derivative(uInt which) const
void sort()
Sort derivative list; cater for doubles and zeroes.
const SparseDiffRep< T > * theRep() const
uInt nDerivatives() const
Return total number of derivatives.
SparseDiff< T > & operator=(const T &v)
Assignment operator.
SparseDiffRep< T > * theRep()
Returns the pointer to the structure of value and derivatives.
void operator/=(const SparseDiff< T > &other)
void operator*=(const SparseDiff< T > &other)
Assignment operators.
static Bool ltSort(pair< uInt, T > &lhs, pair< uInt, T > &rhs)
Sort criterium.
void operator-=(const SparseDiff< T > &other)
SparseDiffRep< T > * rep_p
Value representation.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.