]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add determinant function for 3x3 matrices.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 3 Feb 1999 10:16:08 +0000 (10:16 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 3 Feb 1999 10:16:08 +0000 (10:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@753 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/tensor.h

index 4c3ad285f1306eda0359e5b983793afb394573d4..fa679b2cc136e89b336f0c6007dc47a4a2d7b828 100644 (file)
@@ -511,7 +511,24 @@ double determinant (const Tensor<2,2> &t) {
          (t[1][0] * t[0][1]));
 };
 
-    
+
+
+inline
+double determinant (const Tensor<2,3> &t) {
+                                  // get this using Maple:
+                                  // with(linalg);
+                                  // a := matrix(3,3);
+                                  // x := det(a);
+                                  // readlib(C);
+                                  // C(x, optimized);
+  return ( t[0][0]*t[1][1]*t[2][2]
+          -t[0][0]*t[1][2]*t[2][1]
+          -t[1][0]*t[0][1]*t[2][2]
+          +t[1][0]*t[0][2]*t[2][1]
+          +t[2][0]*t[0][1]*t[1][2]
+          -t[2][0]*t[0][2]*t[1][1] );
+};
+
     
     
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.