10#if !defined(MiniTensor_Tensor3_h)
11#define MiniTensor_Tensor3_h
25template<
typename T, Index N>
31template<
typename T, Index N = DYNAMIC>
171template<
typename S,
typename T, Index N>
182template<
typename S,
typename T, Index N>
191template<
typename T, Index N>
200template<
typename T, Index N>
209template<
typename T, Index N>
220template<
typename S,
typename T, Index N>
231template<
typename S,
typename T, Index N>
242template<
typename S,
typename T, Index N>
253template<
typename S,
typename T, Index N>
264template<
typename S,
typename T, Index N>
275template<
typename S,
typename T, Index N>
286template<
typename S,
typename T, Index N>
297template<
typename S,
typename T, Index N>
308template<
typename S,
typename T, Index N>
319template<
typename S,
typename T, Index N>
330template<
typename S,
typename T, Index N>
341template<
typename S,
typename T, Index N>
352template<
typename S,
typename T, Index N>
360template<
typename T, Index N>
370template<
typename T, Index N>
378template<
typename T, Index N>
388template<
typename T, Index N>
396template<
typename T, Index N>
406template<
typename T, Index N>
417template<
typename T, Index N>
427template<
typename T, Index N>
438template<
typename T, Index N>
447template<
typename T, Index N>
458template<
typename T, Index N>
466template<
typename T, Index N>
477template<
typename T, Index N>
485template<
typename T, Index N>
496template<
typename T, Index N>
507template<
typename T, Index N>
517template<
typename T, Index N>
528template<
typename T, Index N>
540template<
typename S,
typename T, Index N>
556template<
typename S,
typename T, Index N>
558Tensor3<typename Promote<S, T>::type, N>
572template<
typename T, Index N>
588template<
typename T, Index N>
599template<
typename T, Index N>
610template<
typename S,
typename T, Index N>
612typename lazy_disable_if< order_1234<S>, apply_tensor3< Promote<S,T>, N>>::type
626template<
typename S,
typename T, Index N>
628typename lazy_disable_if< order_1234<S>, apply_tensor3< Promote<S,T>, N>>::type
642template<
typename S,
typename T, Index N>
644Tensor3<typename Promote<S, T>::type, N>
658template<
typename S,
typename T, Index N>
660Tensor3<typename Promote<S, T>::type, N>
674template<
typename T, Index N>
685 return self[(i * dimension + j) * dimension + k];
691template<
typename T, Index N>
702 return self[(i * dimension + j) * dimension + k];
708template<
typename T, Index N>
718 for (
Index i = 0; i < dimension; ++i) {
739template<
typename T, Index N>
744 dimension = A.get_dimension();
746 for (
Index i = 0; i < dimension; ++i) {
747 for (
Index j = 0; j < dimension; ++j) {
748 for (
Index k = 0; k < dimension; ++k) {
762template<
typename T, Index N>
780Tensor3<T, DYNAMIC>
const
794template<
typename T, Index N>
799 if (N !=
DYNAMIC) assert(dimension == N);
810template<
typename T, Index N>
823Tensor3<T, DYNAMIC>
const
832template<
typename T, Index N>
843template<
typename T, Index N>
856Tensor3<T, DYNAMIC>
const
865template<
typename T, Index N>
879template<
typename S,
typename T, Index N>
892 for (
Index i = 0; i < dimension; ++i) {
894 typename Promote<S, T>::type
897 for (
Index j = 0; j < dimension; ++j) {
898 for (
Index k = 0; k < dimension; ++k) {
899 s += A(i,j,k) * u(j,k);
911template<
typename S,
typename T, Index N>
913Tensor<typename Promote<S, T>::type, N>
924 for (
Index i = 0; i < dimension; ++i) {
925 for (
Index j = 0; j < dimension; ++j) {
927 typename Promote<S, T>::type
930 for (
Index p = 0; p < dimension; ++p) {
931 s += A(i,j,p) * u(p);
943template<
typename S,
typename T, Index N>
945Tensor<typename Promote<S, T>::type, N>
956 for (
Index i = 0; i < dimension; ++i) {
957 for (
Index j = 0; j < dimension; ++j) {
959 typename Promote<S, T>::type
962 for (
Index p = 0; p < dimension; ++p) {
963 s += u(p) * A(p,i,j);
980template<
typename S,
typename T, Index N>
982Tensor<typename Promote<S, T>::type, N>
993 for (
Index i = 0; i < dimension; ++i) {
994 for (
Index j = 0; j < dimension; ++j) {
996 typename Promote<S, T>::type
999 for (
Index p = 0; p < dimension; ++p) {
1000 s += A(i,p,j) * u(p);
1012template<
typename S,
typename T, Index N>
1014Tensor<typename Promote<S, T>::type, N>
1023template<
typename S,
typename T, Index N>
1025Tensor3<typename Promote<S, T>::type, N>
1036 for (
Index i = 0; i < dimension; ++i) {
1037 for (
Index k = 0; k < dimension; ++k) {
1038 for (
Index j = 0; j < dimension; ++j) {
1040 typename Promote<S, T>::type
1043 for (
Index p = 0; p < dimension; ++p) {
1044 s += A(i,j,p) * B(p,k);
1057template<
typename S,
typename T, Index N>
1059Tensor3<typename Promote<S, T>::type, N>
1070 for (
Index i = 0; i < dimension; ++i) {
1071 for (
Index k = 0; k < dimension; ++k) {
1072 for (
Index j = 0; j < dimension; ++j) {
1074 typename Promote<S, T>::type
1077 for (
Index p = 0; p < dimension; ++p) {
1078 s += A(i,p) * B(p,j,k);
1091template<
typename S,
typename T, Index N>
1093Tensor3<typename Promote<S, T>::type, N>
1104 for (
Index i = 0; i < dimension; ++i) {
1105 for (
Index k = 0; k < dimension; ++k) {
1106 for (
Index j = 0; j < dimension; ++j) {
1108 typename Promote<S, T>::type
1111 for (
Index p = 0; p < dimension; ++p) {
1112 s += A(i,p,j) * B(p,k);
1126template<
typename S,
typename T, Index N>
1128Tensor3<typename Promote<S, T>::type, N>
1139 for (
Index i = 0; i < dimension; ++i) {
1140 for (
Index k = 0; k < dimension; ++k) {
1141 for (
Index j = 0; j < dimension; ++j) {
1143 typename Promote<S, T>::type
1146 for (
Index p = 0; p < dimension; ++p) {
1147 s += A(i,p) * B(j,p,k);
1164template<
typename T, Index N>
1171 for (
Index i = 0; i < dimension; ++i) {
1172 for (
Index j = 0; j < dimension; ++j) {
1173 for (
Index k = 0; k < dimension; ++k) {
1188template<
typename T, Index N>
1195 if (dimension == 0) {
1199 os << std::scientific << std::setprecision(17);
1201 for (
Index i = 0; i < dimension; ++i) {
1203 for (
Index j = 0; j < dimension; ++j) {
1205 os << std::setw(24) << A(i,j,0);
1207 for (
Index k = 1; k < dimension; ++k) {
1208 os <<
"," << std::setw(24) << A(i,j,k);
#define KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION Matrix< typename Promote< S, T >::type, M, N > operator+(Matrix< S, M, N > const &A, Matrix< T, M, N > const &B)
KOKKOS_INLINE_FUNCTION void minus(TensorBase< T, ST > const &A, TensorBase< T, ST > &B)
KOKKOS_INLINE_FUNCTION Tensor3< T, N > const levi_civita_3()
KOKKOS_INLINE_FUNCTION Matrix< typename Promote< S, T >::type, M, N > operator-(Matrix< S, M, N > const &A, Matrix< T, M, N > const &B)
static KOKKOS_INLINE_FUNCTION constexpr Index get_order()
std::ostream & operator<<(std::ostream &os, Matrix< T, M, N > const &A)
KOKKOS_INLINE_FUNCTION void add(TensorBase< R, SR > const &A, TensorBase< S, SS > const &B, TensorBase< T, ST > &C)
KOKKOS_INLINE_FUNCTION constexpr Index bound_dimension(Index const dimension)
std::istream & operator>>(std::istream &is, Matrix< T, M, N > &A)
static constexpr bool IS_DYNAMIC
static constexpr Index ORDER
KOKKOS_INLINE_FUNCTION Matrix< typename Promote< S, T >::type, M, N > operator/(Matrix< T, M, N > const &A, S const &s)
KOKKOS_INLINE_FUNCTION void set_dimension(Index const dimension)
KOKKOS_INLINE_FUNCTION Vector< typename Promote< S, T >::type, M > operator*(Matrix< T, M, N > const &A, Vector< S, N > const &u)
KOKKOS_INLINE_FUNCTION Tensor3< T, N > const alternator_3()
KOKKOS_INLINE_FUNCTION Promote< S, T >::type dotdot(Matrix< S, M, N > const &A, Matrix< T, M, N > const &B)
KOKKOS_INLINE_FUNCTION Tensor3(Index const dimension)
KOKKOS_INLINE_FUNCTION Tensor3< T, N > const permutation_3()
KOKKOS_INLINE_FUNCTION Index get_dimension() const
KOKKOS_INLINE_FUNCTION bool equal(TensorBase< T, ST > const &A, TensorBase< T, ST > const &B)
KOKKOS_INLINE_FUNCTION Tensor3(Index const dimension, T const *data_ptr)
KOKKOS_INLINE_FUNCTION T const & operator()(Index const i, Index const j, Index const k) const
KOKKOS_INLINE_FUNCTION Index get_dimension() const
KOKKOS_INLINE_FUNCTION Index get_dimension(Index const order) const
virtual KOKKOS_INLINE_FUNCTION ~Tensor3()
KOKKOS_INLINE_FUNCTION TensorBase()
KOKKOS_INLINE_FUNCTION void scale(TensorBase< R, SR > const &A, S const &s, TensorBase< T, ST > &B)
KOKKOS_INLINE_FUNCTION bool operator!=(Matrix< T, M, N > const &A, Matrix< T, M, N > const &B)
KOKKOS_INLINE_FUNCTION Tensor3()
KOKKOS_INLINE_FUNCTION bool operator==(Matrix< T, M, N > const &A, Matrix< T, M, N > const &B)
KOKKOS_INLINE_FUNCTION Vector< typename Promote< S, T >::type, M > dot(Matrix< T, M, N > const &A, Vector< S, N > const &u)
KOKKOS_INLINE_FUNCTION Index get_dimension() const
tensor3_store< T, N > Store
KOKKOS_INLINE_FUNCTION T & operator()(Index const i, Index const j, Index const k)
KOKKOS_INLINE_FUNCTION void split(TensorBase< R, SR > const &A, S const &s, TensorBase< T, ST > &B)
KOKKOS_INLINE_FUNCTION Tensor3(T const *data_ptr)
KOKKOS_INLINE_FUNCTION Tensor3(Index const dimension, Filler const value)
KOKKOS_INLINE_FUNCTION Tensor3(Filler const value)
KOKKOS_INLINE_FUNCTION bool not_equal(TensorBase< T, ST > const &A, TensorBase< T, ST > const &B)
KOKKOS_INLINE_FUNCTION Tensor3(Tensor3< T, N > const &A)
KOKKOS_INLINE_FUNCTION void set_dimension(Index const dimension, Index const order)
Storage< T, dimension_power< N, 3 >::value > tensor3_store
KOKKOS_INLINE_FUNCTION void divide(TensorBase< R, SR > const &A, S const &s, TensorBase< T, ST > &B)
KOKKOS_INLINE_FUNCTION Tensor< typename Promote< S, T >::type, N > dot2(Tensor3< T, N > const &A, Vector< S > const &u)
KOKKOS_INLINE_FUNCTION void subtract(TensorBase< R, SR > const &A, TensorBase< S, SS > const &B, TensorBase< T, ST > &C)
constexpr Index DYNAMIC
Indicator for dynamic storage.
uint32_t Index
Indexing type.
KOKKOS_INLINE_FUNCTION T levi_civita(Index const i, Index const j)