File MatrixWithDerivatives.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.

template<>
struct MatrixType<derivOrder::one>

Public Types

template<>
using MType = Matrix1
template<>
struct MatrixType<derivOrder::two>

Public Types

template<>
using MType = Matrix2
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

Functions

template<>
MatrixWithDerivatives::Matrix0 &get<derivOrder::zero>()
template<>
MatrixWithDerivatives::Matrix1 &get<derivOrder::one>()
template<>
MatrixWithDerivatives::Matrix2 &get<derivOrder::two>()
template<>
const MatrixWithDerivatives::Matrix0 &get<derivOrder::zero>() const
template<>
const MatrixWithDerivatives::Matrix1 &get<derivOrder::one>() const
template<>
const MatrixWithDerivatives::Matrix2 &get<derivOrder::two>() const
class MatrixWithDerivatives

Container for a matrix and the derivatives of its elements. This class contains 3 matrices: val: contains the 0th order derivative of the elements. der: contains the 1th order derivative of the elements. It is thus a Eigen::Matrix of AutomaticDifferentiation::First3D elements. hes: contains the 2th order derivative of the elements. It is thus a Eigen::Matrix of AutomaticDifferentiation::Second3D elements.

Public Types

using Der0 = double
using Der1 = AutomaticDifferentiation::First3D
using Der2 = AutomaticDifferentiation::Second3D
using Matrix0 = Eigen::MatrixXd
using Matrix1 = Eigen::Matrix<Der1, Eigen::Dynamic, Eigen::Dynamic>
using Matrix2 = Eigen::Matrix<Der2, Eigen::Dynamic, Eigen::Dynamic>
using Matrix = typename MatrixType<o>::MType

Public Functions

MatrixWithDerivatives &operator+(const MatrixWithDerivatives &rhs)
MatrixWithDerivatives &operator+=(const MatrixWithDerivatives &rhs)
MatrixWithDerivatives &operator-(const MatrixWithDerivatives &rhs)
MatrixWithDerivatives &operator-=(const MatrixWithDerivatives &rhs)
MatrixWithDerivatives(int rows = 0, int cols = 0)
void setOrder(derivOrder o)
Der0 &v0(int i1, int i2)
Der1 &v1(int i1, int i2)
Der2 &v2(int i1, int i2)
const Der0 &v0(int i1, int i2) const
const Der1 &v1(int i1, int i2) const
const Der2 &v2(int i1, int i2) const
template<derivOrder O>
Matrix<O> &get()
template<derivOrder O>
const Matrix<O> &get() const
Matrix0 &get0()
Matrix1 &get1()
Matrix2 &get2()
const Matrix0 &get0() const
const Matrix1 &get1() const
const Matrix2 &get2() const
Eigen::MatrixXd getMatrixXd() const

Get a copy of the underlying matrix, without derivatives.

void reset(int dimension)

Alias for setDimension for the case where rows = cols

void setDimension(int rows, int cols)

Initializes the members with dimensions given as parameters.

void setBaseMatrix(const Eigen::MatrixXd &m)

Sets the base matrix to m. Implicitly calls setDimension with correct dimensions.

double getValue(int i, int j) const

Private Members

derivOrder order_
int nCols_ = 0
int nRows_ = 0
Matrix0 val
Matrix1 der
Matrix2 hes
template<derivOrder O>
struct MatrixType

Public Types

template<>
using MType = Matrix0
template<>
struct MatrixType<derivOrder::one>

Public Types

template<>
using MType = Matrix1
template<>
struct MatrixType<derivOrder::two>

Public Types

template<>
using MType = Matrix2