26#ifndef SCIMATH_SPARSEDIFF_H
27#define SCIMATH_SPARSEDIFF_H
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Mathematics/AutoDiff.h>
32#include <casacore/scimath/Mathematics/SparseDiffRep.h>
33#include <casacore/casa/vector.h>
42 template <
class T>
class SparseDiff;
357 const vector<pair<uInt, T> > &
grad()
const {
return rep_p->grad_p; }
358 vector<pair<uInt, T> > &
grad() {
return rep_p->grad_p; }
365 return rep_p->grad_p[which]; }
390#ifndef CASACORE_NO_AUTO_TEMPLATES
391#include <casacore/scimath/Mathematics/SparseDiff.tcc>
static Bool ltSort(pair< uInt, T > &lhs, pair< uInt, T > &rhs)
Sort criterium.
void sort()
Sort derivative list; cater for doubles and zeroes.
vector< pair< uInt, T > > & derivatives() const
Returns a vector of the derivatives of a SparseDiff.
SparseDiff< T > & operator=(const vector< pair< uInt, T > > &der)
Assignment operator.
void operator*=(const SparseDiff< T > &other)
Assignment operators.
SparseDiff(const T &v, const uInt n)
A function f(x0,x1,...,xn,...) with a value of v.
SparseDiff(const T &v, const uInt n, const T &der)
A function f(x0,x1,...,xn,...) with a value of v.
SparseDiffRep< T > * theRep()
Returns the pointer to the structure of value and derivatives.
void operator/=(const SparseDiff< T > &other)
uInt nDerivatives() const
Return total number of derivatives.
void operator+=(const SparseDiff< T > &other)
SparseDiff< T > & operator=(const AutoDiff< T > &other)
Assign from an Autodiff.
void operator-=(const SparseDiff< T > &other)
pair< uInt, T > & derivative(uInt which)
Returns a specific derivative.
SparseDiff()
Construct a constant with a value of zero.
SparseDiff(const AutoDiff< T > &other)
Construct from an AutoDiff.
const vector< pair< uInt, T > > & grad() const
void operator-=(const T other)
const value_type & const_reference
SparseDiffRep< T > * rep_p
Value representation.
AutoDiff< T > toAutoDiff(uInt n) const
Convert to an AutoDiff of length n
SparseDiff< T > & operator=(const T &v)
Assignment operator.
const SparseDiffRep< T > * theRep() const
SparseDiff(const T &v)
Construct a constant with a value of v.
Bool isConstant() const
Is it a constant, i.e., with zero derivatives?
const pair< uInt, T > & derivative(uInt which) const
T & value()
Returns the value of the function.
SparseDiff(const SparseDiff< T > &other)
Construct one from another (deep copy)
SparseDiff< T > & operator=(const SparseDiff< T > &other)
Assign one to another (deep copy)
SparseDiff< T > & operator=(const pair< uInt, T > &der)
Assignment operator.
vector< pair< uInt, T > > & grad()
void operator+=(const T other)
void operator/=(const T other)
const value_type * const_iterator
void operator*=(const T other)
void derivatives(vector< pair< uInt, T > > &res) const
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.