From: wolf Date: Wed, 3 Feb 1999 10:16:08 +0000 (+0000) Subject: Add determinant function for 3x3 matrices. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f55e411cfa0fb635e52d94c32900504ee6646ff4;p=dealii-svn.git Add determinant function for 3x3 matrices. git-svn-id: https://svn.dealii.org/trunk@753 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/tensor.h b/deal.II/base/include/base/tensor.h index 4c3ad285f1..fa679b2cc1 100644 --- a/deal.II/base/include/base/tensor.h +++ b/deal.II/base/include/base/tensor.h @@ -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] ); +}; +