}
-/**
- * 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
}
+//@}
/**
- * 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];
-}
+//@{
/**
/**
- * 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
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)
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
#include <deal.II/base/tensor_deprecated.h>
#endif
+
DEAL_II_NAMESPACE_OPEN
-//@}
/**
* @name Deprecated Tensor operations
*/
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>
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