Commit 7e1e1b3f by graeser

### Merge branch 'feature/isometric-symmetric-matrix' into 'master'

```Make symmetrixMatrix isometric

See merge request !47```
parents 409103ac 09c8b4ac
Pipeline #16288 passed with stage
in 69 minutes and 51 seconds
 ... ... @@ -38,6 +38,27 @@ public: data_[i] = *it; } /** \brief Construct identityMatrix */ static constexpr SymmetricMatrix identityMatrix() { SymmetricMatrix id; for( size_t i=0; i = trace(A) where A.data = a */ static constexpr Data traceMap() { // trace(A) = , therefore return data of Id // use isometry! return identityMatrix().data(); } SymmetricMatrix& operator=(const T& s) { data_ = s; ... ... @@ -50,32 +71,36 @@ public: return *this; } /** \brief Matrix style random read/write access to components /** \brief Random write access to components * \param i line index * \param j column index * \note You need to know what you are doing: You can only access the lower * left triangular submatrix using this methods. It requires i>=j. * 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! */ T& operator() (int i, int j) void setEntry(int i, int j, const T& entry) { if( i >= j ) return data_[i*(i+1)/2+j]; else return data_[j*(j+1)/2+i]; if( i > j ) data_[i*(i+1)/2+j] = std::sqrt(2.) * entry; else if ( i < j ) data_[j*(j+1)/2+i] = std::sqrt(2.) * entry; else // ( i == j ) data_[i*(i+1)/2+i] = entry; } /** \brief Matrix style random read access to components * \param i line index * \param j column index * \note You need to know what you are doing: You can only access the lower * left triangular submatrix using this methods. It requires i>=j. * The off-diagonal entries are scaled by 1/sqrt(2) to ensure isometry */ const T& operator() (int i, int j) const T operator() (int i, int j) const { if( i >= j ) return data_[i*(i+1)/2+j]; else return data_[j*(j+1)/2+i]; if( i > j ) return 1./std::sqrt(2.) * data_[i*(i+1)/2+j]; else if ( i < j ) return 1./std::sqrt(2.) * data_[j*(j+1)/2+i]; else // ( i == j ) return data_[i*(i+1)/2+i]; } T energyScalarProduct (const FieldVector& v1, const FieldVector& v2) const ... ... @@ -92,14 +117,11 @@ public: data_.axpy(a,other.data_); } /** \brief Compute the Frobenius norm of the matrix */ /** \brief Compute the Frobenius norm of the matrix * Make use the isometry */ T frobenius_norm2() const { T result = 0; for (size_t i=0; i
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!