ARTS 2.5.0 (git: 9ee3ac6c)
matpackVII.h
Go to the documentation of this file.
1
2/* Copyright (C) 2001-2012 Stefan Buehler <sbuehler@ltu.se>
3
4This program is free software; you can redistribute it and/or modify it
5under the terms of the GNU General Public License as published by the
6Free Software Foundation; either version 2, or (at your option) any
7later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17USA. */
18
29#ifndef matpackVII_h
30#define matpackVII_h
31
32#include "matpackVI.h"
33
37 public:
38 // Constructors:
40 Iterator7D() = default;
41
43 Iterator7D(const Tensor6View& x, Index stride)
44 : msv(x), mstride(stride) { /* Nothing to do here. */
45 }
46
47 // Operators:
50 msv.mdata += mstride;
51 return *this;
52 }
53
58 bool operator!=(const Iterator7D& other) const {
61 other.msv.mdata + other.msv.mvr.mstart + other.msv.msr.mstart +
62 other.msv.mbr.mstart + other.msv.mpr.mstart + other.msv.mrr.mstart +
63 other.msv.mcr.mstart)
64 return true;
65 else
66 return false;
67 }
68
71 Tensor6View* operator->() { return &msv; }
72
74 Tensor6View& operator*() { return msv; }
75
76 private:
81};
82
85 public:
86 // Constructors:
88 ConstIterator7D() = default;
89
92 : msv(x), mstride(stride) { /* Nothing to do here. */
93 }
94
95 // Operators:
98 msv.mdata += mstride;
99 return *this;
100 }
101
106 bool operator!=(const ConstIterator7D& other) const {
109 other.msv.mdata + other.msv.mvr.mstart + other.msv.msr.mstart +
110 other.msv.mbr.mstart + other.msv.mpr.mstart + other.msv.mrr.mstart +
111 other.msv.mcr.mstart)
112 return true;
113 else
114 return false;
115 }
116
119 const ConstTensor6View* operator->() const { return &msv; }
120
122 const ConstTensor6View& operator*() const { return msv; }
123
124 private:
129};
130
131// Declare class Tensor7:
132class Tensor7;
133
148 public:
149 constexpr ConstTensor7View(const ConstTensor7View&) = default;
150 constexpr ConstTensor7View(ConstTensor7View&&) = default;
153
154 // Member functions:
155 bool empty() const;
156 Index nlibraries() const;
157 Index nvitrines() const;
158 Index nshelves() const;
159 Index nbooks() const;
160 Index npages() const;
161 Index nrows() const;
162 Index ncols() const;
163
164 // Const index operators:
165
166 // Result 7D (1 combination)
167 // -------
169 const Range& v,
170 const Range& s,
171 const Range& b,
172 const Range& p,
173 const Range& r,
174 const Range& c) const;
175
176 // Result 6D (7 combinations)
177 // ------|
179 const Range& v,
180 const Range& s,
181 const Range& b,
182 const Range& p,
183 const Range& r,
184 Index c) const;
185 // -----|-
187 const Range& v,
188 const Range& s,
189 const Range& b,
190 const Range& p,
191 Index r,
192 const Range& c) const;
193 // ----|--
195 const Range& v,
196 const Range& s,
197 const Range& b,
198 Index p,
199 const Range& r,
200 const Range& c) const;
201 // ---|---
203 const Range& v,
204 const Range& s,
205 Index b,
206 const Range& p,
207 const Range& r,
208 const Range& c) const;
209 // --|----
211 const Range& v,
212 Index s,
213 const Range& b,
214 const Range& p,
215 const Range& r,
216 const Range& c) const;
217 // -|-----
219 Index v,
220 const Range& s,
221 const Range& b,
222 const Range& p,
223 const Range& r,
224 const Range& c) const;
225 // |------
227 const Range& v,
228 const Range& s,
229 const Range& b,
230 const Range& p,
231 const Range& r,
232 const Range& c) const;
233
234 // Result 5D (6+5+4+3+2+1 = 21 combinations)
235 // -----||
237 const Range& v,
238 const Range& s,
239 const Range& b,
240 const Range& p,
241 Index r,
242 Index c) const;
243 // ----|-|
245 const Range& v,
246 const Range& s,
247 const Range& b,
248 Index p,
249 const Range& r,
250 Index c) const;
251 // ---|--|
253 const Range& v,
254 const Range& s,
255 Index b,
256 const Range& p,
257 const Range& r,
258 Index c) const;
259 // --|---|
261 const Range& v,
262 Index s,
263 const Range& b,
264 const Range& p,
265 const Range& r,
266 Index c) const;
267 // -|----|
269 Index v,
270 const Range& s,
271 const Range& b,
272 const Range& p,
273 const Range& r,
274 Index c) const;
275 // |-----|
277 const Range& v,
278 const Range& s,
279 const Range& b,
280 const Range& p,
281 const Range& r,
282 Index c) const;
283 // ----||-
285 const Range& v,
286 const Range& s,
287 const Range& b,
288 Index p,
289 Index r,
290 const Range& c) const;
291 // ---|-|-
293 const Range& v,
294 const Range& s,
295 Index b,
296 const Range& p,
297 Index r,
298 const Range& c) const;
299 // --|--|-
301 const Range& v,
302 Index s,
303 const Range& b,
304 const Range& p,
305 Index r,
306 const Range& c) const;
307 // -|---|-
309 Index v,
310 const Range& s,
311 const Range& b,
312 const Range& p,
313 Index r,
314 const Range& c) const;
315 // |----|-
317 const Range& v,
318 const Range& s,
319 const Range& b,
320 const Range& p,
321 Index r,
322 const Range& c) const;
323 // ---||--
325 const Range& v,
326 const Range& s,
327 Index b,
328 Index p,
329 const Range& r,
330 const Range& c) const;
331 // --|-|--
333 const Range& v,
334 Index s,
335 const Range& b,
336 Index p,
337 const Range& r,
338 const Range& c) const;
339 // -|--|--
341 Index v,
342 const Range& s,
343 const Range& b,
344 Index p,
345 const Range& r,
346 const Range& c) const;
347 // |---|--
349 const Range& v,
350 const Range& s,
351 const Range& b,
352 Index p,
353 const Range& r,
354 const Range& c) const;
355 // --||---
357 const Range& v,
358 Index s,
359 Index b,
360 const Range& p,
361 const Range& r,
362 const Range& c) const;
363 // -|-|---
365 Index v,
366 const Range& s,
367 Index b,
368 const Range& p,
369 const Range& r,
370 const Range& c) const;
371 // |--|---
373 const Range& v,
374 const Range& s,
375 Index b,
376 const Range& p,
377 const Range& r,
378 const Range& c) const;
379 // -||----
381 Index v,
382 Index s,
383 const Range& b,
384 const Range& p,
385 const Range& r,
386 const Range& c) const;
387 // |-|----
389 const Range& v,
390 Index s,
391 const Range& b,
392 const Range& p,
393 const Range& r,
394 const Range& c) const;
395 // ||-----
397 Index v,
398 const Range& s,
399 const Range& b,
400 const Range& p,
401 const Range& r,
402 const Range& c) const;
403
404 // Result 4D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
405 // ----|||
407 const Range& v,
408 const Range& s,
409 const Range& b,
410 Index p,
411 Index r,
412 Index c) const;
413 // ---|-||
415 const Range& v,
416 const Range& s,
417 Index b,
418 const Range& p,
419 Index r,
420 Index c) const;
421 // --|--||
423 const Range& v,
424 Index s,
425 const Range& b,
426 const Range& p,
427 Index r,
428 Index c) const;
429 // -|---||
431 Index v,
432 const Range& s,
433 const Range& b,
434 const Range& p,
435 Index r,
436 Index c) const;
437 // |----||
439 const Range& v,
440 const Range& s,
441 const Range& b,
442 const Range& p,
443 Index r,
444 Index c) const;
445 // ---||-|
447 const Range& v,
448 const Range& s,
449 Index b,
450 Index p,
451 const Range& r,
452 Index c) const;
453 // --|-|-|
455 const Range& v,
456 Index s,
457 const Range& b,
458 Index p,
459 const Range& r,
460 Index c) const;
461 // -|--|-|
463 Index v,
464 const Range& s,
465 const Range& b,
466 Index p,
467 const Range& r,
468 Index c) const;
469 // |---|-|
471 const Range& v,
472 const Range& s,
473 const Range& b,
474 Index p,
475 const Range& r,
476 Index c) const;
477 // --||--|
479 const Range& v,
480 Index s,
481 Index b,
482 const Range& p,
483 const Range& r,
484 Index c) const;
485 // -|-|--|
487 Index v,
488 const Range& s,
489 Index b,
490 const Range& p,
491 const Range& r,
492 Index c) const;
493 // |--|--|
495 const Range& v,
496 const Range& s,
497 Index b,
498 const Range& p,
499 const Range& r,
500 Index c) const;
501 // -||---|
503 Index v,
504 Index s,
505 const Range& b,
506 const Range& p,
507 const Range& r,
508 Index c) const;
509 // |-|---|
511 const Range& v,
512 Index s,
513 const Range& b,
514 const Range& p,
515 const Range& r,
516 Index c) const;
517 // ||----|
519 Index v,
520 const Range& s,
521 const Range& b,
522 const Range& p,
523 const Range& r,
524 Index c) const;
525 // ---|||-
527 const Range& v,
528 const Range& s,
529 Index b,
530 Index p,
531 Index r,
532 const Range& c) const;
533 // --|-||-
535 const Range& v,
536 Index s,
537 const Range& b,
538 Index p,
539 Index r,
540 const Range& c) const;
541 // -|--||-
543 Index v,
544 const Range& s,
545 const Range& b,
546 Index p,
547 Index r,
548 const Range& c) const;
549 // |---||-
551 const Range& v,
552 const Range& s,
553 const Range& b,
554 Index p,
555 Index r,
556 const Range& c) const;
557 // --||-|-
559 const Range& v,
560 Index s,
561 Index b,
562 const Range& p,
563 Index r,
564 const Range& c) const;
565 // -|-|-|-
567 Index v,
568 const Range& s,
569 Index b,
570 const Range& p,
571 Index r,
572 const Range& c) const;
573 // |--|-|-
575 const Range& v,
576 const Range& s,
577 Index b,
578 const Range& p,
579 Index r,
580 const Range& c) const;
581 // -||--|-
583 Index v,
584 Index s,
585 const Range& b,
586 const Range& p,
587 Index r,
588 const Range& c) const;
589 // |-|--|-
591 const Range& v,
592 Index s,
593 const Range& b,
594 const Range& p,
595 Index r,
596 const Range& c) const;
597 // ||---|-
599 Index v,
600 const Range& s,
601 const Range& b,
602 const Range& p,
603 Index r,
604 const Range& c) const;
605 // --|||--
607 const Range& v,
608 Index s,
609 Index b,
610 Index p,
611 const Range& r,
612 const Range& c) const;
613 // -|-||--
615 Index v,
616 const Range& s,
617 Index b,
618 Index p,
619 const Range& r,
620 const Range& c) const;
621 // |--||--
623 const Range& v,
624 const Range& s,
625 Index b,
626 Index p,
627 const Range& r,
628 const Range& c) const;
629 // -||-|--
631 Index v,
632 Index s,
633 const Range& b,
634 Index p,
635 const Range& r,
636 const Range& c) const;
637 // |-|-|--
639 const Range& v,
640 Index s,
641 const Range& b,
642 Index p,
643 const Range& r,
644 const Range& c) const;
645 // ||--|--
647 Index v,
648 const Range& s,
649 const Range& b,
650 Index p,
651 const Range& r,
652 const Range& c) const;
653 // -|||---
655 Index v,
656 Index s,
657 Index b,
658 const Range& p,
659 const Range& r,
660 const Range& c) const;
661 // |-||---
663 const Range& v,
664 Index s,
665 Index b,
666 const Range& p,
667 const Range& r,
668 const Range& c) const;
669 // ||-|---
671 Index v,
672 const Range& s,
673 Index b,
674 const Range& p,
675 const Range& r,
676 const Range& c) const;
677 // |||----
679 Index v,
680 Index s,
681 const Range& b,
682 const Range& p,
683 const Range& r,
684 const Range& c) const;
685
686 // Result 3D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
687 // ||||---
689 Index v,
690 Index s,
691 Index b,
692 const Range& p,
693 const Range& r,
694 const Range& c) const;
695 // |||-|--
697 Index v,
698 Index s,
699 const Range& b,
700 Index p,
701 const Range& r,
702 const Range& c) const;
703 // ||-||--
705 Index v,
706 const Range& s,
707 Index b,
708 Index p,
709 const Range& r,
710 const Range& c) const;
711 // |-|||--
713 const Range& v,
714 Index s,
715 Index b,
716 Index p,
717 const Range& r,
718 const Range& c) const;
719 // -||||--
721 Index v,
722 Index s,
723 Index b,
724 Index p,
725 const Range& r,
726 const Range& c) const;
727 // |||--|-
729 Index v,
730 Index s,
731 const Range& b,
732 const Range& p,
733 Index r,
734 const Range& c) const;
735 // ||-|-|-
737 Index v,
738 const Range& s,
739 Index b,
740 const Range& p,
741 Index r,
742 const Range& c) const;
743 // |-||-|-
745 const Range& v,
746 Index s,
747 Index b,
748 const Range& p,
749 Index r,
750 const Range& c) const;
751 // -|||-|-
753 Index v,
754 Index s,
755 Index b,
756 const Range& p,
757 Index r,
758 const Range& c) const;
759 // ||--||-
761 Index v,
762 const Range& s,
763 const Range& b,
764 Index p,
765 Index r,
766 const Range& c) const;
767 // |-|-||-
769 const Range& v,
770 Index s,
771 const Range& b,
772 Index p,
773 Index r,
774 const Range& c) const;
775 // -||-||-
777 Index v,
778 Index s,
779 const Range& b,
780 Index p,
781 Index r,
782 const Range& c) const;
783 // |--|||-
785 const Range& v,
786 const Range& s,
787 Index b,
788 Index p,
789 Index r,
790 const Range& c) const;
791 // -|-|||-
793 Index v,
794 const Range& s,
795 Index b,
796 Index p,
797 Index r,
798 const Range& c) const;
799 // --||||-
801 const Range& v,
802 Index s,
803 Index b,
804 Index p,
805 Index r,
806 const Range& c) const;
807 // |||---|
809 Index v,
810 Index s,
811 const Range& b,
812 const Range& p,
813 const Range& r,
814 Index c) const;
815 // ||-|--|
817 Index v,
818 const Range& s,
819 Index b,
820 const Range& p,
821 const Range& r,
822 Index c) const;
823 // |-||--|
825 const Range& v,
826 Index s,
827 Index b,
828 const Range& p,
829 const Range& r,
830 Index c) const;
831 // -|||--|
833 Index v,
834 Index s,
835 Index b,
836 const Range& p,
837 const Range& r,
838 Index c) const;
839 // ||--|-|
841 Index v,
842 const Range& s,
843 const Range& b,
844 Index p,
845 const Range& r,
846 Index c) const;
847 // |-|-|-|
849 const Range& v,
850 Index s,
851 const Range& b,
852 Index p,
853 const Range& r,
854 Index c) const;
855 // -||-|-|
857 Index v,
858 Index s,
859 const Range& b,
860 Index p,
861 const Range& r,
862 Index c) const;
863 // |--||-|
865 const Range& v,
866 const Range& s,
867 Index b,
868 Index p,
869 const Range& r,
870 Index c) const;
871 // -|-||-|
873 Index v,
874 const Range& s,
875 Index b,
876 Index p,
877 const Range& r,
878 Index c) const;
879 // --|||-|
881 const Range& v,
882 Index s,
883 Index b,
884 Index p,
885 const Range& r,
886 Index c) const;
887 // ||---||
889 Index v,
890 const Range& s,
891 const Range& b,
892 const Range& p,
893 Index r,
894 Index c) const;
895 // |-|--||
897 const Range& v,
898 Index s,
899 const Range& b,
900 const Range& p,
901 Index r,
902 Index c) const;
903 // -||--||
905 Index v,
906 Index s,
907 const Range& b,
908 const Range& p,
909 Index r,
910 Index c) const;
911 // |--|-||
913 const Range& v,
914 const Range& s,
915 Index b,
916 const Range& p,
917 Index r,
918 Index c) const;
919 // -|-|-||
921 Index v,
922 const Range& s,
923 Index b,
924 const Range& p,
925 Index r,
926 Index c) const;
927 // --||-||
929 const Range& v,
930 Index s,
931 Index b,
932 const Range& p,
933 Index r,
934 Index c) const;
935 // |---|||
937 const Range& v,
938 const Range& s,
939 const Range& b,
940 Index p,
941 Index r,
942 Index c) const;
943 // -|--|||
945 Index v,
946 const Range& s,
947 const Range& b,
948 Index p,
949 Index r,
950 Index c) const;
951 // --|-|||
953 const Range& v,
954 Index s,
955 const Range& b,
956 Index p,
957 Index r,
958 Index c) const;
959 // ---||||
961 const Range& v,
962 const Range& s,
963 Index b,
964 Index p,
965 Index r,
966 Index c) const;
967
968 // Result 2D (6+5+4+3+2+1 = 21 combinations)
969 // |||||--
971 Index v,
972 Index s,
973 Index b,
974 Index p,
975 const Range& r,
976 const Range& c) const;
977 // ||||-|-
979 Index v,
980 Index s,
981 Index b,
982 const Range& p,
983 Index r,
984 const Range& c) const;
985 // |||-||-
987 Index v,
988 Index s,
989 const Range& b,
990 Index p,
991 Index r,
992 const Range& c) const;
993 // ||-|||-
995 Index v,
996 const Range& s,
997 Index b,
998 Index p,
999 Index r,
1000 const Range& c) const;
1001 // |-||||-
1003 const Range& v,
1004 Index s,
1005 Index b,
1006 Index p,
1007 Index r,
1008 const Range& c) const;
1009 // -|||||-
1011 Index v,
1012 Index s,
1013 Index b,
1014 Index p,
1015 Index r,
1016 const Range& c) const;
1017 // ||||--|
1019 Index v,
1020 Index s,
1021 Index b,
1022 const Range& p,
1023 const Range& r,
1024 Index c) const;
1025 // |||-|-|
1027 Index v,
1028 Index s,
1029 const Range& b,
1030 Index p,
1031 const Range& r,
1032 Index c) const;
1033 // ||-||-|
1035 Index v,
1036 const Range& s,
1037 Index b,
1038 Index p,
1039 const Range& r,
1040 Index c) const;
1041 // |-|||-|
1043 const Range& v,
1044 Index s,
1045 Index b,
1046 Index p,
1047 const Range& r,
1048 Index c) const;
1049 // -||||-|
1051 Index v,
1052 Index s,
1053 Index b,
1054 Index p,
1055 const Range& r,
1056 Index c) const;
1057 // |||--||
1059 Index v,
1060 Index s,
1061 const Range& b,
1062 const Range& p,
1063 Index r,
1064 Index c) const;
1065 // ||-|-||
1067 Index v,
1068 const Range& s,
1069 Index b,
1070 const Range& p,
1071 Index r,
1072 Index c) const;
1073 // |-||-||
1075 const Range& v,
1076 Index s,
1077 Index b,
1078 const Range& p,
1079 Index r,
1080 Index c) const;
1081 // -|||-||
1083 Index v,
1084 Index s,
1085 Index b,
1086 const Range& p,
1087 Index r,
1088 Index c) const;
1089 // ||--|||
1091 Index v,
1092 const Range& s,
1093 const Range& b,
1094 Index p,
1095 Index r,
1096 Index c) const;
1097 // |-|-|||
1099 const Range& v,
1100 Index s,
1101 const Range& b,
1102 Index p,
1103 Index r,
1104 Index c) const;
1105 // -||-|||
1107 Index v,
1108 Index s,
1109 const Range& b,
1110 Index p,
1111 Index r,
1112 Index c) const;
1113 // |--||||
1115 const Range& v,
1116 const Range& s,
1117 Index b,
1118 Index p,
1119 Index r,
1120 Index c) const;
1121 // -|-||||
1123 Index v,
1124 const Range& s,
1125 Index b,
1126 Index p,
1127 Index r,
1128 Index c) const;
1129 // --|||||
1131 const Range& v,
1132 Index s,
1133 Index b,
1134 Index p,
1135 Index r,
1136 Index c) const;
1137
1138 // Result 1D (7 combinations)
1139 // ||||||-
1141 Index v,
1142 Index s,
1143 Index b,
1144 Index p,
1145 Index r,
1146 const Range& c) const;
1147 // |||||-|
1149 Index v,
1150 Index s,
1151 Index b,
1152 Index p,
1153 const Range& r,
1154 Index c) const;
1155 // ||||-||
1157 Index v,
1158 Index s,
1159 Index b,
1160 const Range& p,
1161 Index r,
1162 Index c) const;
1163 // |||-|||
1165 Index v,
1166 Index s,
1167 const Range& b,
1168 Index p,
1169 Index r,
1170 Index c) const;
1171 // ||-||||
1173 Index v,
1174 const Range& s,
1175 Index b,
1176 Index p,
1177 Index r,
1178 Index c) const;
1179 // |-|||||
1181 const Range& v,
1182 Index s,
1183 Index b,
1184 Index p,
1185 Index r,
1186 Index c) const;
1187 // -||||||
1189 Index v,
1190 Index s,
1191 Index b,
1192 Index p,
1193 Index r,
1194 Index c) const;
1195
1196 // Result scalar (1 combination)
1197 // |||||||
1199 Index l, Index v, Index s, Index b, Index p, Index r, Index c) const {
1200 CHECK(l);
1201 CHECK(v);
1202 CHECK(s);
1203 CHECK(b);
1204 CHECK(p);
1205 CHECK(r);
1206 CHECK(c);
1207 return get(l, v, s, b, p, r, c);
1208 }
1209
1212 Index l, Index v, Index s, Index b, Index p, Index r, Index c) const {
1213 return *(mdata + OFFSET(l) + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) +
1214 OFFSET(r) + OFFSET(c));
1215 }
1216
1217 // Functions returning iterators:
1218 ConstIterator7D begin() const;
1219 ConstIterator7D end() const;
1220
1222 virtual ~ConstTensor7View() = default;
1223
1224 // Friends:
1225 friend class Tensor7View;
1226
1227 // Special constructor to make a Tensor7 view of a Tensor6.
1229
1230 protected:
1231 // Constructors:
1232 ConstTensor7View() = default;
1234 const Range& l,
1235 const Range& v,
1236 const Range& s,
1237 const Range& b,
1238 const Range& p,
1239 const Range& r,
1240 const Range& c);
1242 const Range& pl,
1243 const Range& pv,
1244 const Range& ps,
1245 const Range& pb,
1246 const Range& pp,
1247 const Range& pr,
1248 const Range& pc,
1249 const Range& nl,
1250 const Range& nv,
1251 const Range& ns,
1252 const Range& nb,
1253 const Range& np,
1254 const Range& nr,
1255 const Range& nc);
1256
1257 // Data members:
1258 // -------------
1260 Range mlr{0, 0, 1};
1262 Range mvr{0, 0, 1};
1264 Range msr{0, 0, 1};
1266 Range mbr{0, 0, 1};
1268 Range mpr{0, 0, 1};
1270 Range mrr{0, 0, 1};
1272 Range mcr{0, 0, 1};
1274 Numeric* mdata{nullptr};
1275};
1276
1287 public:
1288 // Make const methods visible from base class
1291 using ConstTensor7View::operator();
1293
1294 constexpr Tensor7View(const Tensor7View&) = default;
1295
1296 // Non-const index operators:
1297
1298 // Result 7D (1 combination)
1299 // -------
1301 const Range& v,
1302 const Range& s,
1303 const Range& b,
1304 const Range& p,
1305 const Range& r,
1306 const Range& c);
1307
1308 // Result 6D (7 combinations)
1309 // ------|
1311 const Range& v,
1312 const Range& s,
1313 const Range& b,
1314 const Range& p,
1315 const Range& r,
1316 Index c);
1317 // -----|-
1319 const Range& v,
1320 const Range& s,
1321 const Range& b,
1322 const Range& p,
1323 Index r,
1324 const Range& c);
1325 // ----|--
1327 const Range& v,
1328 const Range& s,
1329 const Range& b,
1330 Index p,
1331 const Range& r,
1332 const Range& c);
1333 // ---|---
1335 const Range& v,
1336 const Range& s,
1337 Index b,
1338 const Range& p,
1339 const Range& r,
1340 const Range& c);
1341 // --|----
1343 const Range& v,
1344 Index s,
1345 const Range& b,
1346 const Range& p,
1347 const Range& r,
1348 const Range& c);
1349 // -|-----
1351 Index v,
1352 const Range& s,
1353 const Range& b,
1354 const Range& p,
1355 const Range& r,
1356 const Range& c);
1357 // |------
1359 const Range& v,
1360 const Range& s,
1361 const Range& b,
1362 const Range& p,
1363 const Range& r,
1364 const Range& c);
1365
1366 // Result 5D (6+5+4+3+2+1 = 21 combinations)
1367 // -----||
1369 const Range& v,
1370 const Range& s,
1371 const Range& b,
1372 const Range& p,
1373 Index r,
1374 Index c);
1375 // ----|-|
1377 const Range& v,
1378 const Range& s,
1379 const Range& b,
1380 Index p,
1381 const Range& r,
1382 Index c);
1383 // ---|--|
1385 const Range& v,
1386 const Range& s,
1387 Index b,
1388 const Range& p,
1389 const Range& r,
1390 Index c);
1391 // --|---|
1393 const Range& v,
1394 Index s,
1395 const Range& b,
1396 const Range& p,
1397 const Range& r,
1398 Index c);
1399 // -|----|
1401 Index v,
1402 const Range& s,
1403 const Range& b,
1404 const Range& p,
1405 const Range& r,
1406 Index c);
1407 // |-----|
1409 const Range& v,
1410 const Range& s,
1411 const Range& b,
1412 const Range& p,
1413 const Range& r,
1414 Index c);
1415 // ----||-
1417 const Range& v,
1418 const Range& s,
1419 const Range& b,
1420 Index p,
1421 Index r,
1422 const Range& c);
1423 // ---|-|-
1425 const Range& v,
1426 const Range& s,
1427 Index b,
1428 const Range& p,
1429 Index r,
1430 const Range& c);
1431 // --|--|-
1433 const Range& v,
1434 Index s,
1435 const Range& b,
1436 const Range& p,
1437 Index r,
1438 const Range& c);
1439 // -|---|-
1441 Index v,
1442 const Range& s,
1443 const Range& b,
1444 const Range& p,
1445 Index r,
1446 const Range& c);
1447 // |----|-
1449 const Range& v,
1450 const Range& s,
1451 const Range& b,
1452 const Range& p,
1453 Index r,
1454 const Range& c);
1455 // ---||--
1457 const Range& v,
1458 const Range& s,
1459 Index b,
1460 Index p,
1461 const Range& r,
1462 const Range& c);
1463 // --|-|--
1465 const Range& v,
1466 Index s,
1467 const Range& b,
1468 Index p,
1469 const Range& r,
1470 const Range& c);
1471 // -|--|--
1473 Index v,
1474 const Range& s,
1475 const Range& b,
1476 Index p,
1477 const Range& r,
1478 const Range& c);
1479 // |---|--
1481 const Range& v,
1482 const Range& s,
1483 const Range& b,
1484 Index p,
1485 const Range& r,
1486 const Range& c);
1487 // --||---
1489 const Range& v,
1490 Index s,
1491 Index b,
1492 const Range& p,
1493 const Range& r,
1494 const Range& c);
1495 // -|-|---
1497 Index v,
1498 const Range& s,
1499 Index b,
1500 const Range& p,
1501 const Range& r,
1502 const Range& c);
1503 // |--|---
1505 const Range& v,
1506 const Range& s,
1507 Index b,
1508 const Range& p,
1509 const Range& r,
1510 const Range& c);
1511 // -||----
1513 Index v,
1514 Index s,
1515 const Range& b,
1516 const Range& p,
1517 const Range& r,
1518 const Range& c);
1519 // |-|----
1521 const Range& v,
1522 Index s,
1523 const Range& b,
1524 const Range& p,
1525 const Range& r,
1526 const Range& c);
1527 // ||-----
1529 Index v,
1530 const Range& s,
1531 const Range& b,
1532 const Range& p,
1533 const Range& r,
1534 const Range& c);
1535
1536 // Result 4D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1537 // ----|||
1539 const Range& v,
1540 const Range& s,
1541 const Range& b,
1542 Index p,
1543 Index r,
1544 Index c);
1545 // ---|-||
1547 const Range& v,
1548 const Range& s,
1549 Index b,
1550 const Range& p,
1551 Index r,
1552 Index c);
1553 // --|--||
1555 const Range& v,
1556 Index s,
1557 const Range& b,
1558 const Range& p,
1559 Index r,
1560 Index c);
1561 // -|---||
1563 Index v,
1564 const Range& s,
1565 const Range& b,
1566 const Range& p,
1567 Index r,
1568 Index c);
1569 // |----||
1571 const Range& v,
1572 const Range& s,
1573 const Range& b,
1574 const Range& p,
1575 Index r,
1576 Index c);
1577 // ---||-|
1579 const Range& v,
1580 const Range& s,
1581 Index b,
1582 Index p,
1583 const Range& r,
1584 Index c);
1585 // --|-|-|
1587 const Range& v,
1588 Index s,
1589 const Range& b,
1590 Index p,
1591 const Range& r,
1592 Index c);
1593 // -|--|-|
1595 Index v,
1596 const Range& s,
1597 const Range& b,
1598 Index p,
1599 const Range& r,
1600 Index c);
1601 // |---|-|
1603 const Range& v,
1604 const Range& s,
1605 const Range& b,
1606 Index p,
1607 const Range& r,
1608 Index c);
1609 // --||--|
1611 const Range& v,
1612 Index s,
1613 Index b,
1614 const Range& p,
1615 const Range& r,
1616 Index c);
1617 // -|-|--|
1619 Index v,
1620 const Range& s,
1621 Index b,
1622 const Range& p,
1623 const Range& r,
1624 Index c);
1625 // |--|--|
1627 const Range& v,
1628 const Range& s,
1629 Index b,
1630 const Range& p,
1631 const Range& r,
1632 Index c);
1633 // -||---|
1635 Index v,
1636 Index s,
1637 const Range& b,
1638 const Range& p,
1639 const Range& r,
1640 Index c);
1641 // |-|---|
1643 const Range& v,
1644 Index s,
1645 const Range& b,
1646 const Range& p,
1647 const Range& r,
1648 Index c);
1649 // ||----|
1651 Index v,
1652 const Range& s,
1653 const Range& b,
1654 const Range& p,
1655 const Range& r,
1656 Index c);
1657 // ---|||-
1659 const Range& v,
1660 const Range& s,
1661 Index b,
1662 Index p,
1663 Index r,
1664 const Range& c);
1665 // --|-||-
1667 const Range& v,
1668 Index s,
1669 const Range& b,
1670 Index p,
1671 Index r,
1672 const Range& c);
1673 // -|--||-
1675 Index v,
1676 const Range& s,
1677 const Range& b,
1678 Index p,
1679 Index r,
1680 const Range& c);
1681 // |---||-
1683 const Range& v,
1684 const Range& s,
1685 const Range& b,
1686 Index p,
1687 Index r,
1688 const Range& c);
1689 // --||-|-
1691 const Range& v,
1692 Index s,
1693 Index b,
1694 const Range& p,
1695 Index r,
1696 const Range& c);
1697 // -|-|-|-
1699 Index v,
1700 const Range& s,
1701 Index b,
1702 const Range& p,
1703 Index r,
1704 const Range& c);
1705 // |--|-|-
1707 const Range& v,
1708 const Range& s,
1709 Index b,
1710 const Range& p,
1711 Index r,
1712 const Range& c);
1713 // -||--|-
1715 Index v,
1716 Index s,
1717 const Range& b,
1718 const Range& p,
1719 Index r,
1720 const Range& c);
1721 // |-|--|-
1723 const Range& v,
1724 Index s,
1725 const Range& b,
1726 const Range& p,
1727 Index r,
1728 const Range& c);
1729 // ||---|-
1731 Index v,
1732 const Range& s,
1733 const Range& b,
1734 const Range& p,
1735 Index r,
1736 const Range& c);
1737 // --|||--
1739 const Range& v,
1740 Index s,
1741 Index b,
1742 Index p,
1743 const Range& r,
1744 const Range& c);
1745 // -|-||--
1747 Index v,
1748 const Range& s,
1749 Index b,
1750 Index p,
1751 const Range& r,
1752 const Range& c);
1753 // |--||--
1755 const Range& v,
1756 const Range& s,
1757 Index b,
1758 Index p,
1759 const Range& r,
1760 const Range& c);
1761 // -||-|--
1763 Index v,
1764 Index s,
1765 const Range& b,
1766 Index p,
1767 const Range& r,
1768 const Range& c);
1769 // |-|-|--
1771 const Range& v,
1772 Index s,
1773 const Range& b,
1774 Index p,
1775 const Range& r,
1776 const Range& c);
1777 // ||--|--
1779 Index v,
1780 const Range& s,
1781 const Range& b,
1782 Index p,
1783 const Range& r,
1784 const Range& c);
1785 // -|||---
1787 Index v,
1788 Index s,
1789 Index b,
1790 const Range& p,
1791 const Range& r,
1792 const Range& c);
1793 // |-||---
1795 const Range& v,
1796 Index s,
1797 Index b,
1798 const Range& p,
1799 const Range& r,
1800 const Range& c);
1801 // ||-|---
1803 Index v,
1804 const Range& s,
1805 Index b,
1806 const Range& p,
1807 const Range& r,
1808 const Range& c);
1809 // |||----
1811 Index v,
1812 Index s,
1813 const Range& b,
1814 const Range& p,
1815 const Range& r,
1816 const Range& c);
1817
1818 // Result 3D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1819 // ||||---
1821 Index v,
1822 Index s,
1823 Index b,
1824 const Range& p,
1825 const Range& r,
1826 const Range& c);
1827 // |||-|--
1829 Index v,
1830 Index s,
1831 const Range& b,
1832 Index p,
1833 const Range& r,
1834 const Range& c);
1835 // ||-||--
1837 Index v,
1838 const Range& s,
1839 Index b,
1840 Index p,
1841 const Range& r,
1842 const Range& c);
1843 // |-|||--
1845 const Range& v,
1846 Index s,
1847 Index b,
1848 Index p,
1849 const Range& r,
1850 const Range& c);
1851 // -||||--
1853 Index v,
1854 Index s,
1855 Index b,
1856 Index p,
1857 const Range& r,
1858 const Range& c);
1859 // |||--|-
1861 Index v,
1862 Index s,
1863 const Range& b,
1864 const Range& p,
1865 Index r,
1866 const Range& c);
1867 // ||-|-|-
1869 Index v,
1870 const Range& s,
1871 Index b,
1872 const Range& p,
1873 Index r,
1874 const Range& c);
1875 // |-||-|-
1877 const Range& v,
1878 Index s,
1879 Index b,
1880 const Range& p,
1881 Index r,
1882 const Range& c);
1883 // -|||-|-
1885 Index v,
1886 Index s,
1887 Index b,
1888 const Range& p,
1889 Index r,
1890 const Range& c);
1891 // ||--||-
1893 Index v,
1894 const Range& s,
1895 const Range& b,
1896 Index p,
1897 Index r,
1898 const Range& c);
1899 // |-|-||-
1901 const Range& v,
1902 Index s,
1903 const Range& b,
1904 Index p,
1905 Index r,
1906 const Range& c);
1907 // -||-||-
1909 Index v,
1910 Index s,
1911 const Range& b,
1912 Index p,
1913 Index r,
1914 const Range& c);
1915 // |--|||-
1917 const Range& v,
1918 const Range& s,
1919 Index b,
1920 Index p,
1921 Index r,
1922 const Range& c);
1923 // -|-|||-
1925 Index v,
1926 const Range& s,
1927 Index b,
1928 Index p,
1929 Index r,
1930 const Range& c);
1931 // --||||-
1933 const Range& v,
1934 Index s,
1935 Index b,
1936 Index p,
1937 Index r,
1938 const Range& c);
1939 // |||---|
1941 Index v,
1942 Index s,
1943 const Range& b,
1944 const Range& p,
1945 const Range& r,
1946 Index c);
1947 // ||-|--|
1949 Index v,
1950 const Range& s,
1951 Index b,
1952 const Range& p,
1953 const Range& r,
1954 Index c);
1955 // |-||--|
1957 const Range& v,
1958 Index s,
1959 Index b,
1960 const Range& p,
1961 const Range& r,
1962 Index c);
1963 // -|||--|
1965 Index v,
1966 Index s,
1967 Index b,
1968 const Range& p,
1969 const Range& r,
1970 Index c);
1971 // ||--|-|
1973 Index v,
1974 const Range& s,
1975 const Range& b,
1976 Index p,
1977 const Range& r,
1978 Index c);
1979 // |-|-|-|
1981 const Range& v,
1982 Index s,
1983 const Range& b,
1984 Index p,
1985 const Range& r,
1986 Index c);
1987 // -||-|-|
1989 Index v,
1990 Index s,
1991 const Range& b,
1992 Index p,
1993 const Range& r,
1994 Index c);
1995 // |--||-|
1997 const Range& v,
1998 const Range& s,
1999 Index b,
2000 Index p,
2001 const Range& r,
2002 Index c);
2003 // -|-||-|
2005 Index v,
2006 const Range& s,
2007 Index b,
2008 Index p,
2009 const Range& r,
2010 Index c);
2011 // --|||-|
2013 const Range& v,
2014 Index s,
2015 Index b,
2016 Index p,
2017 const Range& r,
2018 Index c);
2019 // ||---||
2021 Index v,
2022 const Range& s,
2023 const Range& b,
2024 const Range& p,
2025 Index r,
2026 Index c);
2027 // |-|--||
2029 const Range& v,
2030 Index s,
2031 const Range& b,
2032 const Range& p,
2033 Index r,
2034 Index c);
2035 // -||--||
2037 Index v,
2038 Index s,
2039 const Range& b,
2040 const Range& p,
2041 Index r,
2042 Index c);
2043 // |--|-||
2045 const Range& v,
2046 const Range& s,
2047 Index b,
2048 const Range& p,
2049 Index r,
2050 Index c);
2051 // -|-|-||
2053 Index v,
2054 const Range& s,
2055 Index b,
2056 const Range& p,
2057 Index r,
2058 Index c);
2059 // --||-||
2061 const Range& v,
2062 Index s,
2063 Index b,
2064 const Range& p,
2065 Index r,
2066 Index c);
2067 // |---|||
2069 const Range& v,
2070 const Range& s,
2071 const Range& b,
2072 Index p,
2073 Index r,
2074 Index c);
2075 // -|--|||
2077 Index v,
2078 const Range& s,
2079 const Range& b,
2080 Index p,
2081 Index r,
2082 Index c);
2083 // --|-|||
2085 const Range& v,
2086 Index s,
2087 const Range& b,
2088 Index p,
2089 Index r,
2090 Index c);
2091 // ---||||
2093 const Range& v,
2094 const Range& s,
2095 Index b,
2096 Index p,
2097 Index r,
2098 Index c);
2099
2100 // Result 2D (6+5+4+3+2+1 = 21 combinations)
2101 // |||||--
2103 Index v,
2104 Index s,
2105 Index b,
2106 Index p,
2107 const Range& r,
2108 const Range& c);
2109 // ||||-|-
2111 Index v,
2112 Index s,
2113 Index b,
2114 const Range& p,
2115 Index r,
2116 const Range& c);
2117 // |||-||-
2119 Index v,
2120 Index s,
2121 const Range& b,
2122 Index p,
2123 Index r,
2124 const Range& c);
2125 // ||-|||-
2127 Index v,
2128 const Range& s,
2129 Index b,
2130 Index p,
2131 Index r,
2132 const Range& c);
2133 // |-||||-
2135 const Range& v,
2136 Index s,
2137 Index b,
2138 Index p,
2139 Index r,
2140 const Range& c);
2141 // -|||||-
2143 Index v,
2144 Index s,
2145 Index b,
2146 Index p,
2147 Index r,
2148 const Range& c);
2149 // ||||--|
2151 Index v,
2152 Index s,
2153 Index b,
2154 const Range& p,
2155 const Range& r,
2156 Index c);
2157 // |||-|-|
2159 Index v,
2160 Index s,
2161 const Range& b,
2162 Index p,
2163 const Range& r,
2164 Index c);
2165 // ||-||-|
2167 Index v,
2168 const Range& s,
2169 Index b,
2170 Index p,
2171 const Range& r,
2172 Index c);
2173 // |-|||-|
2175 const Range& v,
2176 Index s,
2177 Index b,
2178 Index p,
2179 const Range& r,
2180 Index c);
2181 // -||||-|
2183 Index v,
2184 Index s,
2185 Index b,
2186 Index p,
2187 const Range& r,
2188 Index c);
2189 // |||--||
2191 Index v,
2192 Index s,
2193 const Range& b,
2194 const Range& p,
2195 Index r,
2196 Index c);
2197 // ||-|-||
2199 Index v,
2200 const Range& s,
2201 Index b,
2202 const Range& p,
2203 Index r,
2204 Index c);
2205 // |-||-||
2207 const Range& v,
2208 Index s,
2209 Index b,
2210 const Range& p,
2211 Index r,
2212 Index c);
2213 // -|||-||
2215 Index v,
2216 Index s,
2217 Index b,
2218 const Range& p,
2219 Index r,
2220 Index c);
2221 // ||--|||
2223 Index v,
2224 const Range& s,
2225 const Range& b,
2226 Index p,
2227 Index r,
2228 Index c);
2229 // |-|-|||
2231 const Range& v,
2232 Index s,
2233 const Range& b,
2234 Index p,
2235 Index r,
2236 Index c);
2237 // -||-|||
2239 Index v,
2240 Index s,
2241 const Range& b,
2242 Index p,
2243 Index r,
2244 Index c);
2245 // |--||||
2247 const Range& v,
2248 const Range& s,
2249 Index b,
2250 Index p,
2251 Index r,
2252 Index c);
2253 // -|-||||
2255 Index v,
2256 const Range& s,
2257 Index b,
2258 Index p,
2259 Index r,
2260 Index c);
2261 // --|||||
2263 const Range& v,
2264 Index s,
2265 Index b,
2266 Index p,
2267 Index r,
2268 Index c);
2269
2270 // Result 1D (7 combinations)
2271 // ||||||-
2273 Index l, Index v, Index s, Index b, Index p, Index r, const Range& c);
2274 // |||||-|
2276 Index l, Index v, Index s, Index b, Index p, const Range& r, Index c);
2277 // ||||-||
2279 Index l, Index v, Index s, Index b, const Range& p, Index r, Index c);
2280 // |||-|||
2282 Index l, Index v, Index s, const Range& b, Index p, Index r, Index c);
2283 // ||-||||
2285 Index l, Index v, const Range& s, Index b, Index p, Index r, Index c);
2286 // |-|||||
2288 Index l, const Range& v, Index s, Index b, Index p, Index r, Index c);
2289 // -||||||
2291 const Range& l, Index v, Index s, Index b, Index p, Index r, Index c);
2292
2293 // Result scalar (1 combination)
2294 // |||||||
2296 Index l, Index v, Index s, Index b, Index p, Index r, Index c) {
2297 CHECK(l);
2298 CHECK(v);
2299 CHECK(s);
2300 CHECK(b);
2301 CHECK(p);
2302 CHECK(r);
2303 CHECK(c);
2304 return get(l, v, s, b, p, r, c);
2305 }
2306
2309 return *(mdata + OFFSET(l) + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) +
2310 OFFSET(r) + OFFSET(c));
2311 }
2312
2313 // Conversion to a plain C-array
2314 const Numeric* get_c_array() const ARTS_NOEXCEPT;
2316
2317 // Functions returning iterators:
2318 Iterator7D begin();
2319 Iterator7D end();
2320
2321 // Assignment operators:
2322 Tensor7View& operator=(const ConstTensor7View& v);
2323 Tensor7View& operator=(const Tensor7View& v);
2324 Tensor7View& operator=(const Tensor7& v);
2325 Tensor7View& operator=(Numeric x);
2326
2327 // Other operators:
2328 Tensor7View& operator*=(Numeric x);
2329 Tensor7View& operator/=(Numeric x);
2330 Tensor7View& operator+=(Numeric x);
2331 Tensor7View& operator-=(Numeric x);
2332
2333 Tensor7View& operator*=(const ConstTensor7View& x);
2334 Tensor7View& operator/=(const ConstTensor7View& x);
2335 Tensor7View& operator+=(const ConstTensor7View& x);
2336 Tensor7View& operator-=(const ConstTensor7View& x);
2337
2339 virtual ~Tensor7View() = default;
2340
2341 // Friends:
2342
2343 // Special constructor to make a Tensor7 view of a Tensor6.
2344 Tensor7View(const Tensor6View& a);
2345
2346 protected:
2347 // Constructors:
2348 Tensor7View() = default;
2350 const Range& l,
2351 const Range& v,
2352 const Range& s,
2353 const Range& b,
2354 const Range& p,
2355 const Range& r,
2356 const Range& c);
2358 const Range& pl,
2359 const Range& pv,
2360 const Range& ps,
2361 const Range& pb,
2362 const Range& pp,
2363 const Range& pr,
2364 const Range& pc,
2365 const Range& nl,
2366 const Range& nv,
2367 const Range& ns,
2368 const Range& nb,
2369 const Range& np,
2370 const Range& nr,
2371 const Range& nc);
2372};
2373
2382class Tensor7 : public Tensor7View {
2383 public:
2384 // Constructors:
2385 Tensor7() = default;
2386 Tensor7(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2387 Tensor7(Index l,
2388 Index v,
2389 Index s,
2390 Index b,
2391 Index p,
2392 Index r,
2393 Index c,
2394 Numeric fill);
2395 Tensor7(const ConstTensor7View& v);
2396 Tensor7(const Tensor7& v);
2397 Tensor7(Tensor7&& v) noexcept : Tensor7View(std::forward<Tensor7View>(v)) {
2398 v.mdata = nullptr;
2399 }
2400
2401 // Assignment operators:
2402 Tensor7& operator=(const Tensor7& x);
2403 Tensor7& operator=(Tensor7&& x) noexcept;
2405
2406 // Resize function:
2407 void resize(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2408
2409 // Swap function:
2410 friend void swap(Tensor7& t1, Tensor7& t2);
2411
2412 // Destructor:
2413 virtual ~Tensor7();
2414
2415 // Total size
2416 Index size() const noexcept {return nlibraries() * nvitrines() * nshelves() * nbooks() * npages() * nrows() * ncols();}
2417
2419 template <std::size_t dim0>
2421 static_assert(dim0 < 7, "Bad Dimension, Out-of-Bounds");
2422
2423 Range r0(0, dim0 == 0 ? nlibraries() : dim0 == 1 ? nvitrines() : dim0 == 2 ? nshelves() : dim0 == 3 ? nbooks() : dim0 == 4 ? npages() : dim0 == 5 ? nrows() : ncols());
2424
2425 Vector out(mdata, r0);
2426 ARTS_ASSERT(size() not_eq out.size(), "Can only reduce size on same size input");
2427 mdata = nullptr;
2428 return out;
2429 }
2430
2432 template <std::size_t dim0, std::size_t dim1>
2434 static_assert(dim1 < 7, "Bad Dimension, Out-of-Bounds");
2435 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2436
2437 const Range r1(0, dim1 == 1 ? nvitrines() : dim1 == 2 ? nshelves() : dim1 == 3 ? nbooks() : dim1 == 4 ? npages() : dim1 == 5 ? nrows() : ncols());
2438 const Range r0(0, dim0 == 0 ? nlibraries() : dim0 == 1 ? nvitrines() : dim0 == 2 ? nshelves() : dim0 == 3 ? nbooks() : dim0 == 4 ? npages() : nrows(), r1.get_extent());
2439
2440 Matrix out(mdata, r0, r1);
2441 ARTS_ASSERT(size() not_eq out.size(), "Can only reduce size on same size input");
2442 mdata = nullptr;
2443 return out;
2444 }
2445
2447 template <std::size_t dim0, std::size_t dim1, std::size_t dim2>
2449 static_assert(dim2 < 7, "Bad Dimension, Out-of-Bounds");
2450 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2451 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2452
2453 const Range r2(0, dim2 == 2 ? nshelves() : dim2 == 3 ? nbooks() : dim2 == 4 ? npages() : dim2 == 5 ? nrows() : ncols());
2454 const Range r1(0, dim1 == 1 ? nvitrines() : dim1 == 2 ? nshelves() : dim1 == 3 ? nbooks() : dim1 == 4 ? npages() : nrows(), r2.get_extent());
2455 const Range r0(0, dim0 == 0 ? nlibraries() : dim0 == 1 ? nvitrines() : dim0 == 2 ? nshelves() : dim0 == 3 ? nbooks() : npages(), r1.get_extent() * r2.get_extent());
2456
2457 Tensor3 out(mdata, r0, r1, r2);
2458 ARTS_ASSERT(size() not_eq out.size(), "Can only reduce size on same size input");
2459 mdata = nullptr;
2460 return out;
2461 }
2462
2464 template <std::size_t dim0, std::size_t dim1, std::size_t dim2, std::size_t dim3>
2466 static_assert(dim3 < 7, "Bad Dimension, Out-of-Bounds");
2467 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2468 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2469 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2470
2471 const Range r3(0, dim3 == 3 ? nbooks() : dim3 == 4 ? npages() : dim3 == 5 ? nrows() : ncols());
2472 const Range r2(0, dim2 == 2 ? nshelves() : dim2 == 3 ? nbooks() : dim2 == 4 ? npages() : nrows(), r3.get_extent());
2473 const Range r1(0, dim1 == 1 ? nvitrines() : dim1 == 2 ? nshelves() : dim1 == 3 ? nbooks() : npages(), r2.get_extent() * r3.get_extent());
2474 const Range r0(0, dim0 == 0 ? nlibraries() : dim0 == 1 ? nvitrines() : dim0 == 2 ? nshelves() : nbooks(), r1.get_extent() * r2.get_extent() * r3.get_extent());
2475
2476 Tensor4 out(mdata, r0, r1, r2, r3);
2477 ARTS_ASSERT(size() not_eq out.size(), "Can only reduce size on same size input");
2478 mdata = nullptr;
2479 return out;
2480 }
2481
2483 template <std::size_t dim0, std::size_t dim1, std::size_t dim2, std::size_t dim3, std::size_t dim4>
2485 static_assert(dim4 < 7, "Bad Dimension, Out-of-Bounds");
2486 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2487 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2488 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2489 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2490
2491 const Range r4(0, dim4 == 4 ? npages() : dim4 == 5 ? nrows() : ncols());
2492 const Range r3(0, dim3 == 3 ? nbooks() : dim3 == 4 ? npages() : nrows(), r4.get_extent());
2493 const Range r2(0, dim2 == 2 ? nshelves() : dim2 == 3 ? nbooks() : npages(), r3.get_extent() * r4.get_extent());
2494 const Range r1(0, dim1 == 1 ? nvitrines() : dim1 == 2 ? nshelves() : nbooks(), r2.get_extent() * r3.get_extent() * r4.get_extent());
2495 const Range r0(0, dim0 == 0 ? nlibraries() : dim0 == 1 ? nvitrines() : nshelves(), r1.get_extent() * r2.get_extent() * r3.get_extent() * r4.get_extent());
2496
2497 Tensor5 out(mdata, r0, r1, r2, r3, r4);
2498 ARTS_ASSERT(size() not_eq out.size(), "Can only reduce size on same size input");
2499 mdata = nullptr;
2500 return out;
2501 }
2502
2504 template <std::size_t dim0, std::size_t dim1, std::size_t dim2, std::size_t dim3, std::size_t dim4, std::size_t dim5>
2506 static_assert(dim5 < 7, "Bad Dimension, Out-of-Bounds");
2507 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2508 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2509 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2510 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2511 static_assert(dim4 < dim5, "Bad Dimensions, dim5 must be larger than dim4");
2512
2513 const Range r5(0, dim5 == 5 ? nrows() : ncols());
2514 const Range r4(0, dim4 == 4 ? npages() : nrows(), r5.get_extent());
2515 const Range r3(0, dim3 == 3 ? nbooks() : npages(), r4.get_extent() * r5.get_extent());
2516 const Range r2(0, dim2 == 2 ? nshelves() : nbooks(), r3.get_extent() * r4.get_extent() * r5.get_extent());
2517 const Range r1(0, dim1 == 1 ? nvitrines() : nshelves(), r2.get_extent() * r3.get_extent() * r4.get_extent() * r5.get_extent());
2518 const Range r0(0, dim0 == 0 ? nlibraries() : nvitrines(), r1.get_extent() * r2.get_extent() * r3.get_extent() * r4.get_extent() * r5.get_extent());
2519
2520 Tensor6 out(mdata, r0, r1, r2, r3, r4, r5);
2521 ARTS_ASSERT(size() not_eq out.size(), "Can only reduce size on same size input");
2522 mdata = nullptr;
2523 return out;
2524 }
2525};
2526
2527// Function declarations:
2528// ----------------------
2529
2530void copy(ConstIterator7D origin,
2531 const ConstIterator7D& end,
2532 Iterator7D target);
2533
2534void copy(Numeric x, Iterator7D target, const Iterator7D& end);
2535
2536void transform(Tensor7View y, double (&my_func)(double), ConstTensor7View x);
2537
2538Numeric max(const ConstTensor7View& x);
2539
2540Numeric min(const ConstTensor7View& x);
2541
2542std::ostream& operator<<(std::ostream& os, const ConstTensor7View& v);
2543
2545// Helper function for debugging
2546#ifndef NDEBUG
2547
2549 Index l,
2550 Index v,
2551 Index s,
2552 Index b,
2553 Index p,
2554 Index r,
2555 Index c);
2556
2557#endif
2559
2560#endif // matpackVII_h
void * data
Const version of Iterator7D.
Definition: matpackVII.h:84
const ConstTensor6View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVII.h:119
ConstTensor6View msv
Current position.
Definition: matpackVII.h:126
ConstIterator7D & operator++()
Prefix increment operator.
Definition: matpackVII.h:97
ConstIterator7D()=default
Default constructor.
const ConstTensor6View & operator*() const
Dereferencing.
Definition: matpackVII.h:122
Index mstride
Stride.
Definition: matpackVII.h:128
ConstIterator7D(const ConstTensor6View &x, Index stride)
Explicit constructor.
Definition: matpackVII.h:91
bool operator!=(const ConstIterator7D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackVII.h:106
A constant view of a Matrix.
Definition: matpackI.h:1014
A constant view of a Tensor3.
Definition: matpackIII.h:132
A constant view of a Tensor4.
Definition: matpackIV.h:133
A constant view of a Tensor5.
Definition: matpackV.h:143
A constant view of a Tensor6.
Definition: matpackVI.h:149
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVI.h:597
Range mcr
The column range of mdata that is actually used.
Definition: matpackVI.h:607
Range mbr
The book range of mdata that is actually used.
Definition: matpackVI.h:601
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVI.h:609
Range mrr
The row range of mdata that is actually used.
Definition: matpackVI.h:605
Range mpr
The page range of mdata that is actually used.
Definition: matpackVI.h:603
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVI.h:599
A constant view of a Tensor7.
Definition: matpackVII.h:147
bool empty() const
Check if variable is empty.
Definition: matpackVII.cc:36
Range mrr
The row range of mdata that is actually used.
Definition: matpackVII.h:1270
Index nshelves() const
Returns the number of shelves.
Definition: matpackVII.cc:48
Range mcr
The column range of mdata that is actually used.
Definition: matpackVII.h:1272
Index nrows() const
Returns the number of rows.
Definition: matpackVII.cc:57
Index nvitrines() const
Returns the number of vitrines.
Definition: matpackVII.cc:45
Index npages() const
Returns the number of pages.
Definition: matpackVII.cc:54
ConstTensor7View & operator=(const ConstTensor7View &)=default
ConstIterator7D end() const
Return const iterator behind last sub-tensor.
Definition: matpackVII.cc:2492
Numeric operator()(Index l, Index v, Index s, Index b, Index p, Index r, Index c) const
Definition: matpackVII.h:1198
Range mbr
The book range of mdata that is actually used.
Definition: matpackVII.h:1266
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVII.h:1262
ConstIterator7D begin() const
Return const iterator to first sub-tensor.
Definition: matpackVII.cc:2485
Range mpr
The page range of mdata that is actually used.
Definition: matpackVII.h:1268
ConstTensor7View()=default
Range mlr
The library range of mdata that is actually used.
Definition: matpackVII.h:1260
constexpr ConstTensor7View(ConstTensor7View &&)=default
constexpr ConstTensor7View(const ConstTensor7View &)=default
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVII.h:1274
Index ncols() const
Returns the number of columns.
Definition: matpackVII.cc:60
ConstTensor7View & operator=(ConstTensor7View &&)=default
ConstTensor7View operator()(const Range &l, const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c) const
Definition: matpackVII.cc:65
virtual ~ConstTensor7View()=default
Destructor.
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVII.h:1264
Index nlibraries() const
Returns the number of libraries.
Definition: matpackVII.cc:42
Index nbooks() const
Returns the number of books.
Definition: matpackVII.cc:51
Numeric get(Index l, Index v, Index s, Index b, Index p, Index r, Index c) const
Get element implementation without assertions.
Definition: matpackVII.h:1211
A constant view of a Vector.
Definition: matpackI.h:489
Index size() const ARTS_NOEXCEPT
Definition: matpackI.cc:50
Implementation of Tensors of Rank 7.
Definition: matpackVII.h:36
Iterator7D()=default
Default constructor.
Tensor6View & operator*()
Dereferencing.
Definition: matpackVII.h:74
Iterator7D & operator++()
Prefix increment operator.
Definition: matpackVII.h:49
bool operator!=(const Iterator7D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackVII.h:58
Tensor6View msv
Current position.
Definition: matpackVII.h:78
Index mstride
Stride.
Definition: matpackVII.h:80
Tensor6View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVII.h:71
Iterator7D(const Tensor6View &x, Index stride)
Explicit constructor.
Definition: matpackVII.h:43
The MatrixView class.
Definition: matpackI.h:1125
The Matrix class.
Definition: matpackI.h:1225
Index size() const noexcept
Definition: matpackI.h:1268
The range class.
Definition: matpackI.h:165
Index mstart
The start index.
Definition: matpackI.h:351
constexpr Index get_extent() const ARTS_NOEXCEPT
Returns the extent of the range.
Definition: matpackI.h:334
The Tensor3View class.
Definition: matpackIII.h:239
The Tensor3 class.
Definition: matpackIII.h:339
Index size() const noexcept
Definition: matpackIII.h:383
The Tensor4View class.
Definition: matpackIV.h:284
The Tensor4 class.
Definition: matpackIV.h:421
Index size() const noexcept
Definition: matpackIV.h:467
The Tensor5View class.
Definition: matpackV.h:333
The Tensor5 class.
Definition: matpackV.h:506
Index size() const noexcept
Definition: matpackV.h:554
The Tensor6View class.
Definition: matpackVI.h:621
The Tensor6 class.
Definition: matpackVI.h:1088
Index size() const noexcept
Definition: matpackVI.h:1138
The Tensor7View class.
Definition: matpackVII.h:1286
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackVII.cc:5011
Tensor7View operator()(const Range &l, const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c)
Definition: matpackVII.cc:2596
Iterator7D end()
Return iterator behind last sub-tensor.
Definition: matpackVII.cc:5038
Numeric & get(Index l, Index v, Index s, Index b, Index p, Index r, Index c)
Get element implementation without assertions.
Definition: matpackVII.h:2308
Tensor7View()=default
Tensor7View & operator=(const ConstTensor7View &v)
Assignment operator.
Definition: matpackVII.cc:5054
Numeric & operator()(Index l, Index v, Index s, Index b, Index p, Index r, Index c)
Definition: matpackVII.h:2295
Iterator7D begin()
Return iterator to first sub-tensor.
Definition: matpackVII.cc:5031
constexpr Tensor7View(const Tensor7View &)=default
The Tensor7 class.
Definition: matpackVII.h:2382
Tensor3 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2448
Index size() const noexcept
Definition: matpackVII.h:2416
Tensor4 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2465
Matrix reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2433
Tensor7()=default
Tensor6 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2505
Tensor7(Tensor7 &&v) noexcept
Definition: matpackVII.h:2397
Vector reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2420
Tensor5 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2484
The VectorView class.
Definition: matpackI.h:626
The Vector class.
Definition: matpackI.h:876
#define ARTS_NOEXCEPT
Definition: debug.h:80
#define ARTS_ASSERT(condition,...)
Definition: debug.h:83
#define ns
Numeric max(const ConstTensor7View &x)
Max function, tensor version.
Definition: matpackVII.cc:5584
void copy(ConstIterator7D origin, const ConstIterator7D &end, Iterator7D target)
Copy data between begin and end to target.
Definition: matpackVII.cc:5300
Numeric debug_tensor7view_get_elem(Tensor7View &tv, Index l, Index v, Index s, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
Definition: matpackVII.cc:5643
Numeric min(const ConstTensor7View &x)
Min function, tensor version.
Definition: matpackVII.cc:5603
std::ostream & operator<<(std::ostream &os, const ConstTensor7View &v)
Output operator.
Definition: matpackVII.cc:2572
void transform(Tensor7View y, double(&my_func)(double), ConstTensor7View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
Definition: matpackVII.cc:5563
#define CHECK(x)
Implementation of Tensors of Rank 6.
Definition: matpackVI.h:33
#define OFFSET(x)
Definition: matpackVI.h:36
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
constexpr Numeric r0
The reference radius in IGRF13.
Definition: igrf13.cc:203
constexpr Numeric l(const Index p0, const Index n, const Numeric x, const SortedVectorType &xi, const Index j, const std::pair< Numeric, Numeric > cycle={ -180, 180}) noexcept
#define v
#define a
#define c
#define b