ARTS 2.5.4 (git: bcd8c674)
matpackVI.cc
Go to the documentation of this file.
1/* Copyright (C) 2002-2012 Stefan Buehler <sbuehler@ltu.se>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
25#include "matpackVI.h"
26
27#include "exceptions.h"
28
29// Functions for ConstTensor6View:
30// ------------------------------
31
32// Const index operators:
33
34// Result 6D (1 combination)
35// ------
37 const Range& s,
38 const Range& b,
39 const Range& p,
40 const Range& r,
41 const Range& c) const {
42 return ConstTensor6View(
43 mdata, mvr, msr, mbr, mpr, mrr, mcr, v, s, b, p, r, c);
44}
45
46// Result 5D (6 combinations)
47// -----|
49 const Range& s,
50 const Range& b,
51 const Range& p,
52 const Range& r,
53 Index c) const {
54 CHECK(c);
55 return ConstTensor5View(
56 mdata + OFFSET(c), mvr, msr, mbr, mpr, mrr, v, s, b, p, r);
57}
58
59// ----|-
61 const Range& s,
62 const Range& b,
63 const Range& p,
64 Index r,
65 const Range& c) const {
66 CHECK(r);
67 return ConstTensor5View(
68 mdata + OFFSET(r), mvr, msr, mbr, mpr, mcr, v, s, b, p, c);
69}
70
71// ---|--
73 const Range& s,
74 const Range& b,
75 Index p,
76 const Range& r,
77 const Range& c) const {
78 CHECK(p);
79 return ConstTensor5View(
80 mdata + OFFSET(p), mvr, msr, mbr, mrr, mcr, v, s, b, r, c);
81}
82
83// --|---
85 const Range& s,
86 Index b,
87 const Range& p,
88 const Range& r,
89 const Range& c) const {
90 CHECK(b);
91 return ConstTensor5View(
92 mdata + OFFSET(b), mvr, msr, mpr, mrr, mcr, v, s, p, r, c);
93}
94
95// -|----
97 Index s,
98 const Range& b,
99 const Range& p,
100 const Range& r,
101 const Range& c) const {
102 CHECK(s);
103 return ConstTensor5View(
104 mdata + OFFSET(s), mvr, mbr, mpr, mrr, mcr, v, b, p, r, c);
105}
106
107// |-----
109 const Range& s,
110 const Range& b,
111 const Range& p,
112 const Range& r,
113 const Range& c) const {
114 CHECK(v);
115 return ConstTensor5View(
116 mdata + OFFSET(v), msr, mbr, mpr, mrr, mcr, s, b, p, r, c);
117}
118
119// Result 4D (5+4+3+2+1 = 15 combinations)
120// ----||
122 const Range& s,
123 const Range& b,
124 const Range& p,
125 Index r,
126 Index c) const {
127 CHECK(r);
128 CHECK(c);
129 return ConstTensor4View(
130 mdata + OFFSET(r) + OFFSET(c), mvr, msr, mbr, mpr, v, s, b, p);
131}
132
133// ---|-|
135 const Range& s,
136 const Range& b,
137 Index p,
138 const Range& r,
139 Index c) const {
140 CHECK(p);
141 CHECK(c);
142 return ConstTensor4View(
143 mdata + OFFSET(p) + OFFSET(c), mvr, msr, mbr, mrr, v, s, b, r);
144}
145
146// --|--|
148 const Range& s,
149 Index b,
150 const Range& p,
151 const Range& r,
152 Index c) const {
153 CHECK(b);
154 CHECK(c);
155 return ConstTensor4View(
156 mdata + OFFSET(b) + OFFSET(c), mvr, msr, mpr, mrr, v, s, p, r);
157}
158
159// -|---|
161 Index s,
162 const Range& b,
163 const Range& p,
164 const Range& r,
165 Index c) const {
166 CHECK(s);
167 CHECK(c);
168 return ConstTensor4View(
169 mdata + OFFSET(s) + OFFSET(c), mvr, mbr, mpr, mrr, v, b, p, r);
170}
171
172// |----|
174 const Range& s,
175 const Range& b,
176 const Range& p,
177 const Range& r,
178 Index c) const {
179 CHECK(v);
180 CHECK(c);
181 return ConstTensor4View(
182 mdata + OFFSET(v) + OFFSET(c), msr, mbr, mpr, mrr, s, b, p, r);
183}
184
185// ---||-
187 const Range& s,
188 const Range& b,
189 Index p,
190 Index r,
191 const Range& c) const {
192 CHECK(p);
193 CHECK(r);
194 return ConstTensor4View(
195 mdata + OFFSET(p) + OFFSET(r), mvr, msr, mbr, mcr, v, s, b, c);
196}
197
198// --|-|-
200 const Range& s,
201 Index b,
202 const Range& p,
203 Index r,
204 const Range& c) const {
205 CHECK(b);
206 CHECK(r);
207 return ConstTensor4View(
208 mdata + OFFSET(b) + OFFSET(r), mvr, msr, mpr, mcr, v, s, p, c);
209}
210
211// -|--|-
213 Index s,
214 const Range& b,
215 const Range& p,
216 Index r,
217 const Range& c) const {
218 CHECK(s);
219 CHECK(r);
220 return ConstTensor4View(
221 mdata + OFFSET(s) + OFFSET(r), mvr, mbr, mpr, mcr, v, b, p, c);
222}
223
224// |---|-
226 const Range& s,
227 const Range& b,
228 const Range& p,
229 Index r,
230 const Range& c) const {
231 CHECK(v);
232 CHECK(r);
233 return ConstTensor4View(
234 mdata + OFFSET(v) + OFFSET(r), msr, mbr, mpr, mcr, s, b, p, c);
235}
236
237// --||--
239 const Range& s,
240 Index b,
241 Index p,
242 const Range& r,
243 const Range& c) const {
244 CHECK(b);
245 CHECK(p);
246 return ConstTensor4View(
247 mdata + OFFSET(b) + OFFSET(p), mvr, msr, mrr, mcr, v, s, r, c);
248}
249
250// -|-|--
252 Index s,
253 const Range& b,
254 Index p,
255 const Range& r,
256 const Range& c) const {
257 CHECK(s);
258 CHECK(p);
259 return ConstTensor4View(
260 mdata + OFFSET(s) + OFFSET(p), mvr, mbr, mrr, mcr, v, b, r, c);
261}
262
263// |--|--
265 const Range& s,
266 const Range& b,
267 Index p,
268 const Range& r,
269 const Range& c) const {
270 CHECK(v);
271 CHECK(p);
272 return ConstTensor4View(
273 mdata + OFFSET(v) + OFFSET(p), msr, mbr, mrr, mcr, s, b, r, c);
274}
275
276// -||---
278 Index s,
279 Index b,
280 const Range& p,
281 const Range& r,
282 const Range& c) const {
283 CHECK(s);
284 CHECK(b);
285 return ConstTensor4View(
286 mdata + OFFSET(s) + OFFSET(b), mvr, mpr, mrr, mcr, v, p, r, c);
287}
288
289// |-|---
291 const Range& s,
292 Index b,
293 const Range& p,
294 const Range& r,
295 const Range& c) const {
296 CHECK(v);
297 CHECK(b);
298 return ConstTensor4View(
299 mdata + OFFSET(v) + OFFSET(b), msr, mpr, mrr, mcr, s, p, r, c);
300}
301
302// ||----
304 Index s,
305 const Range& b,
306 const Range& p,
307 const Range& r,
308 const Range& c) const {
309 CHECK(v);
310 CHECK(s);
311 return ConstTensor4View(
312 mdata + OFFSET(v) + OFFSET(s), mbr, mpr, mrr, mcr, b, p, r, c);
313}
314
315// Result 3D (4+3+2+1+ 3+2+1+ 2+1 +1 = 20 combinations)
316// ---|||
318 const Range& s,
319 const Range& b,
320 Index p,
321 Index r,
322 Index c) const {
323 CHECK(p);
324 CHECK(r);
325 CHECK(c);
326 return ConstTensor3View(
327 mdata + OFFSET(p) + OFFSET(r) + OFFSET(c), mvr, msr, mbr, v, s, b);
328}
329
330// --|-||
332 const Range& s,
333 Index b,
334 const Range& p,
335 Index r,
336 Index c) const {
337 CHECK(b);
338 CHECK(r);
339 CHECK(c);
340 return ConstTensor3View(
341 mdata + OFFSET(b) + OFFSET(r) + OFFSET(c), mvr, msr, mpr, v, s, p);
342}
343
344// -|--||
346 Index s,
347 const Range& b,
348 const Range& p,
349 Index r,
350 Index c) const {
351 CHECK(s);
352 CHECK(r);
353 CHECK(c);
354 return ConstTensor3View(
355 mdata + OFFSET(s) + OFFSET(r) + OFFSET(c), mvr, mbr, mpr, v, b, p);
356}
357
358// |---||
360 const Range& s,
361 const Range& b,
362 const Range& p,
363 Index r,
364 Index c) const {
365 CHECK(v);
366 CHECK(r);
367 CHECK(c);
368 return ConstTensor3View(
369 mdata + OFFSET(v) + OFFSET(r) + OFFSET(c), msr, mbr, mpr, s, b, p);
370}
371
372// --||-|
374 const Range& s,
375 Index b,
376 Index p,
377 const Range& r,
378 Index c) const {
379 CHECK(b);
380 CHECK(p);
381 CHECK(c);
382 return ConstTensor3View(
383 mdata + OFFSET(b) + OFFSET(p) + OFFSET(c), mvr, msr, mrr, v, s, r);
384}
385
386// -|-|-|
388 Index s,
389 const Range& b,
390 Index p,
391 const Range& r,
392 Index c) const {
393 CHECK(s);
394 CHECK(p);
395 CHECK(c);
396 return ConstTensor3View(
397 mdata + OFFSET(s) + OFFSET(p) + OFFSET(c), mvr, mbr, mrr, v, b, r);
398}
399
400// |--|-|
402 const Range& s,
403 const Range& b,
404 Index p,
405 const Range& r,
406 Index c) const {
407 CHECK(v);
408 CHECK(p);
409 CHECK(c);
410 return ConstTensor3View(
411 mdata + OFFSET(v) + OFFSET(p) + OFFSET(c), msr, mbr, mrr, s, b, r);
412}
413
414// -||--|
416 Index s,
417 Index b,
418 const Range& p,
419 const Range& r,
420 Index c) const {
421 CHECK(s);
422 CHECK(b);
423 CHECK(c);
424 return ConstTensor3View(
425 mdata + OFFSET(s) + OFFSET(b) + OFFSET(c), mvr, mpr, mrr, v, p, r);
426}
427
428// |-|--|
430 const Range& s,
431 Index b,
432 const Range& p,
433 const Range& r,
434 Index c) const {
435 CHECK(v);
436 CHECK(b);
437 CHECK(c);
438 return ConstTensor3View(
439 mdata + OFFSET(v) + OFFSET(b) + OFFSET(c), msr, mpr, mrr, s, p, r);
440}
441
442// ||---|
444 Index s,
445 const Range& b,
446 const Range& p,
447 const Range& r,
448 Index c) const {
449 CHECK(v);
450 CHECK(s);
451 CHECK(c);
452 return ConstTensor3View(
453 mdata + OFFSET(v) + OFFSET(s) + OFFSET(c), mbr, mpr, mrr, b, p, r);
454}
455
456// --|||-
458 const Range& s,
459 Index b,
460 Index p,
461 Index r,
462 const Range& c) const {
463 CHECK(b);
464 CHECK(p);
465 CHECK(r);
466 return ConstTensor3View(
467 mdata + OFFSET(b) + OFFSET(p) + OFFSET(r), mvr, msr, mcr, v, s, c);
468}
469
470// -|-||-
472 Index s,
473 const Range& b,
474 Index p,
475 Index r,
476 const Range& c) const {
477 CHECK(s);
478 CHECK(p);
479 CHECK(r);
480 return ConstTensor3View(
481 mdata + OFFSET(s) + OFFSET(p) + OFFSET(r), mvr, mbr, mcr, v, b, c);
482}
483
484// |--||-
486 const Range& s,
487 const Range& b,
488 Index p,
489 Index r,
490 const Range& c) const {
491 CHECK(v);
492 CHECK(p);
493 CHECK(r);
494 return ConstTensor3View(
495 mdata + OFFSET(v) + OFFSET(p) + OFFSET(r), msr, mbr, mcr, s, b, c);
496}
497
498// -||-|-
500 Index s,
501 Index b,
502 const Range& p,
503 Index r,
504 const Range& c) const {
505 CHECK(s);
506 CHECK(b);
507 CHECK(r);
508 return ConstTensor3View(
509 mdata + OFFSET(s) + OFFSET(b) + OFFSET(r), mvr, mpr, mcr, v, p, c);
510}
511
512// |-|-|-
514 const Range& s,
515 Index b,
516 const Range& p,
517 Index r,
518 const Range& c) const {
519 CHECK(v);
520 CHECK(b);
521 CHECK(r);
522 return ConstTensor3View(
523 mdata + OFFSET(v) + OFFSET(b) + OFFSET(r), msr, mpr, mcr, s, p, c);
524}
525
526// ||--|-
528 Index s,
529 const Range& b,
530 const Range& p,
531 Index r,
532 const Range& c) const {
533 CHECK(v);
534 CHECK(s);
535 CHECK(r);
536 return ConstTensor3View(
537 mdata + OFFSET(v) + OFFSET(s) + OFFSET(r), mbr, mpr, mcr, b, p, c);
538}
539
540// -|||--
542 Index s,
543 Index b,
544 Index p,
545 const Range& r,
546 const Range& c) const {
547 CHECK(s);
548 CHECK(b);
549 CHECK(p);
550 return ConstTensor3View(
551 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p), mvr, mrr, mcr, v, r, c);
552}
553
554// |-||--
556 const Range& s,
557 Index b,
558 Index p,
559 const Range& r,
560 const Range& c) const {
561 CHECK(v);
562 CHECK(b);
563 CHECK(p);
564 return ConstTensor3View(
565 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p), msr, mrr, mcr, s, r, c);
567
568// ||-|--
570 Index s,
571 const Range& b,
572 Index p,
573 const Range& r,
574 const Range& c) const {
575 CHECK(v);
576 CHECK(s);
577 CHECK(p);
578 return ConstTensor3View(
579 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p), mbr, mrr, mcr, b, r, c);
580}
581
582// |||---
584 Index s,
585 Index b,
586 const Range& p,
587 const Range& r,
588 const Range& c) const {
589 CHECK(v);
590 CHECK(s);
591 CHECK(b);
592 return ConstTensor3View(
593 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b), mpr, mrr, mcr, p, r, c);
594}
595
596// Result 2D (15 combinations)
597// IIII--
599 Index v, Index s, Index b, Index p, const Range& r, const Range& c) const {
600 CHECK(v);
601 CHECK(s);
602 CHECK(b);
603 CHECK(p);
604 return ConstMatrixView(
605 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p), mrr, mcr, r, c);
606}
607
608// III-I-
610 Index v, Index s, Index b, const Range& p, Index r, const Range& c) const {
611 CHECK(v);
612 CHECK(s);
613 CHECK(b);
614 CHECK(r);
615 return ConstMatrixView(
616 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(r), mpr, mcr, p, c);
617}
618
619// II-II-
621 Index v, Index s, const Range& b, Index p, Index r, const Range& c) const {
622 CHECK(v);
623 CHECK(s);
624 CHECK(p);
625 CHECK(r);
626 return ConstMatrixView(
627 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p) + OFFSET(r), mbr, mcr, b, c);
628}
629
630// I-III-
632 Index v, const Range& s, Index b, Index p, Index r, const Range& c) const {
633 CHECK(v);
634 CHECK(b);
635 CHECK(p);
636 CHECK(r);
637 return ConstMatrixView(
638 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p) + OFFSET(r), msr, mcr, s, c);
639}
640
641// -IIII-
643 const Range& v, Index s, Index b, Index p, Index r, const Range& c) const {
644 CHECK(s);
645 CHECK(b);
646 CHECK(p);
647 CHECK(r);
648 return ConstMatrixView(
649 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r), mvr, mcr, v, c);
650}
651
652// III--I
654 Index v, Index s, Index b, const Range& p, const Range& r, Index c) const {
655 CHECK(v);
656 CHECK(s);
657 CHECK(b);
658 CHECK(c);
659 return ConstMatrixView(
660 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(c), mpr, mrr, p, r);
661}
662
663// II-I-I
665 Index v, Index s, const Range& b, Index p, const Range& r, Index c) const {
666 CHECK(v);
667 CHECK(s);
668 CHECK(p);
669 CHECK(c);
670 return ConstMatrixView(
671 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p) + OFFSET(c), mbr, mrr, b, r);
672}
673
674// I-II-I
676 Index v, const Range& s, Index b, Index p, const Range& r, Index c) const {
677 CHECK(v);
678 CHECK(b);
679 CHECK(p);
680 CHECK(c);
681 return ConstMatrixView(
682 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p) + OFFSET(c), msr, mrr, s, r);
683}
684
685// -III-I
687 const Range& v, Index s, Index b, Index p, const Range& r, Index c) const {
688 CHECK(s);
689 CHECK(b);
690 CHECK(p);
691 CHECK(c);
692 return ConstMatrixView(
693 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(c), mvr, mrr, v, r);
694}
695
696// II--II
698 Index v, Index s, const Range& b, const Range& p, Index r, Index c) const {
699 CHECK(v);
700 CHECK(s);
701 CHECK(r);
702 CHECK(c);
703 return ConstMatrixView(
704 mdata + OFFSET(v) + OFFSET(s) + OFFSET(r) + OFFSET(c), mbr, mpr, b, p);
705}
706
707// I-I-II
709 Index v, const Range& s, Index b, const Range& p, Index r, Index c) const {
710 CHECK(v);
711 CHECK(b);
712 CHECK(r);
713 CHECK(c);
714 return ConstMatrixView(
715 mdata + OFFSET(v) + OFFSET(b) + OFFSET(r) + OFFSET(c), msr, mpr, s, p);
716}
717
718// -II-II
720 const Range& v, Index s, Index b, const Range& p, Index r, Index c) const {
721 CHECK(s);
722 CHECK(b);
723 CHECK(r);
724 CHECK(c);
725 return ConstMatrixView(
726 mdata + OFFSET(s) + OFFSET(b) + OFFSET(r) + OFFSET(c), mvr, mpr, v, p);
727}
728
729// I--III
731 Index v, const Range& s, const Range& b, Index p, Index r, Index c) const {
732 CHECK(v);
733 CHECK(p);
734 CHECK(r);
735 CHECK(c);
736 return ConstMatrixView(
737 mdata + OFFSET(v) + OFFSET(p) + OFFSET(r) + OFFSET(c), msr, mbr, s, b);
738}
739
740// -I-III
742 const Range& v, Index s, const Range& b, Index p, Index r, Index c) const {
743 CHECK(s);
744 CHECK(p);
745 CHECK(r);
746 CHECK(c);
747 return ConstMatrixView(
748 mdata + OFFSET(s) + OFFSET(p) + OFFSET(r) + OFFSET(c), mvr, mbr, v, b);
749}
750
751// --IIII
753 const Range& v, const Range& s, Index b, Index p, Index r, Index c) const {
754 CHECK(b);
755 CHECK(p);
756 CHECK(r);
757 CHECK(c);
758 return ConstMatrixView(
759 mdata + OFFSET(b) + OFFSET(p) + OFFSET(r) + OFFSET(c), mvr, msr, v, s);
760}
761
762// Result 1D (6 combinations)
763// IIIII-
765 Index v, Index s, Index b, Index p, Index r, const Range& c) const {
766 CHECK(v);
767 CHECK(s);
768 CHECK(b);
769 CHECK(p);
770 CHECK(r);
771 return ConstVectorView(
772 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r),
773 mcr,
774 c);
775}
776
777// IIII-I
779 Index v, Index s, Index b, Index p, const Range& r, Index c) const {
780 CHECK(v);
781 CHECK(s);
782 CHECK(b);
783 CHECK(p);
784 CHECK(c);
785 return ConstVectorView(
786 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(c),
787 mrr,
788 r);
789}
790
791// III-II
793 Index v, Index s, Index b, const Range& p, Index r, Index c) const {
794 CHECK(v);
795 CHECK(s);
796 CHECK(b);
797 CHECK(r);
798 CHECK(c);
799 return ConstVectorView(
800 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(r) + OFFSET(c),
801 mpr,
802 p);
803}
804
805// II-III
807 Index v, Index s, const Range& b, Index p, Index r, Index c) const {
808 CHECK(v);
809 CHECK(s);
810 CHECK(p);
811 CHECK(r);
812 CHECK(c);
813 return ConstVectorView(
814 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p) + OFFSET(r) + OFFSET(c),
815 mbr,
816 b);
817}
818
819// I-IIII
821 Index v, const Range& s, Index b, Index p, Index r, Index c) const {
822 CHECK(v);
823 CHECK(b);
824 CHECK(p);
825 CHECK(r);
826 CHECK(c);
827 return ConstVectorView(
828 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p) + OFFSET(r) + OFFSET(c),
829 msr,
830 s);
831}
832
833// -IIIII
835 const Range& v, Index s, Index b, Index p, Index r, Index c) const {
836 CHECK(s);
837 CHECK(b);
838 CHECK(p);
839 CHECK(r);
840 CHECK(c);
841 return ConstVectorView(
842 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r) + OFFSET(c),
843 mvr,
844 v);
845}
846
849 return ConstIterator6D(
851 mvr.mstride);
852}
853
856 return ConstIterator6D(
858 msr,
859 mbr,
860 mpr,
861 mrr,
862 mcr),
863 mvr.mstride);
864}
865
868 : mvr(0,
869 1,
870 a.msr.mextent * a.mbr.mextent * a.mpr.mextent * a.mrr.mextent *
871 a.mcr.mextent),
872 msr(a.msr),
873 mbr(a.mbr),
874 mpr(a.mpr),
875 mrr(a.mrr),
876 mcr(a.mcr),
877 mdata(a.mdata) {
878 // Nothing to do here.
879}
880
886 const Range& v,
887 const Range& s,
888 const Range& b,
889 const Range& p,
890 const Range& r,
891 const Range& c)
892 : mvr(v), msr(s), mbr(b), mpr(p), mrr(r), mcr(c), mdata(data) {
893 // Nothing to do here.
894}
895
904 const Range& pv,
905 const Range& ps,
906 const Range& pb,
907 const Range& pp,
908 const Range& pr,
909 const Range& pc,
910 const Range& nv,
911 const Range& ns,
912 const Range& nb,
913 const Range& np,
914 const Range& nr,
915 const Range& nc)
916 : mvr(pv, nv),
917 msr(ps, ns),
918 mbr(pb, nb),
919 mpr(pp, np),
920 mrr(pr, nr),
921 mcr(pc, nc),
922 mdata(data) {
923 // Nothing to do here.
924}
925
929std::ostream& operator<<(std::ostream& os, const ConstTensor6View& v) {
930 // Page iterators:
931 ConstIterator6D ip = v.begin();
932 const ConstIterator6D end_page = v.end();
933
934 if (ip != end_page) {
935 os << *ip;
936 ++ip;
937 }
938
939 for (; ip != end_page; ++ip) {
940 os << "\n\n";
941 os << *ip;
942 }
943
944 return os;
945}
946
947// Functions for Tensor6View:
948// -------------------------
949
950// Non-const index operators:
951
952// Result 6D (1 combination)
953// ------
955 const Range& s,
956 const Range& b,
957 const Range& p,
958 const Range& r,
959 const Range& c) {
960 return Tensor6View(mdata, mvr, msr, mbr, mpr, mrr, mcr, v, s, b, p, r, c);
961}
962
963// Result 5D (6 combinations)
964// -----|
966 const Range& s,
967 const Range& b,
968 const Range& p,
969 const Range& r,
970 Index c) {
971 CHECK(c);
972 return Tensor5View(mdata + OFFSET(c), mvr, msr, mbr, mpr, mrr, v, s, b, p, r);
973}
974
975// ----|-
977 const Range& s,
978 const Range& b,
979 const Range& p,
980 Index r,
981 const Range& c) {
982 CHECK(r);
983 return Tensor5View(mdata + OFFSET(r), mvr, msr, mbr, mpr, mcr, v, s, b, p, c);
984}
985
986// ---|--
988 const Range& s,
989 const Range& b,
990 Index p,
991 const Range& r,
992 const Range& c) {
993 CHECK(p);
994 return Tensor5View(mdata + OFFSET(p), mvr, msr, mbr, mrr, mcr, v, s, b, r, c);
995}
996
997// --|---
999 const Range& s,
1000 Index b,
1001 const Range& p,
1002 const Range& r,
1003 const Range& c) {
1004 CHECK(b);
1005 return Tensor5View(mdata + OFFSET(b), mvr, msr, mpr, mrr, mcr, v, s, p, r, c);
1006}
1007
1008// -|----
1010 Index s,
1011 const Range& b,
1012 const Range& p,
1013 const Range& r,
1014 const Range& c) {
1015 CHECK(s);
1016 return Tensor5View(mdata + OFFSET(s), mvr, mbr, mpr, mrr, mcr, v, b, p, r, c);
1017}
1018
1019// |-----
1021 const Range& s,
1022 const Range& b,
1023 const Range& p,
1024 const Range& r,
1025 const Range& c) {
1026 CHECK(v);
1027 return Tensor5View(mdata + OFFSET(v), msr, mbr, mpr, mrr, mcr, s, b, p, r, c);
1028}
1029
1030// Result 4D (5+4+3+2+1 = 15 combinations)
1031// ----||
1033 const Range& s,
1034 const Range& b,
1035 const Range& p,
1036 Index r,
1037 Index c) {
1038 CHECK(r);
1039 CHECK(c);
1040 return Tensor4View(
1041 mdata + OFFSET(r) + OFFSET(c), mvr, msr, mbr, mpr, v, s, b, p);
1042}
1043
1044// ---|-|
1046 const Range& s,
1047 const Range& b,
1048 Index p,
1049 const Range& r,
1050 Index c) {
1051 CHECK(p);
1052 CHECK(c);
1053 return Tensor4View(
1054 mdata + OFFSET(p) + OFFSET(c), mvr, msr, mbr, mrr, v, s, b, r);
1055}
1056
1057// --|--|
1059 const Range& s,
1060 Index b,
1061 const Range& p,
1062 const Range& r,
1063 Index c) {
1064 CHECK(b);
1065 CHECK(c);
1066 return Tensor4View(
1067 mdata + OFFSET(b) + OFFSET(c), mvr, msr, mpr, mrr, v, s, p, r);
1068}
1069
1070// -|---|
1072 Index s,
1073 const Range& b,
1074 const Range& p,
1075 const Range& r,
1076 Index c) {
1077 CHECK(s);
1078 CHECK(c);
1079 return Tensor4View(
1080 mdata + OFFSET(s) + OFFSET(c), mvr, mbr, mpr, mrr, v, b, p, r);
1081}
1082
1083// |----|
1085 const Range& s,
1086 const Range& b,
1087 const Range& p,
1088 const Range& r,
1089 Index c) {
1090 CHECK(v);
1091 CHECK(c);
1092 return Tensor4View(
1093 mdata + OFFSET(v) + OFFSET(c), msr, mbr, mpr, mrr, s, b, p, r);
1094}
1095
1096// ---||-
1098 const Range& s,
1099 const Range& b,
1100 Index p,
1101 Index r,
1102 const Range& c) {
1103 CHECK(p);
1104 CHECK(r);
1105 return Tensor4View(
1106 mdata + OFFSET(p) + OFFSET(r), mvr, msr, mbr, mcr, v, s, b, c);
1107}
1108
1109// --|-|-
1111 const Range& s,
1112 Index b,
1113 const Range& p,
1114 Index r,
1115 const Range& c) {
1116 CHECK(b);
1117 CHECK(r);
1118 return Tensor4View(
1119 mdata + OFFSET(b) + OFFSET(r), mvr, msr, mpr, mcr, v, s, p, c);
1120}
1121
1122// -|--|-
1124 Index s,
1125 const Range& b,
1126 const Range& p,
1127 Index r,
1128 const Range& c) {
1129 CHECK(s);
1130 CHECK(r);
1131 return Tensor4View(
1132 mdata + OFFSET(s) + OFFSET(r), mvr, mbr, mpr, mcr, v, b, p, c);
1133}
1134
1135// |---|-
1137 const Range& s,
1138 const Range& b,
1139 const Range& p,
1140 Index r,
1141 const Range& c) {
1142 CHECK(v);
1143 CHECK(r);
1144 return Tensor4View(
1145 mdata + OFFSET(v) + OFFSET(r), msr, mbr, mpr, mcr, s, b, p, c);
1146}
1147
1148// --||--
1150 const Range& s,
1151 Index b,
1152 Index p,
1153 const Range& r,
1154 const Range& c) {
1155 CHECK(b);
1156 CHECK(p);
1157 return Tensor4View(
1158 mdata + OFFSET(b) + OFFSET(p), mvr, msr, mrr, mcr, v, s, r, c);
1159}
1160
1161// -|-|--
1163 Index s,
1164 const Range& b,
1165 Index p,
1166 const Range& r,
1167 const Range& c) {
1168 CHECK(s);
1169 CHECK(p);
1170 return Tensor4View(
1171 mdata + OFFSET(s) + OFFSET(p), mvr, mbr, mrr, mcr, v, b, r, c);
1172}
1173
1174// |--|--
1176 const Range& s,
1177 const Range& b,
1178 Index p,
1179 const Range& r,
1180 const Range& c) {
1181 CHECK(v);
1182 CHECK(p);
1183 return Tensor4View(
1184 mdata + OFFSET(v) + OFFSET(p), msr, mbr, mrr, mcr, s, b, r, c);
1185}
1186
1187// -||---
1189 Index s,
1190 Index b,
1191 const Range& p,
1192 const Range& r,
1193 const Range& c) {
1194 CHECK(s);
1195 CHECK(b);
1196 return Tensor4View(
1197 mdata + OFFSET(s) + OFFSET(b), mvr, mpr, mrr, mcr, v, p, r, c);
1198}
1199
1200// |-|---
1202 const Range& s,
1203 Index b,
1204 const Range& p,
1205 const Range& r,
1206 const Range& c) {
1207 CHECK(v);
1208 CHECK(b);
1209 return Tensor4View(
1210 mdata + OFFSET(v) + OFFSET(b), msr, mpr, mrr, mcr, s, p, r, c);
1211}
1212
1213// ||----
1215 Index s,
1216 const Range& b,
1217 const Range& p,
1218 const Range& r,
1219 const Range& c) {
1220 CHECK(v);
1221 CHECK(s);
1222 return Tensor4View(
1223 mdata + OFFSET(v) + OFFSET(s), mbr, mpr, mrr, mcr, b, p, r, c);
1224}
1225
1226// Result 3D (4+3+2+1+ 3+2+1+ 2+1 +1 = 20 combinations)
1227// ---|||
1229 const Range& v, const Range& s, const Range& b, Index p, Index r, Index c) {
1230 CHECK(p);
1231 CHECK(r);
1232 CHECK(c);
1233 return Tensor3View(
1234 mdata + OFFSET(p) + OFFSET(r) + OFFSET(c), mvr, msr, mbr, v, s, b);
1235}
1236
1237// --|-||
1239 const Range& v, const Range& s, Index b, const Range& p, Index r, Index c) {
1240 CHECK(b);
1241 CHECK(r);
1242 CHECK(c);
1243 return Tensor3View(
1244 mdata + OFFSET(b) + OFFSET(r) + OFFSET(c), mvr, msr, mpr, v, s, p);
1245}
1246
1247// -|--||
1249 const Range& v, Index s, const Range& b, const Range& p, Index r, Index c) {
1250 CHECK(s);
1251 CHECK(r);
1252 CHECK(c);
1253 return Tensor3View(
1254 mdata + OFFSET(s) + OFFSET(r) + OFFSET(c), mvr, mbr, mpr, v, b, p);
1255}
1256
1257// |---||
1259 Index v, const Range& s, const Range& b, const Range& p, Index r, Index c) {
1260 CHECK(v);
1261 CHECK(r);
1262 CHECK(c);
1263 return Tensor3View(
1264 mdata + OFFSET(v) + OFFSET(r) + OFFSET(c), msr, mbr, mpr, s, b, p);
1265}
1266
1267// --||-|
1269 const Range& v, const Range& s, Index b, Index p, const Range& r, Index c) {
1270 CHECK(b);
1271 CHECK(p);
1272 CHECK(c);
1273 return Tensor3View(
1274 mdata + OFFSET(b) + OFFSET(p) + OFFSET(c), mvr, msr, mrr, v, s, r);
1275}
1276
1277// -|-|-|
1279 const Range& v, Index s, const Range& b, Index p, const Range& r, Index c) {
1280 CHECK(s);
1281 CHECK(p);
1282 CHECK(c);
1283 return Tensor3View(
1284 mdata + OFFSET(s) + OFFSET(p) + OFFSET(c), mvr, mbr, mrr, v, b, r);
1285}
1286
1287// |--|-|
1289 Index v, const Range& s, const Range& b, Index p, const Range& r, Index c) {
1290 CHECK(v);
1291 CHECK(p);
1292 CHECK(c);
1293 return Tensor3View(
1294 mdata + OFFSET(v) + OFFSET(p) + OFFSET(c), msr, mbr, mrr, s, b, r);
1295}
1296
1297// -||--|
1299 const Range& v, Index s, Index b, const Range& p, const Range& r, Index c) {
1300 CHECK(s);
1301 CHECK(b);
1302 CHECK(c);
1303 return Tensor3View(
1304 mdata + OFFSET(s) + OFFSET(b) + OFFSET(c), mvr, mpr, mrr, v, p, r);
1305}
1306
1307// |-|--|
1309 Index v, const Range& s, Index b, const Range& p, const Range& r, Index c) {
1310 CHECK(v);
1311 CHECK(b);
1312 CHECK(c);
1313 return Tensor3View(
1314 mdata + OFFSET(v) + OFFSET(b) + OFFSET(c), msr, mpr, mrr, s, p, r);
1315}
1316
1317// ||---|
1319 Index v, Index s, const Range& b, const Range& p, const Range& r, Index c) {
1320 CHECK(v);
1321 CHECK(s);
1322 CHECK(c);
1323 return Tensor3View(
1324 mdata + OFFSET(v) + OFFSET(s) + OFFSET(c), mbr, mpr, mrr, b, p, r);
1325}
1326
1327// --|||-
1329 const Range& v, const Range& s, Index b, Index p, Index r, const Range& c) {
1330 CHECK(b);
1331 CHECK(p);
1332 CHECK(r);
1333 return Tensor3View(
1334 mdata + OFFSET(b) + OFFSET(p) + OFFSET(r), mvr, msr, mcr, v, s, c);
1335}
1336
1337// -|-||-
1339 const Range& v, Index s, const Range& b, Index p, Index r, const Range& c) {
1340 CHECK(s);
1341 CHECK(p);
1342 CHECK(r);
1343 return Tensor3View(
1344 mdata + OFFSET(s) + OFFSET(p) + OFFSET(r), mvr, mbr, mcr, v, b, c);
1345}
1346
1347// |--||-
1349 Index v, const Range& s, const Range& b, Index p, Index r, const Range& c) {
1350 CHECK(v);
1351 CHECK(p);
1352 CHECK(r);
1353 return Tensor3View(
1354 mdata + OFFSET(v) + OFFSET(p) + OFFSET(r), msr, mbr, mcr, s, b, c);
1355}
1356
1357// -||-|-
1359 const Range& v, Index s, Index b, const Range& p, Index r, const Range& c) {
1360 CHECK(s);
1361 CHECK(b);
1362 CHECK(r);
1363 return Tensor3View(
1364 mdata + OFFSET(s) + OFFSET(b) + OFFSET(r), mvr, mpr, mcr, v, p, c);
1365}
1366
1367// |-|-|-
1369 Index v, const Range& s, Index b, const Range& p, Index r, const Range& c) {
1370 CHECK(v);
1371 CHECK(b);
1372 CHECK(r);
1373 return Tensor3View(
1374 mdata + OFFSET(v) + OFFSET(b) + OFFSET(r), msr, mpr, mcr, s, p, c);
1375}
1376
1377// ||--|-
1379 Index v, Index s, const Range& b, const Range& p, Index r, const Range& c) {
1380 CHECK(v);
1381 CHECK(s);
1382 CHECK(r);
1383 return Tensor3View(
1384 mdata + OFFSET(v) + OFFSET(s) + OFFSET(r), mbr, mpr, mcr, b, p, c);
1385}
1386
1387// -|||--
1389 const Range& v, Index s, Index b, Index p, const Range& r, const Range& c) {
1390 CHECK(s);
1391 CHECK(b);
1392 CHECK(p);
1393 return Tensor3View(
1394 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p), mvr, mrr, mcr, v, r, c);
1395}
1396
1397// |-||--
1399 Index v, const Range& s, Index b, Index p, const Range& r, const Range& c) {
1400 CHECK(v);
1401 CHECK(b);
1402 CHECK(p);
1403 return Tensor3View(
1404 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p), msr, mrr, mcr, s, r, c);
1405}
1406
1407// ||-|--
1409 Index v, Index s, const Range& b, Index p, const Range& r, const Range& c) {
1410 CHECK(v);
1411 CHECK(s);
1412 CHECK(p);
1413 return Tensor3View(
1414 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p), mbr, mrr, mcr, b, r, c);
1415}
1416
1417// |||---
1419 Index v, Index s, Index b, const Range& p, const Range& r, const Range& c) {
1420 CHECK(v);
1421 CHECK(s);
1422 CHECK(b);
1423 return Tensor3View(
1424 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b), mpr, mrr, mcr, p, r, c);
1425}
1426
1427// Result 2D (15 combinations)
1428// IIII--
1430 Index v, Index s, Index b, Index p, const Range& r, const Range& c) {
1431 CHECK(v);
1432 CHECK(s);
1433 CHECK(b);
1434 CHECK(p);
1435 return MatrixView(
1436 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p), mrr, mcr, r, c);
1437}
1438
1439// III-I-
1441 Index v, Index s, Index b, const Range& p, Index r, const Range& c) {
1442 CHECK(v);
1443 CHECK(s);
1444 CHECK(b);
1445 CHECK(r);
1446 return MatrixView(
1447 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(r), mpr, mcr, p, c);
1448}
1449
1450// II-II-
1452 Index v, Index s, const Range& b, Index p, Index r, const Range& c) {
1453 CHECK(v);
1454 CHECK(s);
1455 CHECK(p);
1456 CHECK(r);
1457 return MatrixView(
1458 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p) + OFFSET(r), mbr, mcr, b, c);
1459}
1460
1461// I-III-
1463 Index v, const Range& s, Index b, Index p, Index r, const Range& c) {
1464 CHECK(v);
1465 CHECK(b);
1466 CHECK(p);
1467 CHECK(r);
1468 return MatrixView(
1469 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p) + OFFSET(r), msr, mcr, s, c);
1470}
1471
1472// -IIII-
1474 const Range& v, Index s, Index b, Index p, Index r, const Range& c) {
1475 CHECK(s);
1476 CHECK(b);
1477 CHECK(p);
1478 CHECK(r);
1479 return MatrixView(
1480 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r), mvr, mcr, v, c);
1481}
1482
1483// III--I
1485 Index v, Index s, Index b, const Range& p, const Range& r, Index c) {
1486 CHECK(v);
1487 CHECK(s);
1488 CHECK(b);
1489 CHECK(c);
1490 return MatrixView(
1491 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(c), mpr, mrr, p, r);
1492}
1493
1494// II-I-I
1496 Index v, Index s, const Range& b, Index p, const Range& r, Index c) {
1497 CHECK(v);
1498 CHECK(s);
1499 CHECK(p);
1500 CHECK(c);
1501 return MatrixView(
1502 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p) + OFFSET(c), mbr, mrr, b, r);
1503}
1504
1505// I-II-I
1507 Index v, const Range& s, Index b, Index p, const Range& r, Index c) {
1508 CHECK(v);
1509 CHECK(b);
1510 CHECK(p);
1511 CHECK(c);
1512 return MatrixView(
1513 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p) + OFFSET(c), msr, mrr, s, r);
1514}
1515
1516// -III-I
1518 const Range& v, Index s, Index b, Index p, const Range& r, Index c) {
1519 CHECK(s);
1520 CHECK(b);
1521 CHECK(p);
1522 CHECK(c);
1523 return MatrixView(
1524 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(c), mvr, mrr, v, r);
1525}
1526
1527// II--II
1529 Index v, Index s, const Range& b, const Range& p, Index r, Index c) {
1530 CHECK(v);
1531 CHECK(s);
1532 CHECK(r);
1533 CHECK(c);
1534 return MatrixView(
1535 mdata + OFFSET(v) + OFFSET(s) + OFFSET(r) + OFFSET(c), mbr, mpr, b, p);
1536}
1537
1538// I-I-II
1540 Index v, const Range& s, Index b, const Range& p, Index r, Index c) {
1541 CHECK(v);
1542 CHECK(b);
1543 CHECK(r);
1544 CHECK(c);
1545 return MatrixView(
1546 mdata + OFFSET(v) + OFFSET(b) + OFFSET(r) + OFFSET(c), msr, mpr, s, p);
1547}
1548
1549// -II-II
1551 const Range& v, Index s, Index b, const Range& p, Index r, Index c) {
1552 CHECK(s);
1553 CHECK(b);
1554 CHECK(r);
1555 CHECK(c);
1556 return MatrixView(
1557 mdata + OFFSET(s) + OFFSET(b) + OFFSET(r) + OFFSET(c), mvr, mpr, v, p);
1558}
1559
1560// I--III
1562 Index v, const Range& s, const Range& b, Index p, Index r, Index c) {
1563 CHECK(v);
1564 CHECK(p);
1565 CHECK(r);
1566 CHECK(c);
1567 return MatrixView(
1568 mdata + OFFSET(v) + OFFSET(p) + OFFSET(r) + OFFSET(c), msr, mbr, s, b);
1569}
1570
1571// -I-III
1573 const Range& v, Index s, const Range& b, Index p, Index r, Index c) {
1574 CHECK(s);
1575 CHECK(p);
1576 CHECK(r);
1577 CHECK(c);
1578 return MatrixView(
1579 mdata + OFFSET(s) + OFFSET(p) + OFFSET(r) + OFFSET(c), mvr, mbr, v, b);
1580}
1581
1582// --IIII
1584 const Range& v, const Range& s, Index b, Index p, Index r, Index c) {
1585 CHECK(b);
1586 CHECK(p);
1587 CHECK(r);
1588 CHECK(c);
1589 return MatrixView(
1590 mdata + OFFSET(b) + OFFSET(p) + OFFSET(r) + OFFSET(c), mvr, msr, v, s);
1591}
1592
1593// Result 1D (6 combinations)
1594// IIIII-
1596 Index v, Index s, Index b, Index p, Index r, const Range& c) {
1597 CHECK(v);
1598 CHECK(s);
1599 CHECK(b);
1600 CHECK(p);
1601 CHECK(r);
1602 return VectorView(
1603 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r),
1604 mcr,
1605 c);
1606}
1607
1608// IIII-I
1610 Index v, Index s, Index b, Index p, const Range& r, Index c) {
1611 CHECK(v);
1612 CHECK(s);
1613 CHECK(b);
1614 CHECK(p);
1615 CHECK(c);
1616 return VectorView(
1617 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(c),
1618 mrr,
1619 r);
1620}
1621
1622// III-II
1624 Index v, Index s, Index b, const Range& p, Index r, Index c) {
1625 CHECK(v);
1626 CHECK(s);
1627 CHECK(b);
1628 CHECK(r);
1629 CHECK(c);
1630 return VectorView(
1631 mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(r) + OFFSET(c),
1632 mpr,
1633 p);
1634}
1635
1636// II-III
1638 Index v, Index s, const Range& b, Index p, Index r, Index c) {
1639 CHECK(v);
1640 CHECK(s);
1641 CHECK(p);
1642 CHECK(r);
1643 CHECK(c);
1644 return VectorView(
1645 mdata + OFFSET(v) + OFFSET(s) + OFFSET(p) + OFFSET(r) + OFFSET(c),
1646 mbr,
1647 b);
1648}
1649
1650// I-IIII
1652 Index v, const Range& s, Index b, Index p, Index r, Index c) {
1653 CHECK(v);
1654 CHECK(b);
1655 CHECK(p);
1656 CHECK(r);
1657 CHECK(c);
1658 return VectorView(
1659 mdata + OFFSET(v) + OFFSET(b) + OFFSET(p) + OFFSET(r) + OFFSET(c),
1660 msr,
1661 s);
1662}
1663
1664// -IIIII
1666 const Range& v, Index s, Index b, Index p, Index r, Index c) {
1667 CHECK(s);
1668 CHECK(b);
1669 CHECK(p);
1670 CHECK(r);
1671 CHECK(c);
1672 return VectorView(
1673 mdata + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r) + OFFSET(c),
1674 mvr,
1675 v);
1676}
1677
1685 ARTS_ASSERT(mvr.mstart == 0 and
1687 mbr.mextent * msr.mextent or
1688 size() == 0),
1689 "Vitrine ",
1690 mvr)
1691 ARTS_ASSERT(msr.mstart == 0 and
1692 (msr.mstride ==
1694 size() == 0),
1695 "Shelve ",
1696 msr)
1697 ARTS_ASSERT(mbr.mstart == 0 and
1699 size() == 0),
1700 "Book ",
1701 mbr)
1702 ARTS_ASSERT(mpr.mstart == 0 and
1703 (mpr.mstride == mcr.mextent * mrr.mextent or size() == 0),
1704 "Page ",
1705 mpr)
1706 ARTS_ASSERT(mrr.mstart == 0 and (mrr.mstride == mcr.mextent or size() == 0),
1707 "Row ",
1708 mrr)
1710 mcr.mstart == 0 and (mcr.mstride == 1 or size() == 0), "Column ", mcr)
1711
1712 return mdata;
1713}
1714
1722 ARTS_ASSERT(mvr.mstart == 0 and
1724 mbr.mextent * msr.mextent or
1725 size() == 0),
1726 "Vitrine ",
1727 mvr)
1728 ARTS_ASSERT(msr.mstart == 0 and
1729 (msr.mstride ==
1731 size() == 0),
1732 "Shelve ",
1733 msr)
1734 ARTS_ASSERT(mbr.mstart == 0 and
1736 size() == 0),
1737 "Book ",
1738 mbr)
1739 ARTS_ASSERT(mpr.mstart == 0 and
1740 (mpr.mstride == mcr.mextent * mrr.mextent or size() == 0),
1741 "Page ",
1742 mpr)
1743 ARTS_ASSERT(mrr.mstart == 0 and (mrr.mstride == mcr.mextent or size() == 0),
1744 "Row ",
1745 mrr)
1747 mcr.mstart == 0 and (mcr.mstride == 1 or size() == 0), "Column ", mcr)
1748
1749 return mdata;
1750}
1751
1755 mvr.mstride);
1756}
1757
1760 return Iterator6D(
1762 msr,
1763 mbr,
1764 mpr,
1765 mrr,
1766 mcr),
1767 mvr.mstride);
1768}
1769
1775 // Check that sizes are compatible:
1782
1783 copy(m.begin(), m.end(), begin());
1784 return *this;
1785}
1786
1793 // Check that sizes are compatible:
1800
1801 copy(m.begin(), m.end(), begin());
1802 return *this;
1803}
1804
1809 // Check that sizes are compatible:
1816
1817 copy(m.begin(), m.end(), begin());
1818 return *this;
1819}
1820
1824 copy(x, begin(), end());
1825 return *this;
1826}
1827
1828// Some little helper functions:
1829//------------------------------
1830
1833 const Iterator6D ep = end();
1834 for (Iterator6D p = begin(); p != ep; ++p) {
1835 *p *= x;
1836 }
1837 return *this;
1838}
1839
1842 const Iterator6D ep = end();
1843 for (Iterator6D p = begin(); p != ep; ++p) {
1844 *p /= x;
1845 }
1846 return *this;
1847}
1848
1851 const Iterator6D ep = end();
1852 for (Iterator6D p = begin(); p != ep; ++p) {
1853 *p += x;
1854 }
1855 return *this;
1856}
1857
1860 const Iterator6D ep = end();
1861 for (Iterator6D p = begin(); p != ep; ++p) {
1862 *p -= x;
1863 }
1864 return *this;
1865}
1866
1870 ARTS_ASSERT(nshelves() == x.nshelves());
1871 ARTS_ASSERT(nbooks() == x.nbooks());
1872 ARTS_ASSERT(npages() == x.npages());
1873 ARTS_ASSERT(nrows() == x.nrows());
1874 ARTS_ASSERT(ncols() == x.ncols());
1875 ConstIterator6D xp = x.begin();
1876 Iterator6D p = begin();
1877 const Iterator6D ep = end();
1878 for (; p != ep; ++p, ++xp) {
1879 *p *= *xp;
1880 }
1881 return *this;
1882}
1883
1887 ARTS_ASSERT(nshelves() == x.nshelves());
1888 ARTS_ASSERT(nbooks() == x.nbooks());
1889 ARTS_ASSERT(npages() == x.npages());
1890 ARTS_ASSERT(nrows() == x.nrows());
1891 ARTS_ASSERT(ncols() == x.ncols());
1892 ConstIterator6D xp = x.begin();
1893 Iterator6D p = begin();
1894 const Iterator6D ep = end();
1895 for (; p != ep; ++p, ++xp) {
1896 *p /= *xp;
1897 }
1898 return *this;
1899}
1900
1904 ARTS_ASSERT(nshelves() == x.nshelves());
1905 ARTS_ASSERT(nbooks() == x.nbooks());
1906 ARTS_ASSERT(npages() == x.npages());
1907 ARTS_ASSERT(nrows() == x.nrows());
1908 ARTS_ASSERT(ncols() == x.ncols());
1909 ConstIterator6D xp = x.begin();
1910 Iterator6D p = begin();
1911 const Iterator6D ep = end();
1912 for (; p != ep; ++p, ++xp) {
1913 *p += *xp;
1914 }
1915 return *this;
1916}
1917
1921 ARTS_ASSERT(nshelves() == x.nshelves());
1922 ARTS_ASSERT(nbooks() == x.nbooks());
1923 ARTS_ASSERT(npages() == x.npages());
1924 ARTS_ASSERT(nrows() == x.nrows());
1925 ARTS_ASSERT(ncols() == x.ncols());
1926 ConstIterator6D xp = x.begin();
1927 Iterator6D p = begin();
1928 const Iterator6D ep = end();
1929 for (; p != ep; ++p, ++xp) {
1930 *p -= *xp;
1931 }
1932 return *this;
1933}
1934
1937 : ConstTensor6View(a.mdata,
1938 Range(0,
1939 1,
1940 a.msr.mextent * a.mbr.mextent * a.mpr.mextent *
1941 a.mrr.mextent * a.mcr.mextent),
1942 a.msr,
1943 a.mbr,
1944 a.mpr,
1945 a.mrr,
1946 a.mcr) {
1947 // Nothing to do here.
1948}
1949
1954 const Range& v,
1955 const Range& s,
1956 const Range& b,
1957 const Range& p,
1958 const Range& r,
1959 const Range& c)
1960 : ConstTensor6View(data, v, s, b, p, r, c) {
1961 // Nothing to do here.
1962}
1963
1987 const Range& pv,
1988 const Range& ps,
1989 const Range& pb,
1990 const Range& pp,
1991 const Range& pr,
1992 const Range& pc,
1993 const Range& nv,
1994 const Range& ns,
1995 const Range& nb,
1996 const Range& np,
1997 const Range& nr,
1998 const Range& nc)
1999 : ConstTensor6View(data, pv, ps, pb, pp, pr, pc, nv, ns, nb, np, nr, nc) {
2000 // Nothing to do here.
2001}
2002
2008 const ConstIterator6D& end,
2009 Iterator6D target) {
2010 for (; origin != end; ++origin, ++target) {
2011 // We use the copy function for the next smaller rank of tensor
2012 // recursively:
2013 copy(origin->begin(), origin->end(), target->begin());
2014 }
2015}
2016
2018void copy(Numeric x, Iterator6D target, const Iterator6D& end) {
2019 for (; target != end; ++target) {
2020 // We use the copy function for the next smaller rank of tensor
2021 // recursively:
2022 copy(x, target->begin(), target->end());
2023 }
2024}
2025
2026// Functions for Tensor6:
2027// ---------------------
2028
2032 : Tensor6View(new Numeric[v * s * b * p * r * c],
2033 Range(0, v, s * b * p * r * c),
2034 Range(0, s, b * p * r * c),
2035 Range(0, b, p * r * c),
2036 Range(0, p, r * c),
2037 Range(0, r, c),
2038 Range(0, c)) {
2039 // Nothing to do here.
2040}
2041
2044 Index v, Index s, Index b, Index p, Index r, Index c, Numeric fill)
2045 : Tensor6View(new Numeric[v * s * b * p * r * c],
2046 Range(0, v, s * b * p * r * c),
2047 Range(0, s, b * p * r * c),
2048 Range(0, b, p * r * c),
2049 Range(0, p, r * c),
2050 Range(0, r, c),
2051 Range(0, c)) {
2052 // Here we can access the raw memory directly, for slightly
2053 // increased efficiency:
2054 std::fill_n(mdata, v * s * b * p * r * c, fill);
2055}
2056
2060 : Tensor6View(
2061 new Numeric[m.nvitrines() * m.nshelves() * m.nbooks() * m.npages() *
2062 m.nrows() * m.ncols()],
2063 Range(0,
2064 m.nvitrines(),
2065 m.nshelves() * m.nbooks() * m.npages() * m.nrows() * m.ncols()),
2066 Range(
2067 0, m.nshelves(), m.nbooks() * m.npages() * m.nrows() * m.ncols()),
2068 Range(0, m.nbooks(), m.npages() * m.nrows() * m.ncols()),
2069 Range(0, m.npages(), m.nrows() * m.ncols()),
2070 Range(0, m.nrows(), m.ncols()),
2071 Range(0, m.ncols())) {
2072 copy(m.begin(), m.end(), begin());
2073}
2074
2078 : Tensor6View(
2079 new Numeric[m.nvitrines() * m.nshelves() * m.nbooks() * m.npages() *
2080 m.nrows() * m.ncols()],
2081 Range(0,
2082 m.nvitrines(),
2083 m.nshelves() * m.nbooks() * m.npages() * m.nrows() * m.ncols()),
2084 Range(
2085 0, m.nshelves(), m.nbooks() * m.npages() * m.nrows() * m.ncols()),
2086 Range(0, m.nbooks(), m.npages() * m.nrows() * m.ncols()),
2087 Range(0, m.npages(), m.nrows() * m.ncols()),
2088 Range(0, m.nrows(), m.ncols()),
2089 Range(0, m.ncols())) {
2090 // There is a catch here: If m is an empty tensor, then it will have
2091 // dimensions of size 0. But these are used to initialize the stride
2092 // for higher dimensions! Thus, this method has to be consistent
2093 // with the behaviour of Range::Range. For now, Range::Range allows
2094 // also stride 0.
2095 std::memcpy(mdata,
2096 m.mdata,
2097 nvitrines() * nshelves() * nbooks() * npages() * nrows() *
2098 ncols() * sizeof(Numeric));
2099}
2100
2102
2126 if (this != &x) {
2127 resize(x.nvitrines(),
2128 x.nshelves(),
2129 x.nbooks(),
2130 x.npages(),
2131 x.nrows(),
2132 x.ncols());
2133 std::memcpy(mdata,
2134 x.mdata,
2135 nvitrines() * nshelves() * nbooks() * npages() * nrows() *
2136 ncols() * sizeof(Numeric));
2137 }
2138 return *this;
2139}
2140
2143 if (this != &x) {
2144 delete[] mdata;
2145 mdata = x.mdata;
2146 mvr = x.mvr;
2147 msr = x.msr;
2148 mbr = x.mbr;
2149 mpr = x.mpr;
2150 mrr = x.mrr;
2151 mcr = x.mcr;
2152 x.mvr = Range(0, 0);
2153 x.msr = Range(0, 0);
2154 x.mbr = Range(0, 0);
2155 x.mpr = Range(0, 0);
2156 x.mrr = Range(0, 0);
2157 x.mcr = Range(0, 0);
2158 x.mdata = nullptr;
2159 }
2160 return *this;
2161}
2162
2166 std::fill_n(
2167 mdata,
2168 nvitrines() * nshelves() * nbooks() * npages() * nrows() * ncols(),
2169 x);
2170 return *this;
2171}
2172
2177 ARTS_ASSERT(0 <= v);
2178 ARTS_ASSERT(0 <= s);
2179 ARTS_ASSERT(0 <= b);
2180 ARTS_ASSERT(0 <= p);
2181 ARTS_ASSERT(0 <= r);
2182 ARTS_ASSERT(0 <= c);
2183
2184 if (mvr.mextent != v || msr.mextent != s || mbr.mextent != b ||
2185 mpr.mextent != p || mrr.mextent != r || mcr.mextent != c) {
2186 delete[] mdata;
2187 mdata = new Numeric[v * s * b * p * r * c];
2188
2189 mvr.mstart = 0;
2190 mvr.mextent = v;
2191 mvr.mstride = s * b * p * r * c;
2192
2193 msr.mstart = 0;
2194 msr.mextent = s;
2195 msr.mstride = b * p * r * c;
2196
2197 mbr.mstart = 0;
2198 mbr.mextent = b;
2199 mbr.mstride = p * r * c;
2200
2201 mpr.mstart = 0;
2202 mpr.mextent = p;
2203 mpr.mstride = r * c;
2204
2205 mrr.mstart = 0;
2206 mrr.mextent = r;
2207 mrr.mstride = c;
2208
2209 mcr.mstart = 0;
2210 mcr.mextent = c;
2211 mcr.mstride = 1;
2212 }
2213}
2214
2216void swap(Tensor6& t1, Tensor6& t2) {
2217 std::swap(t1.mvr, t2.mvr);
2218 std::swap(t1.msr, t2.msr);
2219 std::swap(t1.mbr, t2.mbr);
2220 std::swap(t1.mpr, t2.mpr);
2221 std::swap(t1.mrr, t2.mrr);
2222 std::swap(t1.mcr, t2.mcr);
2223 std::swap(t1.mdata, t2.mdata);
2224}
2225
2229 // cout << "Destroying a Tensor6:\n"
2230 // << *this << "\n........................................\n";
2231 delete[] mdata;
2232}
2233
2249void transform(Tensor6View y, double (&my_func)(double), ConstTensor6View x) {
2250 // Check dimensions:
2251 ARTS_ASSERT(y.nvitrines() == x.nvitrines());
2252 ARTS_ASSERT(y.nshelves() == x.nshelves());
2253 ARTS_ASSERT(y.nbooks() == x.nbooks());
2254 ARTS_ASSERT(y.npages() == x.npages());
2255 ARTS_ASSERT(y.nrows() == x.nrows());
2256 ARTS_ASSERT(y.ncols() == x.ncols());
2257
2258 const ConstIterator6D xe = x.end();
2259 ConstIterator6D xi = x.begin();
2260 Iterator6D yi = y.begin();
2261 for (; xi != xe; ++xi, ++yi) {
2262 // Use the transform function of lower dimensional tensors
2263 // recursively:
2264 transform(*yi, my_func, *xi);
2265 }
2266}
2267
2270 const ConstIterator6D xe = x.end();
2271 ConstIterator6D xi = x.begin();
2272
2273 // Initial value for max:
2274 Numeric themax = max(*xi);
2275 ++xi;
2276
2277 for (; xi != xe; ++xi) {
2278 // Use the max function of lower dimensional tensors
2279 // recursively:
2280 Numeric maxi = max(*xi);
2281 if (maxi > themax) themax = maxi;
2282 }
2283
2284 return themax;
2285}
2286
2289 const ConstIterator6D xe = x.end();
2290 ConstIterator6D xi = x.begin();
2291
2292 // Initial value for min:
2293 Numeric themin = min(*xi);
2294 ++xi;
2295
2296 for (; xi != xe; ++xi) {
2297 // Use the min function of lower dimensional tensors
2298 // recursively:
2299 Numeric mini = min(*xi);
2300 if (mini < themin) themin = mini;
2301 }
2302
2303 return themin;
2304}
2305
2307// Helper function for debugging
2308#ifndef NDEBUG
2309
2328 Tensor6View& tv, Index v, Index s, Index b, Index p, Index r, Index c) {
2329 return tv(v, s, b, p, r, c);
2330}
2331
2332#endif
Const version of Iterator6D.
Definition: matpackVI.h:86
A constant view of a Matrix.
Definition: matpackI.h:1064
A constant view of a Tensor3.
Definition: matpackIII.h:130
A constant view of a Tensor4.
Definition: matpackIV.h:131
A constant view of a Tensor5.
Definition: matpackV.h:141
ConstIterator5D end() const
Return const iterator behind last shelf.
Definition: matpackV.cc:694
ConstIterator5D begin() const
Return const iterator to first shelf.
Definition: matpackV.cc:688
A constant view of a Tensor6.
Definition: matpackVI.h:147
ConstIterator6D begin() const
Return const iterator to first sub-tensor.
Definition: matpackVI.cc:848
ConstIterator6D end() const
Return const iterator behind last sub-tensor.
Definition: matpackVI.cc:855
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVI.h:608
Range mcr
The column range of mdata that is actually used.
Definition: matpackVI.h:618
Range mbr
The book range of mdata that is actually used.
Definition: matpackVI.h:612
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVI.h:620
Range mrr
The row range of mdata that is actually used.
Definition: matpackVI.h:616
Index size() const noexcept
Definition: matpackVI.h:163
Index nbooks() const noexcept
Definition: matpackVI.h:157
Index nvitrines() const noexcept
Definition: matpackVI.h:155
ConstTensor6View operator()(const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c) const
Definition: matpackVI.cc:36
Index ncols() const noexcept
Definition: matpackVI.h:160
Index npages() const noexcept
Definition: matpackVI.h:158
Index nshelves() const noexcept
Definition: matpackVI.h:156
Range mpr
The page range of mdata that is actually used.
Definition: matpackVI.h:614
Index nrows() const noexcept
Definition: matpackVI.h:159
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVI.h:610
ConstTensor6View()=default
A constant view of a Vector.
Definition: matpackI.h:530
The outermost iterator class for rank 6 tensors.
Definition: matpackVI.h:40
The MatrixView class.
Definition: matpackI.h:1182
The range class.
Definition: matpackI.h:177
Index mstart
The start index.
Definition: matpackI.h:385
Index mstride
The stride.
Definition: matpackI.h:390
Index mextent
The number of elements.
Definition: matpackI.h:388
The Tensor3View class.
Definition: matpackIII.h:246
The Tensor4View class.
Definition: matpackIV.h:292
The Tensor5View class.
Definition: matpackV.h:343
Iterator5D end()
Return iterator behind last shelf.
Definition: matpackV.cc:1360
Iterator5D begin()
Return iterator to first shelf.
Definition: matpackV.cc:1354
The Tensor6View class.
Definition: matpackVI.h:632
Tensor6View & operator-=(Numeric x)
Subtraction of scalar.
Definition: matpackVI.cc:1859
Tensor6View & operator/=(Numeric x)
Division by scalar.
Definition: matpackVI.cc:1841
Iterator6D end()
Return iterator behind last sub-tensor.
Definition: matpackVI.cc:1759
Iterator6D begin()
Return iterator to first sub-tensor.
Definition: matpackVI.cc:1753
Tensor6View()=default
Tensor6View & operator=(const ConstTensor6View &v)
Assignment operator.
Definition: matpackVI.cc:1774
Tensor6View & operator+=(Numeric x)
Addition of scalar.
Definition: matpackVI.cc:1850
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackVI.cc:1721
Tensor6View & operator*=(Numeric x)
Multiplication by scalar.
Definition: matpackVI.cc:1832
Tensor6View operator()(const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c)
Definition: matpackVI.cc:954
The Tensor6 class.
Definition: matpackVI.h:1099
void resize(Index v, Index s, Index b, Index p, Index r, Index c)
Resize function.
Definition: matpackVI.cc:2176
Tensor6()=default
Tensor6 & operator=(const Tensor6 &x)
Assignment operator from another tensor.
Definition: matpackVI.cc:2125
virtual ~Tensor6()
Destructor for Tensor6.
Definition: matpackVI.cc:2228
The VectorView class.
Definition: matpackI.h:672
#define ARTS_NOEXCEPT
Definition: debug.h:80
#define ARTS_ASSERT(condition,...)
Definition: debug.h:83
The declarations of all the exception classes.
#define ns
void swap(Tensor6 &t1, Tensor6 &t2)
Swaps two objects.
Definition: matpackVI.cc:2216
Numeric max(const ConstTensor6View &x)
Max function, tensor version.
Definition: matpackVI.cc:2269
void copy(ConstIterator6D origin, const ConstIterator6D &end, Iterator6D target)
Copy data between begin and end to target.
Definition: matpackVI.cc:2007
Numeric min(const ConstTensor6View &x)
Min function, tensor version.
Definition: matpackVI.cc:2288
std::ostream & operator<<(std::ostream &os, const ConstTensor6View &v)
Output operator.
Definition: matpackVI.cc:929
void transform(Tensor6View y, double(&my_func)(double), ConstTensor6View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
Definition: matpackVI.cc:2249
Numeric debug_tensor6view_get_elem(Tensor6View &tv, Index v, Index s, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
Definition: matpackVI.cc:2327
#define CHECK(x)
Implementation of Tensors of Rank 6.
Definition: matpackVI.h:33
#define OFFSET(x)
Definition: matpackVI.h:36
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Definition: zeemandata.h:113
#define v
#define a
#define c
#define b