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 constexpr
unsigned int rank = 0;
145 DEAL_II_CUDA_HOST_DEV
153 template <
typename OtherNumber>
159 template <
typename OtherNumber>
160 Tensor(
const OtherNumber &initializer);
171 constexpr
const Number *
184 constexpr
const Number *
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 constexpr
unsigned int rank = rank_;
441 constexpr DEAL_II_CUDA_HOST_DEV
454 template <
typename OtherNumber>
460 template <
typename OtherNumber>
467 template <
typename OtherNumber>
469 operator Tensor<1, dim,
Tensor<rank_ - 1, dim, OtherNumber>>()
const;
483 constexpr DEAL_II_CUDA_HOST_DEV
const value_type &
505 constexpr
const Number *
517 constexpr
const Number *
525 template <
typename OtherNumber>
541 template <
typename OtherNumber>
548 template <
typename OtherNumber>
555 template <
typename OtherNumber>
562 template <
typename OtherNumber>
572 template <
typename OtherNumber>
573 DEAL_II_CUDA_HOST_DEV
Tensor &
579 template <
typename OtherNumber>
629 template <
typename OtherNumber>
631 unroll(Vector<OtherNumber> &result)
const;
651 static constexpr std::size_t
658 template <
class Archive>
660 serialize(Archive &ar,
const unsigned int version);
679 template <
typename OtherNumber>
682 unsigned int & start_index)
const;
687 template <
int,
int,
typename>
713 template <
int rank,
int dim,
typename T>
731 template <
int rank,
int dim,
typename T>
762 template <
int dim,
typename Number>
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 constexpr
const Number *
802 return std::addressof(value);
807 template <
int dim,
typename Number>
816 template <
int dim,
typename Number>
817 constexpr
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>
930 namespace ComplexWorkaround
932 template <
typename Number,
typename OtherNumber>
933 inline DEAL_II_CUDA_HOST_DEV
void 934 multiply_assign_scalar(Number &val,
const OtherNumber &s)
940 template <
typename Number,
typename OtherNumber>
941 inline DEAL_II_CUDA_HOST_DEV
void 942 multiply_assign_scalar(std::complex<Number> &,
const OtherNumber &)
944 printf(
"This function is not implemented for std::complex<Number>!\n");
952 template <
int dim,
typename Number>
953 template <
typename OtherNumber>
957 internal::ComplexWorkaround::multiply_assign_scalar(value, s);
963 template <
int dim,
typename Number>
964 template <
typename OtherNumber>
973 template <
int dim,
typename Number>
981 template <
int dim,
typename Number>
986 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
991 template <
int dim,
typename Number>
996 #ifndef __CUDA_ARCH__ 998 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1004 template <
int dim,
typename Number>
1005 template <
typename OtherNumber>
1008 unsigned int & index)
const 1011 ExcMessage(
"Cannot unroll an object of type Tensor<0,0,Number>"));
1012 result[index] = value;
1017 template <
int dim,
typename Number>
1027 template <
int dim,
typename Number>
1028 template <
class Archive>
1039 template <
int rank_,
int dim,
typename Number>
1040 inline DEAL_II_ALWAYS_INLINE
1043 for (
unsigned int i = 0; i < dim; ++i)
1048 template <
int rank_,
int dim,
typename Number>
1049 template <
typename OtherNumber>
1050 inline DEAL_II_ALWAYS_INLINE
1054 for (
unsigned int i = 0; i != dim; ++i)
1059 template <
int rank_,
int dim,
typename Number>
1060 template <
typename OtherNumber>
1061 inline DEAL_II_ALWAYS_INLINE
1065 for (
unsigned int i = 0; i < dim; ++i)
1066 values[i] = initializer[i];
1070 template <
int rank_,
int dim,
typename Number>
1071 template <
typename OtherNumber>
1075 return Tensor<1, dim,
Tensor<rank_ - 1, dim, Number>>(values);
1082 namespace TensorSubscriptor
1084 template <
typename ArrayElementType,
int dim>
1085 inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV ArrayElementType &
1086 subscript(ArrayElementType * values,
1087 const unsigned int i,
1088 std::integral_constant<int, dim>)
1091 #ifndef __CUDA_ARCH__ 1098 template <
typename ArrayElementType>
1100 subscript(ArrayElementType *,
1102 std::integral_constant<int, 0>)
1107 "Cannot access elements of an object of type Tensor<rank,0,Number>."));
1108 static ArrayElementType t;
1115 template <
int rank_,
int dim,
typename Number>
1116 inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
1120 return ::internal::TensorSubscriptor::subscript(
1121 values, i, std::integral_constant<int, dim>());
1125 template <
int rank_,
int dim,
typename Number>
1126 constexpr DEAL_II_ALWAYS_INLINE
1130 return ::internal::TensorSubscriptor::subscript(
1131 values, i, std::integral_constant<int, dim>());
1135 template <
int rank_,
int dim,
typename Number>
1140 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1142 return TensorAccessors::extract<rank_>(*
this, indices);
1147 template <
int rank_,
int dim,
typename Number>
1152 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1154 return TensorAccessors::extract<rank_>(*
this, indices);
1159 template <
int rank_,
int dim,
typename Number>
1163 return std::addressof(
1164 this->
operator[](this->unrolled_to_component_indices(0)));
1169 template <
int rank_,
int dim,
typename Number>
1170 constexpr
const Number *
1173 return std::addressof(
1174 this->
operator[](this->unrolled_to_component_indices(0)));
1179 template <
int rank_,
int dim,
typename Number>
1183 return begin_raw() + n_independent_components;
1188 template <
int rank_,
int dim,
typename Number>
1189 constexpr
const Number *
1192 return begin_raw() + n_independent_components;
1197 template <
int rank_,
int dim,
typename Number>
1198 template <
typename OtherNumber>
1203 std::copy(&t.
values[0], &t.
values[0] + dim, &values[0]);
1208 template <
int rank_,
int dim,
typename Number>
1213 ExcMessage(
"Only assignment with zero is allowed"));
1216 for (
unsigned int i = 0; i < dim; ++i)
1222 template <
int rank_,
int dim,
typename Number>
1223 template <
typename OtherNumber>
1228 for (
unsigned int i = 0; i < dim; ++i)
1229 if (values[i] != p.
values[i])
1249 template <
int rank_,
int dim,
typename Number>
1250 template <
typename OtherNumber>
1255 return !((*this) == p);
1259 template <
int rank_,
int dim,
typename Number>
1260 template <
typename OtherNumber>
1264 for (
unsigned int i = 0; i < dim; ++i)
1265 values[i] += p.
values[i];
1270 template <
int rank_,
int dim,
typename Number>
1271 template <
typename OtherNumber>
1275 for (
unsigned int i = 0; i < dim; ++i)
1276 values[i] -= p.
values[i];
1281 template <
int rank_,
int dim,
typename Number>
1282 template <
typename OtherNumber>
1286 for (
unsigned int i = 0; i < dim; ++i)
1292 template <
int rank_,
int dim,
typename Number>
1293 template <
typename OtherNumber>
1297 for (
unsigned int i = 0; i < dim; ++i)
1303 template <
int rank_,
int dim,
typename Number>
1309 for (
unsigned int i = 0; i < dim; ++i)
1310 tmp.
values[i] = -values[i];
1316 template <
int rank_,
int dim,
typename Number>
1320 return std::sqrt(norm_square());
1324 template <
int rank_,
int dim,
typename Number>
1330 for (
unsigned int i = 0; i < dim; ++i)
1331 s += values[i].norm_square();
1337 template <
int rank_,
int dim,
typename Number>
1338 template <
typename OtherNumber>
1343 (Utilities::fixed_power<rank_, unsigned int>(dim)));
1345 unsigned int index = 0;
1346 unroll_recursion(result, index);
1350 template <
int rank_,
int dim,
typename Number>
1351 template <
typename OtherNumber>
1354 unsigned int & index)
const 1356 for (
unsigned int i = 0; i < dim; ++i)
1357 values[i].unroll_recursion(result, index);
1361 template <
int rank_,
int dim,
typename Number>
1366 unsigned int index = 0;
1367 for (
int r = 0; r < rank_; ++r)
1368 index = index * dim + indices[r];
1382 mod(
const unsigned int x)
1389 mod<0>(
const unsigned int x)
1397 div(
const unsigned int x)
1404 div<0>(
const unsigned int x)
1414 template <
int rank_,
int dim,
typename Number>
1418 Assert(i < n_independent_components,
1423 unsigned int remainder = i;
1424 for (
int r = rank_ - 1; r >= 0; --r)
1426 indices[r] = internal::mod<dim>(remainder);
1427 remainder = internal::div<dim>(remainder);
1435 template <
int rank_,
int dim,
typename Number>
1439 for (
unsigned int i = 0; i < dim; ++i)
1444 template <
int rank_,
int dim,
typename Number>
1445 constexpr std::size_t
1452 template <
int rank_,
int dim,
typename Number>
1453 template <
class Archive>
1475 template <
int rank_,
int dim,
typename Number>
1476 inline std::ostream &
1477 operator<<(std::ostream &out, const Tensor<rank_, dim, Number> &p)
1479 for (
unsigned int i = 0; i < dim; ++i)
1496 template <
int dim,
typename Number>
1497 inline std::ostream &
1498 operator<<(std::ostream &out, const Tensor<0, dim, Number> &p)
1500 out << static_cast<const Number &>(p);
1520 template <
int dim,
typename Number,
typename Other>
1521 constexpr DEAL_II_ALWAYS_INLINE
typename ProductType<Other, Number>::type
1524 return object *
static_cast<const Number &
>(t);
1537 template <
int dim,
typename Number,
typename Other>
1538 constexpr DEAL_II_ALWAYS_INLINE
typename ProductType<Number, Other>::type
1541 return static_cast<const Number &
>(t) *
object;
1554 template <
int dim,
typename Number,
typename OtherNumber>
1555 constexpr DEAL_II_ALWAYS_INLINE
typename ProductType<Number, OtherNumber>::type
1559 return static_cast<const Number &
>(src1) *
1560 static_cast<const OtherNumber &>(src2);
1569 template <
int dim,
typename Number,
typename OtherNumber>
1570 constexpr DEAL_II_ALWAYS_INLINE
1577 return static_cast<const Number &
>(t) / factor;
1586 template <
int dim,
typename Number,
typename OtherNumber>
1587 constexpr DEAL_II_ALWAYS_INLINE
1592 return static_cast<const Number &
>(p) + static_cast<const OtherNumber &>(q);
1601 template <
int dim,
typename Number,
typename OtherNumber>
1602 constexpr DEAL_II_ALWAYS_INLINE
1607 return static_cast<const Number &
>(p) - static_cast<const OtherNumber &>(q);
1621 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1622 inline DEAL_II_ALWAYS_INLINE
1631 for (
unsigned int d = 0; d < dim; ++d)
1632 tt[d] = t[d] * factor;
1647 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1648 constexpr DEAL_II_ALWAYS_INLINE
1667 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1677 for (
unsigned int d = 0; d < dim; ++d)
1678 tt[d] = t[d] / factor;
1690 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1691 inline DEAL_II_ALWAYS_INLINE
1698 for (
unsigned int i = 0; i < dim; ++i)
1712 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1713 inline DEAL_II_ALWAYS_INLINE
1720 for (
unsigned int i = 0; i < dim; ++i)
1757 template <
int rank_1,
1761 typename OtherNumber>
1762 inline DEAL_II_ALWAYS_INLINE
1763 typename Tensor<rank_1 + rank_2 - 2,
1765 typename ProductType<Number, OtherNumber>::type>::tensor_type
1769 typename Tensor<rank_1 + rank_2 - 2,
1771 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1774 TensorAccessors::internal::
1775 ReorderedIndexView<0, rank_2, const Tensor<rank_2, dim, OtherNumber>>
1776 reordered = TensorAccessors::reordered_index_view<0, rank_2>(src2);
1777 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, src1, reordered);
1812 template <
int index_1,
1818 typename OtherNumber>
1819 inline DEAL_II_ALWAYS_INLINE
1820 typename Tensor<rank_1 + rank_2 - 2,
1822 typename ProductType<Number, OtherNumber>::type>::tensor_type
1826 Assert(0 <= index_1 && index_1 < rank_1,
1828 "The specified index_1 must lie within the range [0,rank_1)"));
1829 Assert(0 <= index_2 && index_2 < rank_2,
1831 "The specified index_2 must lie within the range [0,rank_2)"));
1837 ReorderedIndexView<index_1, rank_1, const Tensor<rank_1, dim, Number>>
1838 reord_01 = reordered_index_view<index_1, rank_1>(src1);
1841 ReorderedIndexView<index_2, rank_2, const Tensor<rank_2, dim, OtherNumber>>
1842 reord_02 = reordered_index_view<index_2, rank_2>(src2);
1844 typename Tensor<rank_1 + rank_2 - 2,
1846 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1848 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, reord_01, reord_02);
1884 template <
int index_1,
1892 typename OtherNumber>
1894 typename Tensor<rank_1 + rank_2 - 4,
1896 typename ProductType<Number, OtherNumber>::type>::tensor_type
1900 Assert(0 <= index_1 && index_1 < rank_1,
1902 "The specified index_1 must lie within the range [0,rank_1)"));
1903 Assert(0 <= index_3 && index_3 < rank_1,
1905 "The specified index_3 must lie within the range [0,rank_1)"));
1906 Assert(index_1 != index_3,
1907 ExcMessage(
"index_1 and index_3 must not be the same"));
1908 Assert(0 <= index_2 && index_2 < rank_2,
1910 "The specified index_2 must lie within the range [0,rank_2)"));
1911 Assert(0 <= index_4 && index_4 < rank_2,
1913 "The specified index_4 must lie within the range [0,rank_2)"));
1914 Assert(index_2 != index_4,
1915 ExcMessage(
"index_2 and index_4 must not be the same"));
1921 ReorderedIndexView<index_1, rank_1, const Tensor<rank_1, dim, Number>>
1922 reord_1 = TensorAccessors::reordered_index_view<index_1, rank_1>(src1);
1925 ReorderedIndexView<index_2, rank_2, const Tensor<rank_2, dim, OtherNumber>>
1926 reord_2 = TensorAccessors::reordered_index_view<index_2, rank_2>(src2);
1932 (index_3 < index_1 ? index_3 : index_3 - 1),
1944 (index_4 < index_2 ? index_4 : index_4 - 1),
1952 typename Tensor<rank_1 + rank_2 - 4,
1954 typename ProductType<Number, OtherNumber>::type>
::tensor_type 1956 TensorAccessors::contract<2, rank_1, rank_2, dim>(result, reord_3, reord_4);
1974 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1975 inline DEAL_II_ALWAYS_INLINE
typename ProductType<Number, OtherNumber>::type
1979 typename ProductType<Number, OtherNumber>::type result;
1980 TensorAccessors::contract<rank, rank, rank, dim>(result, left, right);
2003 template <
template <
int,
int,
typename>
class TensorT1,
2004 template <
int,
int,
typename>
class TensorT2,
2005 template <
int,
int,
typename>
class TensorT3,
2014 const TensorT2<rank_1 + rank_2, dim, T2> &middle,
2015 const TensorT3<rank_2, dim, T3> & right)
2019 return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(left,
2036 template <
int rank_1,
2040 typename OtherNumber>
2041 inline DEAL_II_ALWAYS_INLINE
2046 typename Tensor<rank_1 + rank_2,
2048 typename ProductType<Number, OtherNumber>::type>
::tensor_type 2050 TensorAccessors::contract<0, rank_1, rank_2, dim>(result, src1, src2);
2073 template <
int dim,
typename Number>
2082 result[1] = -src[0];
2098 template <
int dim,
typename Number>
2107 result[0] = src1[1] * src2[2] - src1[2] * src2[1];
2108 result[1] = src1[2] * src2[0] - src1[0] * src2[2];
2109 result[2] = src1[0] * src2[1] - src1[1] * src2[0];
2128 template <
int dim,
typename Number>
2136 for (
unsigned int k = 0; k < dim; ++k)
2138 Tensor<2, dim - 1, Number> minor;
2139 for (
unsigned int i = 0; i < dim - 1; ++i)
2140 for (
unsigned int j = 0; j < dim - 1; ++j)
2141 minor[i][j] = t[i][j < k ? j : j + 1];
2143 const Number cofactor = ((k % 2 == 0) ? -1. : 1.) *
determinant(minor);
2145 det += t[dim - 1][k] * cofactor;
2148 return ((dim % 2 == 0) ? 1. : -1.) * det;
2156 template <
typename Number>
2171 template <
int dim,
typename Number>
2172 inline DEAL_II_ALWAYS_INLINE Number
2176 for (
unsigned int i = 1; i < dim; ++i)
2191 template <
int dim,
typename Number>
2195 Number return_tensor[dim][dim];
2208 template <
typename Number>
2212 Number return_tensor[1][1];
2220 template <
typename Number>
2229 1.0 / (t[0][0] * t[1][1] - t[1][0] * t[0][1]));
2230 return_tensor[0][0] = t[1][1];
2231 return_tensor[0][1] = -t[0][1];
2232 return_tensor[1][0] = -t[1][0];
2233 return_tensor[1][1] = t[0][0];
2234 return_tensor *= inv_det_t;
2236 return return_tensor;
2240 template <
typename Number>
2253 1.0 / (t4 * t[2][2] - t6 * t[2][1] - t8 * t[2][2] +
2254 t00 * t[2][1] + t01 * t[1][2] - t04 * t[1][1]));
2263 return_tensor[1][1] =
2265 return_tensor[1][2] = t00 - t6;
2268 return_tensor[2][1] =
2271 return_tensor *= inv_det_t;
2273 return return_tensor;
2285 template <
int dim,
typename Number>
2290 for (
unsigned int i = 0; i < dim; ++i)
2293 for (
unsigned int j = i + 1; j < dim; ++j)
2317 template <
int dim,
typename Number>
2339 template <
int dim,
typename Number>
2354 template <
int dim,
typename Number>
2359 for (
unsigned int j = 0; j < dim; ++j)
2362 for (
unsigned int i = 0; i < dim; ++i)
2363 sum += std::fabs(t[i][j]);
2380 template <
int dim,
typename Number>
2385 for (
unsigned int i = 0; i < dim; ++i)
2388 for (
unsigned int j = 0; j < dim; ++j)
2389 sum += std::fabs(t[i][j]);
2404 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING 2413 for (
unsigned int j = 0; j < dim; ++j)
2416 for (
unsigned int i = 0; i < dim; ++i)
2417 sum += std::fabs(t[i][j]);
2419 condassign(max, (sum > max), sum, max);
2431 for (
unsigned int i = 0; i < dim; ++i)
2434 for (
unsigned int j = 0; j < dim; ++j)
2435 sum += std::fabs(t[i][j]);
2437 condassign(max, (sum > max), sum, max);
2443 # endif // DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING 2448 DEAL_II_NAMESPACE_CLOSE
2451 #include <deal.II/base/tensor_deprecated.h> constexpr Tensor()=default
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)
Number trace(const Tensor< 2, dim, Number > &d)
#define AssertDimension(dim1, dim2)
Number determinant(const SymmetricTensor< 2, dim, Number > &)
static unsigned int component_to_unrolled_index(const TableIndices< rank_ > &indices)
constexpr Tensor< 2, dim, Number > cofactor(const Tensor< 2, dim, Number > &t)
Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
bool value_is_zero(const Number &value)
bool operator==(const Tensor< rank_, dim, OtherNumber > &) const
static constexpr std::enable_if< std::is_same< Dummy, number >::value &&is_cuda_compatible< Dummy >::value, real_type >::type abs_square(const number &x)
constexpr ProductType< Other, Number >::type operator*(const Other &object, const Tensor< 0, dim, Number > &t)
Number l1_norm(const Tensor< 2, dim, Number > &t)
Tensor & operator/=(const OtherNumber &factor)
Number linfty_norm(const Tensor< 2, dim, Number > &t)
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< rank_ - 1, dim, Number > values[(dim !=0) ? dim :1]
typename Tensor< rank_ - 1, dim, VectorizedArray< Number > >::array_type[(dim !=0) ? dim :1] array_type
#define AssertThrow(cond, exc)
static real_type abs(const number &x)
internal::ReorderedIndexView< index, rank, T > reordered_index_view(T &t)
numbers::NumberTraits< Number >::real_type norm() const
void unroll_recursion(Vector< OtherNumber > &result, unsigned int &start_index) const
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)
LinearAlgebra::distributed::Vector< Number > Vector
Tensor & operator*=(const OtherNumber &factor)
SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
Tensor< rank_, dim, Number > tensor_type
Tensor< 2, dim, Number > transpose(const Tensor< 2, dim, Number > &t)
static ::ExceptionBase & ExcMessage(std::string arg1)
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)
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator-(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
T sum(const T &t, const MPI_Comm &mpi_communicator)
Tensor< 2, dim, Number > invert(const Tensor< 2, dim, Number > &)
Tensor< 1, dim, Number > cross_product_2d(const Tensor< 1, dim, Number > &src)
#define Assert(cond, exc)
ProductType< Number, OtherNumber >::type scalar_product(const Tensor< rank, dim, Number > &left, const Tensor< rank, dim, OtherNumber > &right)
constexpr Tensor< rank, dim, typename ProductType< typename EnableIfScalar< Number >::type, OtherNumber >::type > operator*(const Number &factor, const Tensor< rank, dim, OtherNumber > &t)
void serialize(Archive &ar, const unsigned int version)
Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
numbers::NumberTraits< Number >::real_type norm_square() const
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 constexpr unsigned int rank
SymmetricTensor< rank_, dim, Number > transpose(const SymmetricTensor< rank_, dim, Number > &t)
constexpr Tensor< 2, dim, Number > adjugate(const Tensor< 2, dim, Number > &t)
static TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
constexpr ProductType< Number, OtherNumber >::type operator*(const Tensor< 0, dim, Number > &src1, const Tensor< 0, dim, OtherNumber > &src2)
Tensor< 1, dim, Number > cross_product_3d(const Tensor< 1, dim, Number > &src1, const Tensor< 1, dim, Number > &src2)
constexpr bool operator!=(const Tensor< rank_, dim, OtherNumber > &) const
typename numbers::NumberTraits< Number >::real_type real_type
constexpr Tensor< 0, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const Tensor< 0, dim, Number > &t, const OtherNumber &factor)
Number determinant(const Tensor< 2, dim, Number > &t)
constexpr ProductType< Number, Other >::type operator*(const Tensor< 0, dim, Number > &t, const Other &object)
Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > operator-(const Tensor< rank, dim, Number > &p, const Tensor< rank, dim, OtherNumber > &q)
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator+(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
static ::ExceptionBase & ExcNotImplemented()
static constexpr unsigned int dimension
void unroll(Vector< OtherNumber > &result) const
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)
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)
Tensor & operator+=(const Tensor< rank_, dim, OtherNumber > &)
static constexpr unsigned int n_independent_components
T max(const T &t, const MPI_Comm &mpi_communicator)
static constexpr std::size_t memory_consumption()
constexpr Number determinant(const Tensor< 2, 1, Number > &t)
static ::ExceptionBase & ExcInternalError()