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<Utils::derivOrder::one>

Public Types

template<>
using MType = Matrix1
template<>
struct MatrixType<Utils::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<Utils::derivOrder::zero>()
template<>
MatrixWithDerivatives::Matrix1 &get<Utils::derivOrder::one>()
template<>
MatrixWithDerivatives::Matrix2 &get<Utils::derivOrder::two>()
template<>
const MatrixWithDerivatives::Matrix0 &get<Utils::derivOrder::zero>() const
template<>
const MatrixWithDerivatives::Matrix1 &get<Utils::derivOrder::one>() const
template<>
const MatrixWithDerivatives::Matrix2 &get<Utils::derivOrder::two>() const
class MatrixWithDerivatives
#include <MatrixWithDerivatives.h>

Container for a matrix and the derivatives of its elements.

Public Types

using Der0 = double
using Der1 = Utils::AutomaticDifferentiation::First3D
using Der2 = Utils::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(int rows = 0, int cols = 0)
void setOrder(Utils::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<Utils::derivOrder O>
Matrix<O> &get()
template<Utils::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 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

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

Public Types

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

Public Types

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

Public Types

template<>
using MType = Matrix2