]> https://gitweb.dealii.org/ - dealii.git/commitdiff
tensor.h: Deprecate rank 1 variants of determinant
authorMatthias Maier <tamiko@43-1.org>
Tue, 15 Sep 2015 03:02:50 +0000 (22:02 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 15 Sep 2015 18:28:13 +0000 (13:28 -0500)
We do not implemenent a hyper determinant, or any other generalization of a
determinant. Thus, deprecate this special case.

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

index 71ee4d13dc4c3a42d41d0fe63b9a7b2554f10632..33f52683c769fbdae8ce031ed85c44fe5e625324 100644 (file)
@@ -2048,36 +2048,6 @@ scalar_product (const Tensor<2,dim,Number> &t1,
 }
 
 
-/**
- * Compute the determinant of a tensor of arbitrary rank and dimension one.
- * Since this is a number, the return value is, of course, the number itself.
- *
- * @relates Tensor
- * @author Wolfgang Bangerth, 1998
- */
-template <int rank, typename Number>
-inline
-Number determinant (const Tensor<rank,1,Number> &t)
-{
-  return determinant(t[0]);
-}
-
-
-/**
- * Compute the determinant of a tensor of rank one and dimension one. Since
- * this is a number, the return value is, of course, the number itself.
- *
- * @relates Tensor
- * @author Wolfgang Bangerth, 1998
- */
-template <typename Number>
-inline
-Number determinant (const Tensor<1,1,Number> &t)
-{
-  return t[0];
-}
-
-
 //@}
 /**
  * @name Special operations on tensors of rank 1
@@ -2140,19 +2110,11 @@ cross_product (const Tensor<1,dim,Number> &src1,
 }
 
 
+//@}
 /**
- * Compute the determinant of a tensor of rank two and dimension one. Since
- * this is a number, the return value is, of course, the number itself.
- *
- * @relates Tensor
- * @author Wolfgang Bangerth, 1998
+ * @name Special operations on tensors of rank 2
  */
-template <typename Number>
-inline
-Number determinant (const Tensor<2,1,Number> &t)
-{
-  return t[0][0];
-}
+//@{
 
 
 /**
@@ -2197,8 +2159,7 @@ Number determinant (const Tensor<2,3,Number> &t)
 
 
 /**
- * Compute the determinant of a tensor or rank 2, here for all dimensions for
- * which no explicit specialization is available above.
+ * Compute the determinant of a tensor or rank 2.
  *
  * @relates Tensor
  * @author Wolfgang Bangerth, 2009
@@ -2207,14 +2168,8 @@ template <int dim, typename Number>
 inline
 Number determinant (const Tensor<2,dim,Number> &t)
 {
-  // compute the determinant using the
-  // Laplace expansion of the
-  // determinant. this may not be the most
-  // efficient algorithm, but it does for
-  // small n.
-  //
-  // for some algorithmic simplicity, we use
-  // the expansion along the last row
+  // Compute the determinant using the Laplace expansion of the
+  // determinant. We expand along the last row.
   Number det = 0;
 
   for (unsigned int k=0; k<dim; ++k)
@@ -2233,6 +2188,17 @@ Number determinant (const Tensor<2,dim,Number> &t)
   return std::pow (-1., static_cast<Number>(dim)) * det;
 }
 
+#ifndef DOXYGEN
+// Ground above recursion
+template <typename Number>
+inline
+Number determinant (const Tensor<2,1,Number> &t)
+{
+  return t[0][0];
+}
+#endif
+
+
 
 /**
  * Compute and return the trace of a tensor of rank 2, i.e. the sum of its
@@ -2465,3 +2431,4 @@ DEAL_II_NAMESPACE_CLOSE
 #include <deal.II/base/tensor_deprecated.h>
 
 #endif
+
index b6dfeb343a2667662a139863c9ddeea93e1e73bd..f8eab6f503b8087ef7bc152e2248e9ae490b8981 100644 (file)
@@ -23,7 +23,6 @@
 
 DEAL_II_NAMESPACE_OPEN
 
-//@}
 /**
  * @name Deprecated Tensor operations
  */
@@ -75,8 +74,26 @@ void outer_product (Tensor<1,dim,Number>       &dst,
                     const Tensor<1,dim,Number>  src1,
                     const Number                src2) DEAL_II_DEPRECATED;
 
+/**
+ * @deprecated Do not use this function, evaluate the value manually.
+ * @relates Tensor
+ */
+template <int rank, typename Number>
+inline
+Number determinant (const Tensor<rank,1,Number> &t) DEAL_II_DEPRECATED;
+
+
+/**
+ * @deprecated Do not use this function, evaluate the value manually.
+ * @relates Tensor
+ */
+template <typename Number>
+inline
+Number determinant (const Tensor<1,1,Number> &t) DEAL_II_DEPRECATED;
+
 //@}
 
+
 #ifndef DOXYGEN
 
 template <int dim, typename Number>
@@ -115,6 +132,20 @@ void outer_product (Tensor<1,dim,Number>       &dst,
     dst[i] = src1[i] * src2;
 }
 
+template <int rank, typename Number>
+inline
+Number determinant (const Tensor<rank,1,Number> &t)
+{
+  return determinant(t[0]);
+}
+
+template <typename Number>
+inline
+Number determinant (const Tensor<1,1,Number> &t)
+{
+  return t[0];
+}
+
 #endif /* DOXYGEN */
 
 DEAL_II_NAMESPACE_CLOSE

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.