Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Functions
matrix.h File Reference
#include <array>
#include "gromacs/math/multidimarray.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/real.h"
+ Include dependency graph for matrix.h:
+ This graph shows which files directly or indirectly include this file:

Description

Declares special case of 3x3 matrix frequently used, and associated functions.

Author
Christian Blau cblau.nosp@m.@gwd.nosp@m.g.de

Typedefs

template<class ElementType >
using gmx::BasicMatrix3x3 = MultiDimArray< std::array< ElementType, 3 *3 >, extents< 3, 3 >>
 Three-by-three matrix of ElementType. More...
 
using gmx::Matrix3x3 = BasicMatrix3x3< real >
 Three-by-three real number matrix. More...
 
using gmx::Matrix3x3Span = Matrix3x3::view_type
 Convenience alias for a matrix view.
 
using gmx::Matrix3x3ConstSpan = Matrix3x3::const_view_type
 Convenience alias for a const matrix view.
 

Functions

constexpr real gmx::determinant (Matrix3x3ConstSpan matrix)
 Determinant of a 3x3 matrix.
 
constexpr real gmx::trace (Matrix3x3ConstSpan matrixView)
 Calculates the trace of a 3x3 matrix view.
 
template<typename ElementType , int N, int M = N>
MultiDimArray< std::array
< ElementType, N *M >, extents
< N, M > > 
gmx::diagonalMatrix (const ElementType value)
 Create a diagonal matrix of ElementType with N * M elements. More...
 
template<typename ElementType , int N, int M = N>
MultiDimArray< std::array
< ElementType, N *M >, extents
< N, M > > 
gmx::identityMatrix ()
 Create an identity matrix of ElementType with N * M elements. More...
 
Matrix3x3 gmx::transpose (Matrix3x3ConstSpan matrixView)
 Calculate the transpose of a 3x3 matrix, from its view.
 
void gmx::matrixVectorMultiply (Matrix3x3ConstSpan matrix, RVec *v)
 Multiply matrix with vector.
 
static Matrix3x3 gmx::createMatrix3x3FromLegacyMatrix (const matrix legacyMatrix)
 Create new matrix type from legacy type.
 
static void gmx::fillLegacyMatrix (Matrix3x3ConstSpan newMatrix, matrix legacyMatrix)
 Fill legacy matrix from new matrix type.
 
template<typename ElementType >
BasicVector< ElementType > gmx::multiplyVectorByMatrix (const BasicMatrix3x3< ElementType > &m, const rvec v)
 Return the product of multiplying the vector v by the 3x3 matrix m.
 
template<typename ElementType >
BasicMatrix3x3< ElementType > gmx::operator+ (const BasicMatrix3x3< ElementType > &a, const BasicMatrix3x3< ElementType > &b)
 Return the sum of two 3x3 matrices a and b.
 
template<typename ElementType >
BasicMatrix3x3< ElementType > gmx::operator* (const BasicMatrix3x3< ElementType > &m, const ElementType s)
 Return the product of multiplying the 3x3 matrix m by the scalar s.
 
template<typename ElementType >
BasicMatrix3x3< ElementType > gmx::operator* (const ElementType s, const BasicMatrix3x3< ElementType > &m)
 Return the product of multiplying the 3x3 matrix m by the scalar s.
 
template<typename ElementType >
BasicVector< ElementType > gmx::diagonal (const BasicMatrix3x3< ElementType > &m)
 Return a vector that is the diagonal of the 3x3 matrix m.