16 #ifndef dealii_tensor_h 17 #define dealii_tensor_h 19 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 22 #include <deal.II/base/numbers.h> 23 #include <deal.II/base/table_indices.h> 24 #include <deal.II/base/template_constraints.h> 25 #include <deal.II/base/tensor_accessors.h> 26 #include <deal.II/base/utilities.h> 28 #ifdef DEAL_II_WITH_ADOLC 29 # include <adolc/adouble.h> 37 DEAL_II_NAMESPACE_OPEN
41 template <
int dim,
typename Number>
43 template <
int rank_,
int dim,
typename Number =
double>
45 template <
typename Number>
47 template <
typename Number>
53 template <
int dim,
typename Number>
54 class Tensor<-2, dim, Number>
57 template <
int dim,
typename Number>
58 class Tensor<-1, dim, Number>
93 template <
int dim,
typename Number>
110 static const unsigned int rank = 0;
145 DEAL_II_CUDA_HOST_DEV
153 template <
typename OtherNumber>
159 template <
typename OtherNumber>
160 Tensor(
const OtherNumber &initializer);
196 DEAL_II_CUDA_HOST_DEV
operator Number &();
206 DEAL_II_CUDA_HOST_DEV
operator const Number &()
const;
213 template <
typename OtherNumber>
217 #ifdef __INTEL_COMPILER 232 template <
typename OtherNumber>
239 template <
typename OtherNumber>
246 template <
typename OtherNumber>
253 template <
typename OtherNumber>
260 template <
typename OtherNumber>
269 template <
typename OtherNumber>
270 DEAL_II_CUDA_HOST_DEV
Tensor &
276 template <
typename OtherNumber>
322 template <
class Archive>
324 serialize(Archive &ar,
const unsigned int version);
341 template <
typename OtherNumber>
344 unsigned int & start_index)
const;
349 template <
int,
int,
typename>
396 template <
int rank_,
int dim,
typename Number>
413 static const unsigned int rank = rank_;
441 DEAL_II_CUDA_HOST_DEV
454 template <
typename OtherNumber>
460 template <
typename OtherNumber>
467 template <
typename OtherNumber>
468 operator Tensor<1, dim,
Tensor<rank_ - 1, dim, OtherNumber>>()
const;
524 template <
typename OtherNumber>
540 template <
typename OtherNumber>
547 template <
typename OtherNumber>
554 template <
typename OtherNumber>
561 template <
typename OtherNumber>
571 template <
typename OtherNumber>
572 DEAL_II_CUDA_HOST_DEV
Tensor &
578 template <
typename OtherNumber>
628 template <
typename OtherNumber>
630 unroll(Vector<OtherNumber> &result)
const;
657 template <
class Archive>
659 serialize(Archive &ar,
const unsigned int version);
678 template <
typename OtherNumber>
681 unsigned int & start_index)
const;
686 template <
int,
int,
typename>
712 template <
int rank,
int dim,
typename T>
730 template <
int rank,
int dim,
typename T>
731 struct NumberType<Tensor<rank, dim, VectorizedArray<T>>>
761 template <
int dim,
typename Number>
762 inline DEAL_II_CUDA_HOST_DEV
766 : value(
internal::NumberType<Number>::value(0.0))
771 template <
int dim,
typename Number>
772 template <
typename OtherNumber>
780 template <
int dim,
typename Number>
781 template <
typename OtherNumber>
789 template <
int dim,
typename Number>
793 return std::addressof(value);
798 template <
int dim,
typename Number>
799 inline const Number *
802 return std::addressof(value);
807 template <
int dim,
typename Number>
816 template <
int dim,
typename Number>
817 inline const Number *
825 template <
int dim,
typename Number>
829 #ifndef __CUDA_ARCH__ 831 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
837 template <
int dim,
typename Number>
839 operator
const Number &()
const 842 #ifndef __CUDA_ARCH__ 844 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
850 template <
int dim,
typename Number>
851 template <
typename OtherNumber>
860 #ifdef __INTEL_COMPILER 861 template <
int dim,
typename Number>
871 template <
int dim,
typename Number>
872 template <
typename OtherNumber>
881 template <
int dim,
typename Number>
882 template <
typename OtherNumber>
886 #ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING 887 Assert(!(std::is_same<Number, adouble>::value ||
888 std::is_same<OtherNumber, adouble>::value),
890 "The Tensor equality operator for Adol-C taped numbers has not yet " 891 "been extended to support advanced branching."));
898 template <
int dim,
typename Number>
899 template <
typename OtherNumber>
903 return !((*this) == p);
907 template <
int dim,
typename Number>
908 template <
typename OtherNumber>
917 template <
int dim,
typename Number>
918 template <
typename OtherNumber>
927 template <
int dim,
typename Number>
928 template <
typename OtherNumber>
937 template <
int dim,
typename Number>
938 template <
typename OtherNumber>
947 template <
int dim,
typename Number>
955 template <
int dim,
typename Number>
960 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
965 template <
int dim,
typename Number>
970 #ifndef __CUDA_ARCH__ 972 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
978 template <
int dim,
typename Number>
979 template <
typename OtherNumber>
982 unsigned int & index)
const 985 ExcMessage(
"Cannot unroll an object of type Tensor<0,0,Number>"));
986 result[index] = value;
991 template <
int dim,
typename Number>
1001 template <
int dim,
typename Number>
1002 template <
class Archive>
1013 template <
int rank_,
int dim,
typename Number>
1014 inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
1022 template <
int rank_,
int dim,
typename Number>
1023 inline DEAL_II_ALWAYS_INLINE
1026 for (
unsigned int i = 0; i < dim; ++i)
1031 template <
int rank_,
int dim,
typename Number>
1032 template <
typename OtherNumber>
1033 inline DEAL_II_ALWAYS_INLINE
1037 for (
unsigned int i = 0; i != dim; ++i)
1042 template <
int rank_,
int dim,
typename Number>
1043 template <
typename OtherNumber>
1044 inline DEAL_II_ALWAYS_INLINE
1048 for (
unsigned int i = 0; i < dim; ++i)
1049 values[i] = initializer[i];
1053 template <
int rank_,
int dim,
typename Number>
1054 template <
typename OtherNumber>
1065 namespace TensorSubscriptor
1067 template <
typename ArrayElementType,
int dim>
1068 inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV ArrayElementType &
1069 subscript(ArrayElementType *
values,
1070 const unsigned int i,
1071 std::integral_constant<int, dim>)
1074 #ifndef __CUDA_ARCH__ 1081 template <
typename ArrayElementType>
1083 subscript(ArrayElementType *,
1085 std::integral_constant<int, 0>)
1090 "Cannot access elements of an object of type Tensor<rank,0,Number>."));
1091 static ArrayElementType t;
1098 template <
int rank_,
int dim,
typename Number>
1099 inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
1103 return ::internal::TensorSubscriptor::subscript(
1104 values, i, std::integral_constant<int, dim>());
1108 template <
int rank_,
int dim,
typename Number>
1109 inline DEAL_II_ALWAYS_INLINE
1113 return ::internal::TensorSubscriptor::subscript(
1114 values, i, std::integral_constant<int, dim>());
1118 template <
int rank_,
int dim,
typename Number>
1123 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1125 return TensorAccessors::extract<rank_>(*
this, indices);
1130 template <
int rank_,
int dim,
typename Number>
1135 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1137 return TensorAccessors::extract<rank_>(*
this, indices);
1142 template <
int rank_,
int dim,
typename Number>
1146 return std::addressof(
1152 template <
int rank_,
int dim,
typename Number>
1153 inline const Number *
1156 return std::addressof(
1162 template <
int rank_,
int dim,
typename Number>
1171 template <
int rank_,
int dim,
typename Number>
1172 inline const Number *
1180 template <
int rank_,
int dim,
typename Number>
1181 template <
typename OtherNumber>
1191 template <
int rank_,
int dim,
typename Number>
1196 ExcMessage(
"Only assignment with zero is allowed"));
1199 for (
unsigned int i = 0; i < dim; ++i)
1205 template <
int rank_,
int dim,
typename Number>
1206 template <
typename OtherNumber>
1211 for (
unsigned int i = 0; i < dim; ++i)
1232 template <
int rank_,
int dim,
typename Number>
1233 template <
typename OtherNumber>
1238 return !((*this) == p);
1242 template <
int rank_,
int dim,
typename Number>
1243 template <
typename OtherNumber>
1247 for (
unsigned int i = 0; i < dim; ++i)
1253 template <
int rank_,
int dim,
typename Number>
1254 template <
typename OtherNumber>
1258 for (
unsigned int i = 0; i < dim; ++i)
1264 template <
int rank_,
int dim,
typename Number>
1265 template <
typename OtherNumber>
1269 for (
unsigned int i = 0; i < dim; ++i)
1275 template <
int rank_,
int dim,
typename Number>
1276 template <
typename OtherNumber>
1280 for (
unsigned int i = 0; i < dim; ++i)
1286 template <
int rank_,
int dim,
typename Number>
1292 for (
unsigned int i = 0; i < dim; ++i)
1299 template <
int rank_,
int dim,
typename Number>
1307 template <
int rank_,
int dim,
typename Number>
1313 for (
unsigned int i = 0; i < dim; ++i)
1320 template <
int rank_,
int dim,
typename Number>
1321 template <
typename OtherNumber>
1326 (Utilities::fixed_power<rank_, unsigned int>(dim)));
1328 unsigned int index = 0;
1333 template <
int rank_,
int dim,
typename Number>
1334 template <
typename OtherNumber>
1337 unsigned int & index)
const 1339 for (
unsigned int i = 0; i < dim; ++i)
1344 template <
int rank_,
int dim,
typename Number>
1349 unsigned int index = 0;
1350 for (
int r = 0; r < rank_; ++r)
1351 index = index * dim + indices[r];
1365 mod(
const unsigned int x)
1372 mod<0>(
const unsigned int x)
1380 div(
const unsigned int x)
1387 div<0>(
const unsigned int x)
1397 template <
int rank_,
int dim,
typename Number>
1406 unsigned int remainder = i;
1407 for (
int r = rank_ - 1; r >= 0; --r)
1409 indices[r] = internal::mod<dim>(remainder);
1410 remainder = internal::div<dim>(remainder);
1418 template <
int rank_,
int dim,
typename Number>
1422 for (
unsigned int i = 0; i < dim; ++i)
1427 template <
int rank_,
int dim,
typename Number>
1435 template <
int rank_,
int dim,
typename Number>
1436 template <
class Archive>
1458 template <
int rank_,
int dim,
typename Number>
1459 inline std::ostream &
1460 operator<<(std::ostream &out, const Tensor<rank_, dim, Number> &p)
1462 for (
unsigned int i = 0; i < dim; ++i)
1479 template <
int dim,
typename Number>
1480 inline std::ostream &
1481 operator<<(std::ostream &out, const Tensor<0, dim, Number> &p)
1483 out << static_cast<const Number &>(p);
1503 template <
int dim,
typename Number,
typename Other>
1504 inline DEAL_II_ALWAYS_INLINE
typename ProductType<Other, Number>::type
1507 return object *
static_cast<const Number &
>(t);
1520 template <
int dim,
typename Number,
typename Other>
1521 inline DEAL_II_ALWAYS_INLINE
typename ProductType<Number, Other>::type
1524 return static_cast<const Number &
>(t) *
object;
1537 template <
int dim,
typename Number,
typename OtherNumber>
1538 inline DEAL_II_ALWAYS_INLINE
typename ProductType<Number, OtherNumber>::type
1542 return static_cast<const Number &
>(src1) *
1543 static_cast<const OtherNumber &>(src2);
1552 template <
int dim,
typename Number,
typename OtherNumber>
1553 inline DEAL_II_ALWAYS_INLINE
1560 return static_cast<const Number &
>(t) / factor;
1569 template <
int dim,
typename Number,
typename OtherNumber>
1570 inline DEAL_II_ALWAYS_INLINE
1575 return static_cast<const Number &
>(p) + static_cast<const OtherNumber &>(q);
1584 template <
int dim,
typename Number,
typename OtherNumber>
1585 inline DEAL_II_ALWAYS_INLINE
1590 return static_cast<const Number &
>(p) - static_cast<const OtherNumber &>(q);
1604 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1605 inline DEAL_II_ALWAYS_INLINE
1614 for (
unsigned int d = 0; d < dim; ++d)
1615 tt[d] = t[d] * factor;
1630 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1631 inline DEAL_II_ALWAYS_INLINE
1650 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1660 for (
unsigned int d = 0; d < dim; ++d)
1661 tt[d] = t[d] / factor;
1673 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1674 inline DEAL_II_ALWAYS_INLINE
1681 for (
unsigned int i = 0; i < dim; ++i)
1695 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1696 inline DEAL_II_ALWAYS_INLINE
1703 for (
unsigned int i = 0; i < dim; ++i)
1740 template <
int rank_1,
1744 typename OtherNumber>
1745 inline DEAL_II_ALWAYS_INLINE
1746 typename Tensor<rank_1 + rank_2 - 2,
1748 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1752 typename Tensor<rank_1 + rank_2 - 2,
1754 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1757 TensorAccessors::internal::
1758 ReorderedIndexView<0, rank_2, const Tensor<rank_2, dim, OtherNumber>>
1759 reordered = TensorAccessors::reordered_index_view<0, rank_2>(src2);
1760 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, src1, reordered);
1795 template <
int index_1,
1801 typename OtherNumber>
1802 inline DEAL_II_ALWAYS_INLINE
1803 typename Tensor<rank_1 + rank_2 - 2,
1805 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1809 Assert(0 <= index_1 && index_1 < rank_1,
1811 "The specified index_1 must lie within the range [0,rank_1)"));
1812 Assert(0 <= index_2 && index_2 < rank_2,
1814 "The specified index_2 must lie within the range [0,rank_2)"));
1820 ReorderedIndexView<index_1, rank_1, const Tensor<rank_1, dim, Number>>
1821 reord_01 = reordered_index_view<index_1, rank_1>(src1);
1824 ReorderedIndexView<index_2, rank_2, const Tensor<rank_2, dim, OtherNumber>>
1825 reord_02 = reordered_index_view<index_2, rank_2>(src2);
1827 typename Tensor<rank_1 + rank_2 - 2,
1829 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1831 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, reord_01, reord_02);
1867 template <
int index_1,
1875 typename OtherNumber>
1877 typename Tensor<rank_1 + rank_2 - 4,
1879 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1883 Assert(0 <= index_1 && index_1 < rank_1,
1885 "The specified index_1 must lie within the range [0,rank_1)"));
1886 Assert(0 <= index_3 && index_3 < rank_1,
1888 "The specified index_3 must lie within the range [0,rank_1)"));
1889 Assert(index_1 != index_3,
1890 ExcMessage(
"index_1 and index_3 must not be the same"));
1891 Assert(0 <= index_2 && index_2 < rank_2,
1893 "The specified index_2 must lie within the range [0,rank_2)"));
1894 Assert(0 <= index_4 && index_4 < rank_2,
1896 "The specified index_4 must lie within the range [0,rank_2)"));
1897 Assert(index_2 != index_4,
1898 ExcMessage(
"index_2 and index_4 must not be the same"));
1904 ReorderedIndexView<index_1, rank_1, const Tensor<rank_1, dim, Number>>
1905 reord_1 = TensorAccessors::reordered_index_view<index_1, rank_1>(src1);
1908 ReorderedIndexView<index_2, rank_2, const Tensor<rank_2, dim, OtherNumber>>
1909 reord_2 = TensorAccessors::reordered_index_view<index_2, rank_2>(src2);
1915 (index_3 < index_1 ? index_3 : index_3 - 1),
1927 (index_4 < index_2 ? index_4 : index_4 - 1),
1935 typename Tensor<rank_1 + rank_2 - 4,
1937 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1939 TensorAccessors::contract<2, rank_1, rank_2, dim>(result, reord_3, reord_4);
1957 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1958 inline DEAL_II_ALWAYS_INLINE
typename ProductType<Number, OtherNumber>::type
1962 typename ProductType<Number, OtherNumber>::type result;
1963 TensorAccessors::contract<rank, rank, rank, dim>(result, left, right);
1986 template <
template <
int,
int,
typename>
class TensorT1,
1987 template <
int,
int,
typename>
class TensorT2,
1988 template <
int,
int,
typename>
class TensorT3,
1997 const TensorT2<rank_1 + rank_2, dim, T2> &middle,
1998 const TensorT3<rank_2, dim, T3> & right)
2002 return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(left,
2019 template <
int rank_1,
2023 typename OtherNumber>
2024 inline DEAL_II_ALWAYS_INLINE
2029 typename Tensor<rank_1 + rank_2,
2031 typename ProductType<Number, OtherNumber>::type>
::tensor_type 2033 TensorAccessors::contract<0, rank_1, rank_2, dim>(result, src1, src2);
2056 template <
int dim,
typename Number>
2065 result[1] = -src[0];
2081 template <
int dim,
typename Number>
2090 result[0] = src1[1] * src2[2] - src1[2] * src2[1];
2091 result[1] = src1[2] * src2[0] - src1[0] * src2[2];
2092 result[2] = src1[0] * src2[1] - src1[1] * src2[0];
2111 template <
int dim,
typename Number>
2119 for (
unsigned int k = 0; k < dim; ++k)
2121 Tensor<2, dim - 1, Number> minor;
2122 for (
unsigned int i = 0; i < dim - 1; ++i)
2123 for (
unsigned int j = 0; j < dim - 1; ++j)
2124 minor[i][j] = t[i][j < k ? j : j + 1];
2131 return ((dim % 2 == 0) ? 1. : -1.) * det;
2139 template <
typename Number>
2154 template <
int dim,
typename Number>
2155 inline DEAL_II_ALWAYS_INLINE Number
2159 for (
unsigned int i = 1; i < dim; ++i)
2174 template <
int dim,
typename Number>
2178 Number return_tensor[dim][dim];
2191 template <
typename Number>
2195 Number return_tensor[1][1];
2203 template <
typename Number>
2212 1.0 / (t[0][0] * t[1][1] - t[1][0] * t[0][1]));
2213 return_tensor[0][0] = t[1][1];
2214 return_tensor[0][1] = -t[0][1];
2215 return_tensor[1][0] = -t[1][0];
2216 return_tensor[1][1] = t[0][0];
2217 return_tensor *= inv_det_t;
2219 return return_tensor;
2223 template <
typename Number>
2236 1.0 / (t4 * t[2][2] - t6 * t[2][1] - t8 * t[2][2] +
2237 t00 * t[2][1] + t01 * t[1][2] - t04 * t[1][1]));
2246 return_tensor[1][1] =
2248 return_tensor[1][2] = t00 - t6;
2251 return_tensor[2][1] =
2253 return_tensor[2][2] = internal::NumberType<Number>::value(t4 - t8);
2254 return_tensor *= inv_det_t;
2256 return return_tensor;
2268 template <
int dim,
typename Number>
2273 for (
unsigned int i = 0; i < dim; ++i)
2276 for (
unsigned int j = i + 1; j < dim; ++j)
2299 template <
int dim,
typename Number>
2321 template <
int dim,
typename Number>
2336 template <
int dim,
typename Number>
2341 for (
unsigned int j = 0; j < dim; ++j)
2344 for (
unsigned int i = 0; i < dim; ++i)
2345 sum += std::fabs(t[i][j]);
2362 template <
int dim,
typename Number>
2367 for (
unsigned int i = 0; i < dim; ++i)
2370 for (
unsigned int j = 0; j < dim; ++j)
2371 sum += std::fabs(t[i][j]);
2386 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING 2395 for (
unsigned int j = 0; j < dim; ++j)
2398 for (
unsigned int i = 0; i < dim; ++i)
2399 sum += std::fabs(t[i][j]);
2401 condassign(max, (sum > max), sum, max);
2413 for (
unsigned int i = 0; i < dim; ++i)
2416 for (
unsigned int j = 0; j < dim; ++j)
2417 sum += std::fabs(t[i][j]);
2419 condassign(max, (sum > max), sum, max);
2425 # endif // DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING 2430 DEAL_II_NAMESPACE_CLOSE
2433 #include <deal.II/base/tensor_deprecated.h> Tensor< rank, dim, Number > sum(const Tensor< rank, dim, Number > &local, const MPI_Comm &mpi_communicator)
Number trace(const Tensor< 2, dim, Number > &d)
#define AssertDimension(dim1, dim2)
static unsigned int component_to_unrolled_index(const TableIndices< rank_ > &indices)
Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
static const unsigned int n_independent_components
bool value_is_zero(const Number &value)
Number l1_norm(const Tensor< 2, dim, Number > &t)
static std::size_t memory_consumption()
Tensor< rank_-1, dim, Number > values[(dim!=0)?dim:1]
Tensor & operator/=(const OtherNumber &factor)
Number linfty_norm(const Tensor< 2, dim, Number > &t)
Tensor< 2, dim, Number > adjugate(const Tensor< 2, dim, Number > &t)
Tensor< rank_1+rank_2-2, dim, typename ProductType< Number, OtherNumber >::type >::tensor_type contract(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
typename Tensor< rank_-1, dim, VectorizedArray< Number > >::array_type[(dim!=0)?dim:1] array_type
static const unsigned int rank
numbers::NumberTraits< Number >::real_type norm() const
#define AssertThrow(cond, exc)
static real_type abs(const number &x)
bool operator!=(const Tensor< rank_, dim, OtherNumber > &) const
internal::ReorderedIndexView< index, rank, T > reordered_index_view(T &t)
static::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
Tensor & operator=(const Tensor< rank_, dim, OtherNumber > &rhs)
bool values_are_equal(const Number1 &value_1, const Number2 &value_2)
void unroll(Vector< OtherNumber > &result) const
Tensor & operator*=(const OtherNumber &factor)
Tensor< 2, dim, Number > cofactor(const Tensor< 2, dim, Number > &t)
Tensor< rank_, dim, Number > tensor_type
Tensor< 2, dim, Number > transpose(const Tensor< 2, dim, Number > &t)
static::ExceptionBase & ExcMessage(std::string arg1)
Tensor< rank, dim, typename ProductType< typename EnableIfScalar< Number >::type, OtherNumber >::type > operator*(const Number &factor, const Tensor< rank, dim, OtherNumber > &t)
ProductType< T1, typename ProductType< T2, T3 >::type >::type contract3(const TensorT1< rank_1, dim, T1 > &left, const TensorT2< rank_1+rank_2, dim, T2 > &middle, const TensorT3< rank_2, dim, T3 > &right)
Tensor< 2, dim, Number > invert(const Tensor< 2, dim, Number > &)
static real_type abs_square(const number &x)
Tensor< 1, dim, Number > cross_product_2d(const Tensor< 1, dim, Number > &src)
bool operator==(const Tensor< rank_, dim, OtherNumber > &) const
#define Assert(cond, exc)
ProductType< Number, OtherNumber >::type scalar_product(const Tensor< rank, dim, Number > &left, const Tensor< rank, dim, OtherNumber > &right)
void unroll_recursion(Vector< OtherNumber > &result, unsigned int &start_index) const
Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator+(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
void serialize(Archive &ar, const unsigned int version)
Tensor< 0, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const Tensor< 0, dim, Number > &t, const OtherNumber &factor)
Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
typename Tensor< rank_-1, dim, VectorizedArray< Number > >::tensor_type value_type
value_type & operator[](const unsigned int i)
Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > operator+(const Tensor< rank, dim, Number > &p, const Tensor< rank, dim, OtherNumber > &q)
Tensor & operator-=(const Tensor< rank_, dim, OtherNumber > &)
static TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
Tensor< rank_1+rank_2-4, dim, typename ProductType< Number, OtherNumber >::type >::tensor_type double_contract(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
Tensor< 1, dim, Number > cross_product_3d(const Tensor< 1, dim, Number > &src1, const Tensor< 1, dim, Number > &src2)
typename numbers::NumberTraits< Number >::real_type real_type
Number determinant(const Tensor< 2, dim, Number > &t)
static const unsigned int dimension
Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > operator-(const Tensor< rank, dim, Number > &p, const Tensor< rank, dim, OtherNumber > &q)
ProductType< Other, Number >::type operator*(const Other &object, const Tensor< 0, dim, Number > &t)
static::ExceptionBase & ExcNotImplemented()
ProductType< Number, Other >::type operator*(const Tensor< 0, dim, Number > &t, const Other &object)
ProductType< Number, OtherNumber >::type operator*(const Tensor< 0, dim, Number > &src1, const Tensor< 0, dim, OtherNumber > &src2)
Tensor< rank_1+rank_2, dim, typename ProductType< Number, OtherNumber >::type > outer_product(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
numbers::NumberTraits< Number >::real_type norm_square() const
Tensor & operator+=(const Tensor< rank_, dim, OtherNumber > &)
Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator-(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
Tensor< rank_1+rank_2-2, dim, typename ProductType< Number, OtherNumber >::type >::tensor_type operator*(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
static::ExceptionBase & ExcInternalError()
Number determinant(const Tensor< 2, 1, Number > &t)