From d22ab424d70610691524de61da6215e6d43decd1 Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Fri, 29 Sep 2023 15:38:09 +0200
Subject: [PATCH] Don't hand-code the Frobenius norm

Use the corresponding member method of FieldMatrix.
---
 dune/microstructure/matrix_operations.hh | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/dune/microstructure/matrix_operations.hh b/dune/microstructure/matrix_operations.hh
index 3eca389f..83fd5a72 100644
--- a/dune/microstructure/matrix_operations.hh
+++ b/dune/microstructure/matrix_operations.hh
@@ -16,19 +16,6 @@ namespace MatrixOperations {
 	    return Id;
 	}
 	
-	
-    static double norm(VectorRT v){
-		return sqrt(pow(v[0],2) + pow(v[1],2) + pow(v[2],2));
-	}
-
-	static double norm(MatrixRT M){
-		return sqrt(
-			  pow(M[0][0],2) + pow(M[0][1],2) + pow(M[0][2],2)
-			+ pow(M[1][0],2) + pow(M[1][1],2) + pow(M[1][2],2)
-			+ pow(M[2][0],2) + pow(M[2][1],2) + pow(M[2][2],2));
-	}
-	
-
 	// static MatrixRT sym (MatrixRT M) { // 1/2 (M^T + M)
     // 	MatrixRT ret(0);
     // 	for (int i = 0; i< 3; i++)
@@ -210,7 +197,7 @@ namespace MatrixOperations {
     static double QuadraticForm(const double mu, const double lambda, const MatrixRT M){
         
         auto tmp1 = sym(M);
-        double tmp2 = norm(tmp1);
+        double tmp2 = tmp1.frobenius_norm();
 //         double tmp2 = norm(M);                                //TEST 
         return lambda*std::pow(trace(M),2) + 2.0*mu*pow( tmp2 ,2);
 //         return lambda*std::pow(trace(M),2) + 2*mu*pow( norm( sym(M) ),2);
-- 
GitLab