42 #if !defined(Intrepid_MiniTensor_Tensor3_t_h) 43 #define Intrepid_MiniTensor_Tensor3_t_h 50 template<
typename S,
typename T>
52 dot(Tensor3<T>
const & A, Vector<S>
const & u)
55 N = A.get_dimension();
57 assert(u.get_dimension() == N);
62 for (Index i = 0; i < N; ++i) {
63 for (Index j = 0; j < N; ++j) {
65 typename Promote<S, T>::type
68 for (Index p = 0; p < N; ++p) {
81 template<
typename S,
typename T>
83 dot(Vector<S>
const & u, Tensor3<T>
const & A)
86 N = A.get_dimension();
88 assert(u.get_dimension() == N);
93 for (Index i = 0; i < N; ++i) {
94 for (Index j = 0; j < N; ++j) {
96 typename Promote<S, T>::type
99 for (Index p = 0; p < N; ++p) {
100 s += u(p) * A(p,i,j);
113 template<
typename S,
typename T>
115 dot2(Tensor3<T>
const & A, Vector<S>
const & u)
118 N = A.get_dimension();
120 assert(u.get_dimension() == N);
125 for (Index i = 0; i < N; ++i) {
126 for (Index j = 0; j < N; ++j) {
128 typename Promote<S, T>::type
131 for (Index p = 0; p < N; ++p) {
132 s += A(i,p,j) * u(p);
144 template<
typename S,
typename T>
146 dot2(Vector<S>
const & u, Tensor3<T>
const & A)
154 template<
typename S,
typename T>
156 dot(Tensor3<T>
const & A, Tensor<S>
const & B)
159 N = A.get_dimension();
161 assert(B.get_dimension() == N);
166 for (Index i = 0; i < N; ++i) {
167 for (Index k = 0; k < N; ++k) {
168 for (Index j = 0; j < N; ++j) {
170 typename Promote<S, T>::type
173 for (Index p = 0; p < N; ++p) {
174 s += A(i,j,p) * B(p,k);
187 template<
typename S,
typename T>
189 dot(Tensor<S>
const & A, Tensor3<T>
const & B)
192 N = A.get_dimension();
194 assert(B.get_dimension() == N);
199 for (Index i = 0; i < N; ++i) {
200 for (Index k = 0; k < N; ++k) {
201 for (Index j = 0; j < N; ++j) {
203 typename Promote<S, T>::type
206 for (Index p = 0; p < N; ++p) {
207 s += A(i,p) * B(p,j,k);
220 template<
typename S,
typename T>
222 dot2(Tensor3<T>
const & A, Tensor<S>
const & B)
225 N = A.get_dimension();
227 assert(B.get_dimension() == N);
232 for (Index i = 0; i < N; ++i) {
233 for (Index k = 0; k < N; ++k) {
234 for (Index j = 0; j < N; ++j) {
236 typename Promote<S, T>::type
239 for (Index p = 0; p < N; ++p) {
240 s += A(i,p,j) * B(p,k);
254 template<
typename S,
typename T>
256 dot2(Tensor<S>
const & A, Tensor3<T>
const & B)
259 N = A.get_dimension();
261 assert(B.get_dimension() == N);
266 for (Index i = 0; i < N; ++i) {
267 for (Index k = 0; k < N; ++k) {
268 for (Index j = 0; j < N; ++j) {
270 typename Promote<S, T>::type
273 for (Index p = 0; p < N; ++p) {
274 s += A(i,p) * B(j,p,k);
293 operator>>(std::istream & is, Tensor3<T> & A)
296 N = A.get_dimension();
298 for (Index i = 0; i < N; ++i) {
299 for (Index j = 0; j < N; ++j) {
300 for (Index k = 0; k < N; ++k) {
317 operator<<(std::ostream & os, Tensor3<T>
const & A)
320 N = A.get_dimension();
326 for (Index i = 0; i < N; ++i) {
328 for (Index j = 0; j < N; ++j) {
330 os << std::scientific << A(i,j,0);
332 for (Index k = 1; k < N; ++k) {
333 os << std::scientific <<
"," << A(i,j,k);
350 #endif // Intrepid_MiniTensor_Tensor3_t_h