File FirstBase.h

Copyright

This code is licensed under the 3-clause BSD license.

Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.

See LICENSE.txt for details.

namespace Scine

This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.

This header contains alias definitions defining which classes to use for the different degrees of derivatives.

namespace Utils
namespace AutomaticDifferentiation

Functions

template<typename DerivativeT, typename Crtp>
Crtp operator+(double v, const FirstBase<DerivativeT, Crtp> &rhs)
template<typename DerivativeT, typename Crtp>
Crtp operator-(double v, const FirstBase<DerivativeT, Crtp> &rhs)
template<typename DerivativeT, typename Crtp>
Crtp operator*(double f, const FirstBase<DerivativeT, Crtp> &rhs)
template<typename DerivativeT, typename Crtp>
Crtp operator/(double f, const FirstBase<DerivativeT, Crtp> &rhs)
template<typename DerivativeT, typename Crtp>
Crtp square(const FirstBase<DerivativeT, Crtp> &value)
template<typename DerivativeT, typename Crtp>
Crtp sqrt(const FirstBase<DerivativeT, Crtp> &value)
template<typename DerivativeT, typename Crtp>
Crtp exp(const FirstBase<DerivativeT, Crtp> &value)
template<typename DerivativeT, typename Crtp>
class FirstBase
#include <FirstBase.h>

Base class representing values with some derivative type and allowing for the automatic calculation of first derivatives.

This class makes use of CRTP so that the functions will directly have the correct return type for the derived classes.

Public Functions

void setValue(double v)

Set the value of the function.

double value() const

Get the value of the function.

Return

double

const DerivativeT &derivatives() const

Get derivatives.

Return

DerivativeT& Object type of derivatives in the derived class.

const Crtp &operator+=(double v)

Definition of operators for differentiation rules.

const Crtp &operator-=(double v)
const Crtp &operator+=(const FirstBase &rhs)
const Crtp &operator-=(const FirstBase &rhs)
const Crtp &operator*=(const FirstBase &rhs)
const Crtp &operator/=(const FirstBase &rhs)
const Crtp &operator*=(double rhs)
const Crtp &operator/=(double rhs)
Crtp operator+() const
Crtp operator-() const
Crtp operator+(double f) const
Crtp operator-(double f) const
Crtp operator+(const FirstBase &rhs) const
Crtp operator-(const FirstBase &rhs) const
Crtp operator*(double f) const
Crtp operator/(double f) const
Crtp operator*(const FirstBase &rhs) const
Crtp operator/(const FirstBase &rhs) const
Crtp opposite() const

Returns the opposite of the derivative.

Return

Crtp Type of the derived class

Protected Functions

FirstBase(double v, DerivativeT d)

Protected Attributes

double v_
DerivativeT d_

Private Functions

Crtp &thisImpl()
const Crtp &thisImpl() const