Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
Dune::Fufem::SymmetricMatrix< T, N > Class Template Reference

A class implementing a symmetric matrix with compile-time size. More...

#include <dune/fufem/symmetricmatrix.hh>

Public Types

using field_type = T
 The type used for scalars.
 
using Data = Dune::FieldVector< T, N *(N+1)/2 >
 

Public Member Functions

 SymmetricMatrix ()
 Default constructor, creates uninitialized matrix.
 
template<class Iterator >
 SymmetricMatrix (Iterator it)
 Construct from raw memory.
 
SymmetricMatrix< T, N > & operator= (const T &s)
 
SymmetricMatrix< T, N > & operator*= (const T &s)
 
void setEntry (int i, int j, const T &entry)
 Random write access to components.
 
operator() (int i, int j) const
 Matrix style random read access to components.
 
energyScalarProduct (const FieldVector< T, N > &v1, const FieldVector< T, N > &v2) const
 
void axpy (const T &a, const SymmetricMatrix< T, N > &other)
 
frobenius_norm2 () const
 Compute the Frobenius norm of the matrix.
 
frobenius_norm () const
 Compute the Frobenius norm of the matrix.
 
const Datadata () const
 
Datadata ()
 

Static Public Member Functions

static constexpr SymmetricMatrix< T, NidentityMatrix ()
 Construct identityMatrix.
 
static constexpr Data traceMap ()
 return the trace map in vector representation the returned vector is such that <data,a> = trace(A) where A.data = a
 
static constexpr size_t dataSize ()
 Number of scalars needed for compressed vector storage of the symmetric matrix.
 

Detailed Description

template<class T, int N>
class Dune::Fufem::SymmetricMatrix< T, N >

A class implementing a symmetric matrix with compile-time size.

A \( dim\times dim \) matrix is stored internally as a Dune::FieldVector<double, dim*(dim+1)/2> The components are assumed to be \( [ E(1,1),\ E(2,1),\ E(2,2),\ E(3,1),\ E(3,2),\ E(3,3) ]\) and analogous for other dimensions

Template Parameters
dimnumber of lines/columns of the matrix

Member Typedef Documentation

◆ Data

template<class T , int N>
using Dune::Fufem::SymmetricMatrix< T, N >::Data = Dune::FieldVector<T,N*(N+1)/2>

◆ field_type

template<class T , int N>
using Dune::Fufem::SymmetricMatrix< T, N >::field_type = T

The type used for scalars.

Constructor & Destructor Documentation

◆ SymmetricMatrix() [1/2]

template<class T , int N>
Dune::Fufem::SymmetricMatrix< T, N >::SymmetricMatrix ( )
inline

Default constructor, creates uninitialized matrix.

◆ SymmetricMatrix() [2/2]

template<class T , int N>
template<class Iterator >
Dune::Fufem::SymmetricMatrix< T, N >::SymmetricMatrix ( Iterator  it)
inline

Construct from raw memory.

Member Function Documentation

◆ axpy()

template<class T , int N>
void Dune::Fufem::SymmetricMatrix< T, N >::axpy ( const T &  a,
const SymmetricMatrix< T, N > &  other 
)
inline

◆ data() [1/2]

template<class T , int N>
Data & Dune::Fufem::SymmetricMatrix< T, N >::data ( )
inline

◆ data() [2/2]

template<class T , int N>
const Data & Dune::Fufem::SymmetricMatrix< T, N >::data ( ) const
inline

◆ dataSize()

template<class T , int N>
static constexpr size_t Dune::Fufem::SymmetricMatrix< T, N >::dataSize ( )
inlinestaticconstexpr

Number of scalars needed for compressed vector storage of the symmetric matrix.

◆ energyScalarProduct()

template<class T , int N>
T Dune::Fufem::SymmetricMatrix< T, N >::energyScalarProduct ( const FieldVector< T, N > &  v1,
const FieldVector< T, N > &  v2 
) const
inline

◆ frobenius_norm()

template<class T , int N>
T Dune::Fufem::SymmetricMatrix< T, N >::frobenius_norm ( ) const
inline

Compute the Frobenius norm of the matrix.

◆ frobenius_norm2()

template<class T , int N>
T Dune::Fufem::SymmetricMatrix< T, N >::frobenius_norm2 ( ) const
inline

Compute the Frobenius norm of the matrix.

We have a guaranteed isometric mapping between the Frobenius norm of the matrix and the two-norm of the data vector!

◆ identityMatrix()

template<class T , int N>
static constexpr SymmetricMatrix< T, N > Dune::Fufem::SymmetricMatrix< T, N >::identityMatrix ( )
inlinestaticconstexpr

Construct identityMatrix.

◆ operator()()

template<class T , int N>
T Dune::Fufem::SymmetricMatrix< T, N >::operator() ( int  i,
int  j 
) const
inline

Matrix style random read access to components.

Parameters
iline index
jcolumn index The off-diagonal entries are scaled by 1/sqrt(2) to ensure isometry

◆ operator*=()

template<class T , int N>
SymmetricMatrix< T, N > & Dune::Fufem::SymmetricMatrix< T, N >::operator*= ( const T &  s)
inline

◆ operator=()

template<class T , int N>
SymmetricMatrix< T, N > & Dune::Fufem::SymmetricMatrix< T, N >::operator= ( const T &  s)
inline

◆ setEntry()

template<class T , int N>
void Dune::Fufem::SymmetricMatrix< T, N >::setEntry ( int  i,
int  j,
const T &  entry 
)
inline

Random write access to components.

Parameters
iline index
jcolumn index
entryThe value to store as matrix entry The off-diagonal entries are scaled by sqrt(2) to ensure isometry
Note
: You need to know what you are doing: Modifying an off-diagonal entry modifies two entries in the matrix!

◆ traceMap()

template<class T , int N>
static constexpr Data Dune::Fufem::SymmetricMatrix< T, N >::traceMap ( )
inlinestaticconstexpr

return the trace map in vector representation the returned vector is such that <data,a> = trace(A) where A.data = a


The documentation for this class was generated from the following file: