Intrepid
Intrepid_MiniTensor_Tensor4.t.h
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions: Alejandro Mota (amota@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #if !defined(Intrepid_MiniTensor_Tensor4_t_h)
43 #define Intrepid_MiniTensor_Tensor4_t_h
44 
45 namespace Intrepid {
46 
47 //
48 // 4th-order identity I1
49 // \return \f$ \delta_{ik} \delta_{jl} \f$ such that \f$ A = I_1 A \f$
50 //
51 template<typename T>
52 const Tensor4<T>
53 identity_1(Index const N)
54 {
55  Tensor4<T> I(N, T(0.0));
56 
57  for (Index i = 0; i < N; ++i) {
58  for (Index j = 0; j < N; ++j) {
59  for (Index k = 0; k < N; ++k) {
60  for (Index l = 0; l < N; ++l) {
61  if (i == k && j == l) {
62  I(i,j,k,l) = 1.0;
63  }
64  }
65  }
66  }
67  }
68 
69  return I;
70 }
71 
72 //
73 // 4th-order identity I2
74 // \return \f$ \delta_{il} \delta_{jk} \f$ such that \f$ A^T = I_2 A \f$
75 //
76 template<typename T>
77 const Tensor4<T>
78 identity_2(Index const N)
79 {
80  Tensor4<T> I(N, T(0.0));
81 
82  for (Index i = 0; i < N; ++i) {
83  for (Index j = 0; j < N; ++j) {
84  for (Index k = 0; k < N; ++k) {
85  for (Index l = 0; l < N; ++l) {
86  if (i == l && j == k) {
87  I(i,j,k,l) = 1.0;
88  }
89  }
90  }
91  }
92  }
93 
94  return I;
95 }
96 
97 //
98 // 4th-order identity I3
99 // \return \f$ \delta_{ij} \delta_{kl} \f$ such that \f$ I_A I = I_3 A \f$
100 //
101 template<typename T>
102 const Tensor4<T>
103 identity_3(Index const N)
104 {
105  Tensor4<T> I(N, T(0.0));
106 
107  for (Index i = 0; i < N; ++i) {
108  for (Index j = 0; j < N; ++j) {
109  for (Index k = 0; k < N; ++k) {
110  for (Index l = 0; l < N; ++l) {
111  if (i == j && k == l) {
112  I(i,j,k,l) = 1.0;
113  }
114  }
115  }
116  }
117  }
118 
119  return I;
120 }
121 
122 //
123 // 4th-order tensor transpose
124 // per Holzapfel 1.157
125 //
126 template<typename T>
127 Tensor4<T>
128 transpose(Tensor4<T> const & A)
129 {
130  Index const N = A.get_dimension();
131 
132  Tensor4<T> B(N);
133 
134  for (Index i = 0; i < N; ++i) {
135  for (Index j = 0; j < N; ++j) {
136  for (Index k = 0; k < N; ++k) {
137  for (Index l = 0; l < N; ++l) {
138  B(i, j, k, l) = A(k, l, i, j);
139  }
140  }
141  }
142  }
143 
144  return B;
145 }
146 
147 //
148 // 4th-order tensor vector dot product
149 // \param A 4th-order tensor
150 // \param u vector
151 // \return 3rd-order tensor \f$ B = A \cdot u := B_{ijk}=A_{ijkp} u_{p} \f$
152 //
153 template<typename S, typename T>
154 Tensor3<typename Promote<S, T>::type>
155 dot(Tensor4<T> const & A, Vector<S> const & u)
156 {
157  Index const
158  N = A.get_dimension();
159 
160  assert(u.get_dimension() == N);
161 
162  Tensor3<typename Promote<S, T>::type>
163  B(N);
164 
165  for (Index i = 0; i < N; ++i) {
166  for (Index j = 0; j < N; ++j) {
167  for (Index k = 0; k < N; ++k) {
168 
169  typename Promote<S, T>::type
170  s = 0.0;
171 
172  for (Index p = 0; p < N; ++p) {
173  s += A(i,j,k,p) * u(p);
174  }
175  B(i,j,k) = s;
176  }
177  }
178  }
179 
180  return B;
181 }
182 
183 //
184 // vector 4th-order tensor dot product
185 // \param A 4th-order tensor
186 // \param u vector
187 // \return 3rd-order tensor \f$ u dot A \f$ as \f$ B_{ijk}=u_{p} A_{pijk} \f$
188 //
189 template<typename S, typename T>
190 Tensor3<typename Promote<S, T>::type>
191 dot(Vector<S> const & u, Tensor4<T> const & A)
192 {
193  Index const
194  N = A.get_dimension();
195 
196  assert(u.get_dimension() == N);
197 
198  Tensor3<typename Promote<S, T>::type>
199  B(N);
200 
201  for (Index i = 0; i < N; ++i) {
202  for (Index j = 0; j < N; ++j) {
203  for (Index k = 0; k < N; ++k) {
204 
205  typename Promote<S, T>::type
206  s = 0.0;
207 
208  for (Index p = 0; p < N; ++p) {
209  s += u(p) * A(p,i,j,k);
210  }
211  B(i,j,k) = s;
212  }
213  }
214  }
215 
216  return B;
217 }
218 
219 //
220 // 4th-order tensor vector dot2 product
221 // \param A 4th-order tensor
222 // \param u vector
223 // \return 3rd-order tensor \f$ B = A \cdot u := B_{ijk} = A_{ijpk} u_{p} \f$
224 //
225 template<typename S, typename T>
226 Tensor3<typename Promote<S, T>::type>
227 dot2(Tensor4<T> const & A, Vector<S> const & u)
228 {
229  Index const
230  N = A.get_dimension();
231 
232  assert(u.get_dimension() == N);
233 
234  Tensor3<typename Promote<S, T>::type>
235  B(N);
236 
237  for (Index i = 0; i < N; ++i) {
238  for (Index j = 0; j < N; ++j) {
239  for (Index k = 0; k < N; ++k) {
240 
241  typename Promote<S, T>::type
242  s = 0.0;
243 
244  for (Index p = 0; p < N; ++p) {
245  s += A(i,j,p,k) * u(p);
246  }
247  B(i,j,k) = s;
248  }
249  }
250  }
251 
252  return B;
253 }
254 
255 //
256 // vector 4th-order tensor dot2 product
257 // \param A 4th-order tensor
258 // \param u vector
259 // \return 3rd-order tensor \f$ u dot2 A \f$ as \f$ B_{ijk}=u_{p} A_{ipjk} \f$
260 //
261 template<typename S, typename T>
262 Tensor3<typename Promote<S, T>::type>
263 dot2(Vector<S> const & u, Tensor4<T> const & A)
264 {
265  Index const
266  N = A.get_dimension();
267 
268  assert(u.get_dimension() == N);
269 
270  Tensor3<typename Promote<S, T>::type>
271  B(N);
272 
273  for (Index i = 0; i < N; ++i) {
274  for (Index j = 0; j < N; ++j) {
275  for (Index k = 0; k < N; ++k) {
276 
277  typename Promote<S, T>::type
278  s = 0.0;
279 
280  for (Index p = 0; p < N; ++p) {
281  s += u(p) * A(i,p,j,k);
282  }
283  B(i,j,k) = s;
284  }
285  }
286  }
287 
288  return B;
289 }
290 
291 //
292 // \return 2nd-order tensor \f$ C = A : B := C_{ij} = A_{ijpq} B_{pq} \f$
293 //
294 template<typename S, typename T>
295 Tensor<typename Promote<S, T>::type>
296 dotdot(Tensor4<T> const & A, Tensor<S> const & B)
297 {
298  Index const
299  N = A.get_dimension();
300 
301  assert(B.get_dimension() == N);
302 
303  Tensor<typename Promote<S, T>::type>
304  C(N);
305 
306  for (Index i = 0; i < N; ++i) {
307  for (Index j = 0; j < N; ++j) {
308 
309  typename Promote<S, T>::type
310  s = 0.0;
311 
312  for (Index p = 0; p < N; ++p) {
313  for (Index q = 0; q < N; ++q) {
314  s += A(i,j,p,q) * B(p,q);
315  }
316  }
317  C(i,j) = s;
318  }
319  }
320 
321  return C;
322 }
323 
324 //
325 // \return 2nd-order tensor \f$ C = B : A := C_{ij} = B_{pq} A_{pqij} \f$
326 //
327 template<typename S, typename T>
328 Tensor<typename Promote<S, T>::type>
329 dotdot(Tensor<S> const & B, Tensor4<T> const & A)
330 {
331  Index const
332  N = A.get_dimension();
333 
334  assert(B.get_dimension() == N);
335 
336  Tensor<typename Promote<S, T>::type>
337  C(N);
338 
339  for (Index i = 0; i < N; ++i) {
340  for (Index j = 0; j < N; ++j) {
341 
342  typename Promote<S, T>::type
343  s = 0.0;
344 
345  for (Index p = 0; p < N; ++p) {
346  for (Index q = 0; q < N; ++q) {
347  s += B(p,q) * A(p,q,i,j);
348  }
349  }
350  C(i,j) = s;
351  }
352  }
353 
354  return C;
355 }
356 
357 //
358 // \return \f$ C = A : B := C_{ijkl} = A_{ijpq} B{pqkl} \f$
359 //
360 template<typename S, typename T>
361 Tensor4<typename Promote<S, T>::type>
362 dotdot(Tensor4<S> const & A, Tensor4<T> const & B)
363 {
364  Index const
365  N = A.get_dimension();
366 
367  assert(B.get_dimension() == N);
368 
369  Tensor4<typename Promote<S, T>::type>
370  C(N);
371 
372  for (Index i = 0; i < N; ++i) {
373  for (Index j = 0; j < N; ++j) {
374  for (Index k = 0; k < N; ++k) {
375  for (Index l = 0; l < N; ++l) {
376 
377  typename Promote<S, T>::type
378  s = 0.0;
379 
380  for (Index p = 0; p < N; ++p) {
381  for (Index q = 0; q < N; ++q) {
382  s += A(i,j,p,q) * B(p,q,k,l);
383  }
384  }
385  C(i,j,k,l) = s;
386  }
387  }
388  }
389  }
390 
391  return C;
392 }
393 
394 //
395 // \return \f$ C = A \otimes B := C_{ijkl} = A_{ij} B_{kl} \f$
396 //
397 template<typename S, typename T>
398 Tensor4<typename Promote<S, T>::type>
399 tensor(Tensor<S> const & A, Tensor<T> const & B)
400 {
401  Index const
402  N = A.get_dimension();
403 
404  assert(B.get_dimension() == N);
405 
406  Tensor4<typename Promote<S, T>::type>
407  C(N);
408 
409  for (Index i = 0; i < N; ++i) {
410  for (Index j = 0; j < N; ++j) {
411  for (Index k = 0; k < N; ++k) {
412  for (Index l = 0; l < N; ++l) {
413  C(i,j,k,l) = A(i,j) * B(k,l);
414  }
415  }
416  }
417  }
418 
419  return C;
420 }
421 
422 //
423 // \return \f$ C_{ijkl} = A_{ik} B_{jl} \f$
424 //
425 template<typename S, typename T>
426 Tensor4<typename Promote<S, T>::type>
427 tensor2(Tensor<S> const & A, Tensor<T> const & B)
428 {
429  Index const
430  N = A.get_dimension();
431 
432  assert(B.get_dimension() == N);
433 
434  Tensor4<typename Promote<S, T>::type>
435  C(N);
436 
437  for (Index i = 0; i < N; ++i) {
438  for (Index j = 0; j < N; ++j) {
439  for (Index k = 0; k < N; ++k) {
440  for (Index l = 0; l < N; ++l) {
441  C(i,j,k,l) = A(i,k) * B(j,l);
442  }
443  }
444  }
445  }
446 
447  return C;
448 }
449 
450 //
451 // \return \f$ C_{ijkl} = A_{il} B_{kj} \f$
452 //
453 template<typename S, typename T>
454 Tensor4<typename Promote<S, T>::type>
455 tensor3(Tensor<S> const & A, Tensor<T> const & B)
456 {
457  Index const
458  N = A.get_dimension();
459 
460  assert(B.get_dimension() == N);
461 
462  Tensor4<typename Promote<S, T>::type>
463  C(N);
464 
465  for (Index i = 0; i < N; ++i) {
466  for (Index j = 0; j < N; ++j) {
467  for (Index k = 0; k < N; ++k) {
468  for (Index l = 0; l < N; ++l) {
469  C(i,j,k,l) = A(i,l) * B(k,j);
470  }
471  }
472  }
473  }
474 
475  return C;
476 }
477 
478 //
479 // \return \f$ C = A \cdot B := C_{ijkl} = A_{ijkp} B_{pl} \f$
480 //
481 template<typename S, typename T>
482 Tensor4<typename Promote<S, T>::type>
483 dot(Tensor4<T> const & A, Tensor<S> const & B)
484 {
485  Index const
486  N = A.get_dimension();
487 
488  assert(B.get_dimension() == N);
489 
490  Tensor4<typename Promote<S, T>::type>
491  C(N);
492 
493  for (Index i = 0; i < N; ++i) {
494  for (Index j = 0; j < N; ++j) {
495  for (Index k = 0; k < N; ++k) {
496  for (Index l = 0; l < N; ++l) {
497 
498  typename Promote<S, T>::type
499  s = 0.0;
500 
501  for (Index p = 0; p < N; ++p) {
502  s += A(i,j,k,p) * B(p,l);
503  }
504  C(i,j,k,l) = s;
505  }
506  }
507  }
508  }
509 
510  return C;
511 }
512 
513 //
514 // \return \f$ C = A \cdot B^T := C_{ijkl} = A_{ijkp} B_{lp} \f$
515 //
516 template<typename S, typename T>
517 Tensor4<typename Promote<S, T>::type>
518 dot_t(Tensor4<T> const & A, Tensor<S> const & B)
519 {
520  Index const
521  N = A.get_dimension();
522 
523  assert(B.get_dimension() == N);
524 
525  Tensor4<typename Promote<S, T>::type>
526  C(N);
527 
528  for (Index i = 0; i < N; ++i) {
529  for (Index j = 0; j < N; ++j) {
530  for (Index k = 0; k < N; ++k) {
531  for (Index l = 0; l < N; ++l) {
532 
533  typename Promote<S, T>::type
534  s = 0.0;
535 
536  for (Index p = 0; p < N; ++p) {
537  s += A(i,j,k,p) * B(l,p);
538  }
539  C(i,j,k,l) = s;
540  }
541  }
542  }
543  }
544 
545  return C;
546 }
547 
548 //
549 // \return \f$ C = A \cdot B := C_{ijkl} = A_{ip} B_{pjkl} \f$
550 //
551 template<typename S, typename T>
552 Tensor4<typename Promote<S, T>::type>
553 dot(Tensor<S> const & A, Tensor4<T> const & B)
554 {
555  Index const
556  N = A.get_dimension();
557 
558  assert(B.get_dimension() == N);
559 
560  Tensor4<typename Promote<S, T>::type>
561  C(N);
562 
563  for (Index i = 0; i < N; ++i) {
564  for (Index j = 0; j < N; ++j) {
565  for (Index k = 0; k < N; ++k) {
566  for (Index l = 0; l < N; ++l) {
567 
568  typename Promote<S, T>::type
569  s = 0.0;
570 
571  for (Index p = 0; p < N; ++p) {
572  s += A(i,p) * B(p,j,k,l);
573  }
574  C(i,j,k,l) = s;
575  }
576  }
577  }
578  }
579 
580  return C;
581 }
582 
583 //
584 // \return \f$ C = A^T \cdot B := C_{ijkl} = A_{pi} B_{pjkl} \f$
585 //
586 template<typename S, typename T>
587 Tensor4<typename Promote<S, T>::type>
588 t_dot(Tensor<S> const & A, Tensor4<T> const & B)
589 {
590  Index const
591  N = A.get_dimension();
592 
593  assert(B.get_dimension() == N);
594 
595  Tensor4<typename Promote<S, T>::type>
596  C(N);
597 
598  for (Index i = 0; i < N; ++i) {
599  for (Index j = 0; j < N; ++j) {
600  for (Index k = 0; k < N; ++k) {
601  for (Index l = 0; l < N; ++l) {
602 
603  typename Promote<S, T>::type
604  s = 0.0;
605 
606  for (Index p = 0; p < N; ++p) {
607  s += A(p,i) * B(p,j,k,l);
608  }
609  C(i,j,k,l) = s;
610  }
611  }
612  }
613  }
614 
615  return C;
616 }
617 
618 //
619 // \return \f$ C = A \cdot B := C_{ijkl} = A_{ijpl} B_{pk} \f$
620 //
621 template<typename S, typename T>
622 Tensor4<typename Promote<S, T>::type>
623 dot2(Tensor4<T> const & A, Tensor<S> const & B)
624 {
625  Index const
626  N = A.get_dimension();
627 
628  assert(B.get_dimension() == N);
629 
630  Tensor4<typename Promote<S, T>::type>
631  C(N);
632 
633  for (Index i = 0; i < N; ++i) {
634  for (Index j = 0; j < N; ++j) {
635  for (Index k = 0; k < N; ++k) {
636  for (Index l = 0; l < N; ++l) {
637 
638  typename Promote<S, T>::type
639  s = 0.0;
640 
641  for (Index p = 0; p < N; ++p) {
642  s += A(i,j,p,l) * B(p,k);
643  }
644  C(i,j,k,l) = s;
645  }
646  }
647  }
648  }
649 
650  return C;
651 }
652 
653 //
654 // \return \f$ C = A \cdot B^T := C_{ijkl} = A_{ijpl} B_{kp} \f$
655 //
656 template<typename S, typename T>
657 Tensor4<typename Promote<S, T>::type>
658 dot2_t(Tensor4<T> const & A, Tensor<S> const & B)
659 {
660  Index const
661  N = A.get_dimension();
662 
663  assert(B.get_dimension() == N);
664 
665  Tensor4<typename Promote<S, T>::type>
666  C(N);
667 
668  for (Index i = 0; i < N; ++i) {
669  for (Index j = 0; j < N; ++j) {
670  for (Index k = 0; k < N; ++k) {
671  for (Index l = 0; l < N; ++l) {
672 
673  typename Promote<S, T>::type
674  s = 0.0;
675 
676  for (Index p = 0; p < N; ++p) {
677  s += A(i,j,p,l) * B(k,p);
678  }
679  C(i,j,k,l) = s;
680  }
681  }
682  }
683  }
684 
685  return C;
686 }
687 
688 //
689 // \return \f$ C = A \cdot B := C_{ijkl} = A_{jp} B_{ipkl} \f$
690 //
691 template<typename S, typename T>
692 Tensor4<typename Promote<S, T>::type>
693 dot2(Tensor<S> const & A, Tensor4<T> const & B)
694 {
695  Index const
696  N = A.get_dimension();
697 
698  assert(B.get_dimension() == N);
699 
700  Tensor4<typename Promote<S, T>::type>
701  C(N);
702 
703  for (Index i = 0; i < N; ++i) {
704  for (Index j = 0; j < N; ++j) {
705  for (Index k = 0; k < N; ++k) {
706  for (Index l = 0; l < N; ++l) {
707 
708  typename Promote<S, T>::type
709  s = 0.0;
710 
711  for (Index p = 0; p < N; ++p) {
712  s += A(j,p) * B(i,p,k,l);
713  }
714  C(i,j,k,l) = s;
715  }
716  }
717  }
718  }
719 
720  return C;
721 }
722 
723 //
724 // \return \f$ C = A^T \cdot B := C_{ijkl} = A_{pj} B_{ipkl} \f$
725 //
726 template<typename S, typename T>
727 Tensor4<typename Promote<S, T>::type>
728 t_dot2(Tensor<S> const & A, Tensor4<T> const & B)
729 {
730  Index const
731  N = A.get_dimension();
732 
733  assert(B.get_dimension() == N);
734 
735  Tensor4<typename Promote<S, T>::type>
736  C(N);
737 
738  for (Index i = 0; i < N; ++i) {
739  for (Index j = 0; j < N; ++j) {
740  for (Index k = 0; k < N; ++k) {
741  for (Index l = 0; l < N; ++l) {
742 
743  typename Promote<S, T>::type
744  s = 0.0;
745 
746  for (Index p = 0; p < N; ++p) {
747  s += A(p,j) * B(i,p,k,l);
748  }
749  C(i,j,k,l) = s;
750  }
751  }
752  }
753  }
754 
755  return C;
756 }
757 
758 //
759 // odot operator useful for \f$ \frac{\partial A^{-1}}{\partial A} \f$
760 // see Holzapfel eqn 6.165
761 // \param A 2nd-order tensor
762 // \param B 2nd-order tensor
763 // \return \f$ A \odot B \f$ which is
764 // \f$ C_{ijkl} = \frac{1}{2}(A_{ik} B_{jl} + A_{il} B_{jk}) \f$
765 //
766 template<typename S, typename T>
767 Tensor4<typename Promote<S, T>::type>
768 odot(Tensor<S> const & A, Tensor<T> const & B)
769 {
770  Index const
771  N = A.get_dimension();
772 
773  assert(B.get_dimension() == N);
774 
775  Tensor4<typename Promote<S, T>::type>
776  C(N);
777 
778  for (Index i = 0; i < N; ++i) {
779  for (Index j = 0; j < N; ++j) {
780  for (Index k = 0; k < N; ++k) {
781  for (Index l = 0; l < N; ++l) {
782  C(i,j,k,l) = 0.5 * (A(i,k) * B(j,l) + A(i,l) * B(j,k));
783  }
784  }
785  }
786  }
787 
788  return C;
789 }
790 
791 //
792 // 4th-order input
793 // \param A 4th-order tensor
794 // \param is input stream
795 // \return is input stream
796 //
797 template<typename T>
798 std::istream &
799 operator>>(std::istream & is, Tensor4<T> & A)
800 {
801  Index const
802  N = A.get_dimension();
803 
804  for (Index i = 0; i < N; ++i) {
805  for (Index j = 0; j < N; ++j) {
806  for (Index k = 0; k < N; ++k) {
807  for (Index l = 0; l < N; ++l) {
808  is >> A(i,j,k,l);
809  }
810  }
811  }
812  }
813 
814  return is;
815 }
816 
817 //
818 // 4th-order output
819 // \param A 4th-order tensor
820 // \param os output stream
821 // \return os output stream
822 //
823 template<typename T>
824 std::ostream &
825 operator<<(std::ostream & os, Tensor4<T> const & A)
826 {
827  Index const
828  N = A.get_dimension();
829 
830  if (N == 0) {
831  return os;
832  }
833 
834  for (Index i = 0; i < N; ++i) {
835 
836  for (Index j = 0; j < N; ++j) {
837 
838  for (Index k = 0; k < N; ++k) {
839 
840  os << std::scientific << A(i,j,k,0);
841 
842  for (Index l = 1; l < N; ++l) {
843 
844  os << std::scientific << "," << A(i,j,k,l);
845  }
846 
847  os << std::endl;
848 
849  }
850 
851  os << std::endl;
852  os << std::endl;
853 
854  }
855 
856  os << std::endl;
857 
858  }
859 
860  return os;
861 }
862 
863 } // namespace Intrepid
864 
865 #endif // Intrepid_MiniTensor_Tensor4_t_h