ARTS 2.5.10 (git: 2f1c442c)
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 <utility>
33
34#include "matpackVI.h"
35#include "matpack_concepts.h"
36
40 public:
41 // Constructors:
43 Iterator7D() = default;
44
46 Iterator7D(const Tensor6View& x, Index stride)
47 : msv(x), mstride(stride) { /* Nothing to do here. */
48 }
49
50 // Operators:
53 msv.mdata += mstride;
54 return *this;
55 }
56
61 bool operator!=(const Iterator7D& other) const {
64 other.msv.mdata + other.msv.mvr.mstart + other.msv.msr.mstart +
65 other.msv.mbr.mstart + other.msv.mpr.mstart + other.msv.mrr.mstart +
66 other.msv.mcr.mstart)
67 return true;
68 return false;
69 }
70
73 Tensor6View* operator->() { return &msv; }
74
76 Tensor6View& operator*() { return msv; }
77
78 private:
83};
84
87 public:
88 // Constructors:
90 ConstIterator7D() = default;
91
94 : msv(std::move(x)), mstride(stride) { /* Nothing to do here. */
95 }
96
97 // Operators:
100 msv.mdata += mstride;
101 return *this;
102 }
103
108 bool operator!=(const ConstIterator7D& other) const {
111 other.msv.mdata + other.msv.mvr.mstart + other.msv.msr.mstart +
112 other.msv.mbr.mstart + other.msv.mpr.mstart + other.msv.mrr.mstart +
113 other.msv.mcr.mstart)
114 return true;
115 return false;
116 }
117
120 const ConstTensor6View* operator->() const { return &msv; }
121
123 const ConstTensor6View& operator*() const { return msv; }
124
125 private:
130};
131
132// Declare class Tensor7:
133class Tensor7;
134
149 public:
150 static constexpr bool matpack_type{true};
151
152 constexpr ConstTensor7View(const ConstTensor7View&) = default;
153 constexpr ConstTensor7View(ConstTensor7View&&) = default;
156
157 // Member functions:
158 [[nodiscard]] Index nlibraries() const noexcept { return mlr.mextent; }
159 [[nodiscard]] Index nvitrines() const noexcept { return mvr.mextent; }
160 [[nodiscard]] Index nshelves() const noexcept { return msr.mextent; }
161 [[nodiscard]] Index nbooks() const noexcept { return mbr.mextent; }
162 [[nodiscard]] Index npages() const noexcept { return mpr.mextent; }
163 [[nodiscard]] Index nrows() const noexcept { return mrr.mextent; }
164 [[nodiscard]] Index ncols() const noexcept { return mcr.mextent; }
165
166 // Total size
167 [[nodiscard]] Index size() const noexcept {
168 return nlibraries() * nvitrines() * nshelves() * nbooks() * npages() *
169 nrows() * ncols();
170 }
171 [[nodiscard]] bool empty() const noexcept { return size() == 0; }
172
174 [[nodiscard]] Shape<7> shape() const {
175 return {nlibraries(),
176 nvitrines(),
177 nshelves(),
178 nbooks(),
179 npages(),
180 nrows(),
181 ncols()};
182 }
183
184 // Const index operators:
185
186 // Result 7D (1 combination)
187 // -------
189 const Range& v,
190 const Range& s,
191 const Range& b,
192 const Range& p,
193 const Range& r,
194 const Range& c) const;
195
196 // Result 6D (7 combinations)
197 // ------|
199 const Range& v,
200 const Range& s,
201 const Range& b,
202 const Range& p,
203 const Range& r,
204 Index c) const;
205 // -----|-
207 const Range& v,
208 const Range& s,
209 const Range& b,
210 const Range& p,
211 Index r,
212 const Range& c) const;
213 // ----|--
215 const Range& v,
216 const Range& s,
217 const Range& b,
218 Index p,
219 const Range& r,
220 const Range& c) const;
221 // ---|---
223 const Range& v,
224 const Range& s,
225 Index b,
226 const Range& p,
227 const Range& r,
228 const Range& c) const;
229 // --|----
231 const Range& v,
232 Index s,
233 const Range& b,
234 const Range& p,
235 const Range& r,
236 const Range& c) const;
237 // -|-----
239 Index v,
240 const Range& s,
241 const Range& b,
242 const Range& p,
243 const Range& r,
244 const Range& c) const;
245 // |------
247 const Range& v,
248 const Range& s,
249 const Range& b,
250 const Range& p,
251 const Range& r,
252 const Range& c) const;
253
254 // Result 5D (6+5+4+3+2+1 = 21 combinations)
255 // -----||
257 const Range& v,
258 const Range& s,
259 const Range& b,
260 const Range& p,
261 Index r,
262 Index c) const;
263 // ----|-|
265 const Range& v,
266 const Range& s,
267 const Range& b,
268 Index p,
269 const Range& r,
270 Index c) const;
271 // ---|--|
273 const Range& v,
274 const Range& s,
275 Index b,
276 const Range& p,
277 const Range& r,
278 Index c) const;
279 // --|---|
281 const Range& v,
282 Index s,
283 const Range& b,
284 const Range& p,
285 const Range& r,
286 Index c) const;
287 // -|----|
289 Index v,
290 const Range& s,
291 const Range& b,
292 const Range& p,
293 const Range& r,
294 Index c) const;
295 // |-----|
297 const Range& v,
298 const Range& s,
299 const Range& b,
300 const Range& p,
301 const Range& r,
302 Index c) const;
303 // ----||-
305 const Range& v,
306 const Range& s,
307 const Range& b,
308 Index p,
309 Index r,
310 const Range& c) const;
311 // ---|-|-
313 const Range& v,
314 const Range& s,
315 Index b,
316 const Range& p,
317 Index r,
318 const Range& c) const;
319 // --|--|-
321 const Range& v,
322 Index s,
323 const Range& b,
324 const Range& p,
325 Index r,
326 const Range& c) const;
327 // -|---|-
329 Index v,
330 const Range& s,
331 const Range& b,
332 const Range& p,
333 Index r,
334 const Range& c) const;
335 // |----|-
337 const Range& v,
338 const Range& s,
339 const Range& b,
340 const Range& p,
341 Index r,
342 const Range& c) const;
343 // ---||--
345 const Range& v,
346 const Range& s,
347 Index b,
348 Index p,
349 const Range& r,
350 const Range& c) const;
351 // --|-|--
353 const Range& v,
354 Index s,
355 const Range& b,
356 Index p,
357 const Range& r,
358 const Range& c) const;
359 // -|--|--
361 Index v,
362 const Range& s,
363 const Range& b,
364 Index p,
365 const Range& r,
366 const Range& c) const;
367 // |---|--
369 const Range& v,
370 const Range& s,
371 const Range& b,
372 Index p,
373 const Range& r,
374 const Range& c) const;
375 // --||---
377 const Range& v,
378 Index s,
379 Index b,
380 const Range& p,
381 const Range& r,
382 const Range& c) const;
383 // -|-|---
385 Index v,
386 const Range& s,
387 Index b,
388 const Range& p,
389 const Range& r,
390 const Range& c) const;
391 // |--|---
393 const Range& v,
394 const Range& s,
395 Index b,
396 const Range& p,
397 const Range& r,
398 const Range& c) const;
399 // -||----
401 Index v,
402 Index s,
403 const Range& b,
404 const Range& p,
405 const Range& r,
406 const Range& c) const;
407 // |-|----
409 const Range& v,
410 Index s,
411 const Range& b,
412 const Range& p,
413 const Range& r,
414 const Range& c) const;
415 // ||-----
417 Index v,
418 const Range& s,
419 const Range& b,
420 const Range& p,
421 const Range& r,
422 const Range& c) const;
423
424 // Result 4D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
425 // ----|||
427 const Range& v,
428 const Range& s,
429 const Range& b,
430 Index p,
431 Index r,
432 Index c) const;
433 // ---|-||
435 const Range& v,
436 const Range& s,
437 Index b,
438 const Range& p,
439 Index r,
440 Index c) const;
441 // --|--||
443 const Range& v,
444 Index s,
445 const Range& b,
446 const Range& p,
447 Index r,
448 Index c) const;
449 // -|---||
451 Index v,
452 const Range& s,
453 const Range& b,
454 const Range& p,
455 Index r,
456 Index c) const;
457 // |----||
459 const Range& v,
460 const Range& s,
461 const Range& b,
462 const Range& p,
463 Index r,
464 Index c) const;
465 // ---||-|
467 const Range& v,
468 const Range& s,
469 Index b,
470 Index p,
471 const Range& r,
472 Index c) const;
473 // --|-|-|
475 const Range& v,
476 Index s,
477 const Range& b,
478 Index p,
479 const Range& r,
480 Index c) const;
481 // -|--|-|
483 Index v,
484 const Range& s,
485 const Range& b,
486 Index p,
487 const Range& r,
488 Index c) const;
489 // |---|-|
491 const Range& v,
492 const Range& s,
493 const Range& b,
494 Index p,
495 const Range& r,
496 Index c) const;
497 // --||--|
499 const Range& v,
500 Index s,
501 Index b,
502 const Range& p,
503 const Range& r,
504 Index c) const;
505 // -|-|--|
507 Index v,
508 const Range& s,
509 Index b,
510 const Range& p,
511 const Range& r,
512 Index c) const;
513 // |--|--|
515 const Range& v,
516 const Range& s,
517 Index b,
518 const Range& p,
519 const Range& r,
520 Index c) const;
521 // -||---|
523 Index v,
524 Index s,
525 const Range& b,
526 const Range& p,
527 const Range& r,
528 Index c) const;
529 // |-|---|
531 const Range& v,
532 Index s,
533 const Range& b,
534 const Range& p,
535 const Range& r,
536 Index c) const;
537 // ||----|
539 Index v,
540 const Range& s,
541 const Range& b,
542 const Range& p,
543 const Range& r,
544 Index c) const;
545 // ---|||-
547 const Range& v,
548 const Range& s,
549 Index b,
550 Index p,
551 Index r,
552 const Range& c) const;
553 // --|-||-
555 const Range& v,
556 Index s,
557 const Range& b,
558 Index p,
559 Index r,
560 const Range& c) const;
561 // -|--||-
563 Index v,
564 const Range& s,
565 const Range& b,
566 Index p,
567 Index r,
568 const Range& c) const;
569 // |---||-
571 const Range& v,
572 const Range& s,
573 const Range& b,
574 Index p,
575 Index r,
576 const Range& c) const;
577 // --||-|-
579 const Range& v,
580 Index s,
581 Index b,
582 const Range& p,
583 Index r,
584 const Range& c) const;
585 // -|-|-|-
587 Index v,
588 const Range& s,
589 Index b,
590 const Range& p,
591 Index r,
592 const Range& c) const;
593 // |--|-|-
595 const Range& v,
596 const Range& s,
597 Index b,
598 const Range& p,
599 Index r,
600 const Range& c) const;
601 // -||--|-
603 Index v,
604 Index s,
605 const Range& b,
606 const Range& p,
607 Index r,
608 const Range& c) const;
609 // |-|--|-
611 const Range& v,
612 Index s,
613 const Range& b,
614 const Range& p,
615 Index r,
616 const Range& c) const;
617 // ||---|-
619 Index v,
620 const Range& s,
621 const Range& b,
622 const Range& p,
623 Index r,
624 const Range& c) const;
625 // --|||--
627 const Range& v,
628 Index s,
629 Index b,
630 Index p,
631 const Range& r,
632 const Range& c) const;
633 // -|-||--
635 Index v,
636 const Range& s,
637 Index b,
638 Index p,
639 const Range& r,
640 const Range& c) const;
641 // |--||--
643 const Range& v,
644 const Range& s,
645 Index b,
646 Index p,
647 const Range& r,
648 const Range& c) const;
649 // -||-|--
651 Index v,
652 Index s,
653 const Range& b,
654 Index p,
655 const Range& r,
656 const Range& c) const;
657 // |-|-|--
659 const Range& v,
660 Index s,
661 const Range& b,
662 Index p,
663 const Range& r,
664 const Range& c) const;
665 // ||--|--
667 Index v,
668 const Range& s,
669 const Range& b,
670 Index p,
671 const Range& r,
672 const Range& c) const;
673 // -|||---
675 Index v,
676 Index s,
677 Index b,
678 const Range& p,
679 const Range& r,
680 const Range& c) const;
681 // |-||---
683 const Range& v,
684 Index s,
685 Index b,
686 const Range& p,
687 const Range& r,
688 const Range& c) const;
689 // ||-|---
691 Index v,
692 const Range& s,
693 Index b,
694 const Range& p,
695 const Range& r,
696 const Range& c) const;
697 // |||----
699 Index v,
700 Index s,
701 const Range& b,
702 const Range& p,
703 const Range& r,
704 const Range& c) const;
705
706 // Result 3D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
707 // ||||---
709 Index v,
710 Index s,
711 Index b,
712 const Range& p,
713 const Range& r,
714 const Range& c) const;
715 // |||-|--
717 Index v,
718 Index s,
719 const Range& b,
720 Index p,
721 const Range& r,
722 const Range& c) const;
723 // ||-||--
725 Index v,
726 const Range& s,
727 Index b,
728 Index p,
729 const Range& r,
730 const Range& c) const;
731 // |-|||--
733 const Range& v,
734 Index s,
735 Index b,
736 Index p,
737 const Range& r,
738 const Range& c) const;
739 // -||||--
741 Index v,
742 Index s,
743 Index b,
744 Index p,
745 const Range& r,
746 const Range& c) const;
747 // |||--|-
749 Index v,
750 Index s,
751 const Range& b,
752 const Range& p,
753 Index r,
754 const Range& c) const;
755 // ||-|-|-
757 Index v,
758 const Range& s,
759 Index b,
760 const Range& p,
761 Index r,
762 const Range& c) const;
763 // |-||-|-
765 const Range& v,
766 Index s,
767 Index b,
768 const Range& p,
769 Index r,
770 const Range& c) const;
771 // -|||-|-
773 Index v,
774 Index s,
775 Index b,
776 const Range& p,
777 Index r,
778 const Range& c) const;
779 // ||--||-
781 Index v,
782 const Range& s,
783 const Range& b,
784 Index p,
785 Index r,
786 const Range& c) const;
787 // |-|-||-
789 const Range& v,
790 Index s,
791 const Range& b,
792 Index p,
793 Index r,
794 const Range& c) const;
795 // -||-||-
797 Index v,
798 Index s,
799 const Range& b,
800 Index p,
801 Index r,
802 const Range& c) const;
803 // |--|||-
805 const Range& v,
806 const Range& s,
807 Index b,
808 Index p,
809 Index r,
810 const Range& c) const;
811 // -|-|||-
813 Index v,
814 const Range& s,
815 Index b,
816 Index p,
817 Index r,
818 const Range& c) const;
819 // --||||-
821 const Range& v,
822 Index s,
823 Index b,
824 Index p,
825 Index r,
826 const Range& c) const;
827 // |||---|
829 Index v,
830 Index s,
831 const Range& b,
832 const Range& p,
833 const Range& r,
834 Index c) const;
835 // ||-|--|
837 Index v,
838 const Range& s,
839 Index b,
840 const Range& p,
841 const Range& r,
842 Index c) const;
843 // |-||--|
845 const Range& v,
846 Index s,
847 Index b,
848 const Range& p,
849 const Range& r,
850 Index c) const;
851 // -|||--|
853 Index v,
854 Index s,
855 Index b,
856 const Range& p,
857 const Range& r,
858 Index c) const;
859 // ||--|-|
861 Index v,
862 const Range& s,
863 const Range& b,
864 Index p,
865 const Range& r,
866 Index c) const;
867 // |-|-|-|
869 const Range& v,
870 Index s,
871 const Range& b,
872 Index p,
873 const Range& r,
874 Index c) const;
875 // -||-|-|
877 Index v,
878 Index s,
879 const Range& b,
880 Index p,
881 const Range& r,
882 Index c) const;
883 // |--||-|
885 const Range& v,
886 const Range& s,
887 Index b,
888 Index p,
889 const Range& r,
890 Index c) const;
891 // -|-||-|
893 Index v,
894 const Range& s,
895 Index b,
896 Index p,
897 const Range& r,
898 Index c) const;
899 // --|||-|
901 const Range& v,
902 Index s,
903 Index b,
904 Index p,
905 const Range& r,
906 Index c) const;
907 // ||---||
909 Index v,
910 const Range& s,
911 const Range& b,
912 const Range& p,
913 Index r,
914 Index c) const;
915 // |-|--||
917 const Range& v,
918 Index s,
919 const Range& b,
920 const Range& p,
921 Index r,
922 Index c) const;
923 // -||--||
925 Index v,
926 Index s,
927 const Range& b,
928 const Range& p,
929 Index r,
930 Index c) const;
931 // |--|-||
933 const Range& v,
934 const Range& s,
935 Index b,
936 const Range& p,
937 Index r,
938 Index c) const;
939 // -|-|-||
941 Index v,
942 const Range& s,
943 Index b,
944 const Range& p,
945 Index r,
946 Index c) const;
947 // --||-||
949 const Range& v,
950 Index s,
951 Index b,
952 const Range& p,
953 Index r,
954 Index c) const;
955 // |---|||
957 const Range& v,
958 const Range& s,
959 const Range& b,
960 Index p,
961 Index r,
962 Index c) const;
963 // -|--|||
965 Index v,
966 const Range& s,
967 const Range& b,
968 Index p,
969 Index r,
970 Index c) const;
971 // --|-|||
973 const Range& v,
974 Index s,
975 const Range& b,
976 Index p,
977 Index r,
978 Index c) const;
979 // ---||||
981 const Range& v,
982 const Range& s,
983 Index b,
984 Index p,
985 Index r,
986 Index c) const;
987
988 // Result 2D (6+5+4+3+2+1 = 21 combinations)
989 // |||||--
991 Index v,
992 Index s,
993 Index b,
994 Index p,
995 const Range& r,
996 const Range& c) const;
997 // ||||-|-
999 Index v,
1000 Index s,
1001 Index b,
1002 const Range& p,
1003 Index r,
1004 const Range& c) const;
1005 // |||-||-
1007 Index v,
1008 Index s,
1009 const Range& b,
1010 Index p,
1011 Index r,
1012 const Range& c) const;
1013 // ||-|||-
1015 Index v,
1016 const Range& s,
1017 Index b,
1018 Index p,
1019 Index r,
1020 const Range& c) const;
1021 // |-||||-
1023 const Range& v,
1024 Index s,
1025 Index b,
1026 Index p,
1027 Index r,
1028 const Range& c) const;
1029 // -|||||-
1031 Index v,
1032 Index s,
1033 Index b,
1034 Index p,
1035 Index r,
1036 const Range& c) const;
1037 // ||||--|
1039 Index v,
1040 Index s,
1041 Index b,
1042 const Range& p,
1043 const Range& r,
1044 Index c) const;
1045 // |||-|-|
1047 Index v,
1048 Index s,
1049 const Range& b,
1050 Index p,
1051 const Range& r,
1052 Index c) const;
1053 // ||-||-|
1055 Index v,
1056 const Range& s,
1057 Index b,
1058 Index p,
1059 const Range& r,
1060 Index c) const;
1061 // |-|||-|
1063 const Range& v,
1064 Index s,
1065 Index b,
1066 Index p,
1067 const Range& r,
1068 Index c) const;
1069 // -||||-|
1071 Index v,
1072 Index s,
1073 Index b,
1074 Index p,
1075 const Range& r,
1076 Index c) const;
1077 // |||--||
1079 Index v,
1080 Index s,
1081 const Range& b,
1082 const Range& p,
1083 Index r,
1084 Index c) const;
1085 // ||-|-||
1087 Index v,
1088 const Range& s,
1089 Index b,
1090 const Range& p,
1091 Index r,
1092 Index c) const;
1093 // |-||-||
1095 const Range& v,
1096 Index s,
1097 Index b,
1098 const Range& p,
1099 Index r,
1100 Index c) const;
1101 // -|||-||
1103 Index v,
1104 Index s,
1105 Index b,
1106 const Range& p,
1107 Index r,
1108 Index c) const;
1109 // ||--|||
1111 Index v,
1112 const Range& s,
1113 const Range& b,
1114 Index p,
1115 Index r,
1116 Index c) const;
1117 // |-|-|||
1119 const Range& v,
1120 Index s,
1121 const Range& b,
1122 Index p,
1123 Index r,
1124 Index c) const;
1125 // -||-|||
1127 Index v,
1128 Index s,
1129 const Range& b,
1130 Index p,
1131 Index r,
1132 Index c) const;
1133 // |--||||
1135 const Range& v,
1136 const Range& s,
1137 Index b,
1138 Index p,
1139 Index r,
1140 Index c) const;
1141 // -|-||||
1143 Index v,
1144 const Range& s,
1145 Index b,
1146 Index p,
1147 Index r,
1148 Index c) const;
1149 // --|||||
1151 const Range& v,
1152 Index s,
1153 Index b,
1154 Index p,
1155 Index r,
1156 Index c) const;
1157
1158 // Result 1D (7 combinations)
1159 // ||||||-
1161 Index v,
1162 Index s,
1163 Index b,
1164 Index p,
1165 Index r,
1166 const Range& c) const;
1167 // |||||-|
1169 Index v,
1170 Index s,
1171 Index b,
1172 Index p,
1173 const Range& r,
1174 Index c) const;
1175 // ||||-||
1177 Index v,
1178 Index s,
1179 Index b,
1180 const Range& p,
1181 Index r,
1182 Index c) const;
1183 // |||-|||
1185 Index v,
1186 Index s,
1187 const Range& b,
1188 Index p,
1189 Index r,
1190 Index c) const;
1191 // ||-||||
1193 Index v,
1194 const Range& s,
1195 Index b,
1196 Index p,
1197 Index r,
1198 Index c) const;
1199 // |-|||||
1201 const Range& v,
1202 Index s,
1203 Index b,
1204 Index p,
1205 Index r,
1206 Index c) const;
1207 // -||||||
1209 Index v,
1210 Index s,
1211 Index b,
1212 Index p,
1213 Index r,
1214 Index c) const;
1215
1216 // Result scalar (1 combination)
1217 // |||||||
1219 Index l, Index v, Index s, Index b, Index p, Index r, Index c) const {
1220 CHECK(l);
1221 CHECK(v);
1222 CHECK(s);
1223 CHECK(b);
1224 CHECK(p);
1225 CHECK(r);
1226 CHECK(c);
1227 return get(l, v, s, b, p, r, c);
1228 }
1229
1231 [[nodiscard]] Numeric get(
1232 Index l, Index v, Index s, Index b, Index p, Index r, Index c) const {
1233 return *(mdata + OFFSET(l) + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) +
1234 OFFSET(r) + OFFSET(c));
1235 }
1236
1237 // Functions returning iterators:
1238 [[nodiscard]] ConstIterator7D begin() const;
1239 [[nodiscard]] ConstIterator7D end() const;
1240
1242 virtual ~ConstTensor7View() = default;
1243
1244 // Friends:
1245 friend class Tensor7View;
1246
1247 friend std::ostream& operator<<(std::ostream& os, const ConstTensor7View& v);
1248
1249 // Special constructor to make a Tensor7 view of a Tensor6.
1251
1252 protected:
1253 // Constructors:
1254 ConstTensor7View() = default;
1256 const Range& l,
1257 const Range& v,
1258 const Range& s,
1259 const Range& b,
1260 const Range& p,
1261 const Range& r,
1262 const Range& c);
1264 const Range& pl,
1265 const Range& pv,
1266 const Range& ps,
1267 const Range& pb,
1268 const Range& pp,
1269 const Range& pr,
1270 const Range& pc,
1271 const Range& nl,
1272 const Range& nv,
1273 const Range& ns,
1274 const Range& nb,
1275 const Range& np,
1276 const Range& nr,
1277 const Range& nc);
1278
1279 // Data members:
1280 // -------------
1282 Range mlr{0, 0, 1};
1284 Range mvr{0, 0, 1};
1286 Range msr{0, 0, 1};
1288 Range mbr{0, 0, 1};
1290 Range mpr{0, 0, 1};
1292 Range mrr{0, 0, 1};
1294 Range mcr{0, 0, 1};
1296 Numeric* mdata{nullptr};
1297};
1298
1309 public:
1310 // Make const methods visible from base class
1313 using ConstTensor7View::operator();
1315
1316 constexpr Tensor7View(const Tensor7View&) = default;
1317
1318 // Non-const index operators:
1319
1320 // Result 7D (1 combination)
1321 // -------
1322 Tensor7View operator()(const Range& l,
1323 const Range& v,
1324 const Range& s,
1325 const Range& b,
1326 const Range& p,
1327 const Range& r,
1328 const Range& c);
1329
1330 // Result 6D (7 combinations)
1331 // ------|
1332 Tensor6View operator()(const Range& l,
1333 const Range& v,
1334 const Range& s,
1335 const Range& b,
1336 const Range& p,
1337 const Range& r,
1338 Index c);
1339 // -----|-
1340 Tensor6View operator()(const Range& l,
1341 const Range& v,
1342 const Range& s,
1343 const Range& b,
1344 const Range& p,
1345 Index r,
1346 const Range& c);
1347 // ----|--
1348 Tensor6View operator()(const Range& l,
1349 const Range& v,
1350 const Range& s,
1351 const Range& b,
1352 Index p,
1353 const Range& r,
1354 const Range& c);
1355 // ---|---
1356 Tensor6View operator()(const Range& l,
1357 const Range& v,
1358 const Range& s,
1359 Index b,
1360 const Range& p,
1361 const Range& r,
1362 const Range& c);
1363 // --|----
1364 Tensor6View operator()(const Range& l,
1365 const Range& v,
1366 Index s,
1367 const Range& b,
1368 const Range& p,
1369 const Range& r,
1370 const Range& c);
1371 // -|-----
1372 Tensor6View operator()(const Range& l,
1373 Index v,
1374 const Range& s,
1375 const Range& b,
1376 const Range& p,
1377 const Range& r,
1378 const Range& c);
1379 // |------
1381 const Range& v,
1382 const Range& s,
1383 const Range& b,
1384 const Range& p,
1385 const Range& r,
1386 const Range& c);
1387
1388 // Result 5D (6+5+4+3+2+1 = 21 combinations)
1389 // -----||
1390 Tensor5View operator()(const Range& l,
1391 const Range& v,
1392 const Range& s,
1393 const Range& b,
1394 const Range& p,
1395 Index r,
1396 Index c);
1397 // ----|-|
1398 Tensor5View operator()(const Range& l,
1399 const Range& v,
1400 const Range& s,
1401 const Range& b,
1402 Index p,
1403 const Range& r,
1404 Index c);
1405 // ---|--|
1406 Tensor5View operator()(const Range& l,
1407 const Range& v,
1408 const Range& s,
1409 Index b,
1410 const Range& p,
1411 const Range& r,
1412 Index c);
1413 // --|---|
1414 Tensor5View operator()(const Range& l,
1415 const Range& v,
1416 Index s,
1417 const Range& b,
1418 const Range& p,
1419 const Range& r,
1420 Index c);
1421 // -|----|
1422 Tensor5View operator()(const Range& l,
1423 Index v,
1424 const Range& s,
1425 const Range& b,
1426 const Range& p,
1427 const Range& r,
1428 Index c);
1429 // |-----|
1431 const Range& v,
1432 const Range& s,
1433 const Range& b,
1434 const Range& p,
1435 const Range& r,
1436 Index c);
1437 // ----||-
1438 Tensor5View operator()(const Range& l,
1439 const Range& v,
1440 const Range& s,
1441 const Range& b,
1442 Index p,
1443 Index r,
1444 const Range& c);
1445 // ---|-|-
1446 Tensor5View operator()(const Range& l,
1447 const Range& v,
1448 const Range& s,
1449 Index b,
1450 const Range& p,
1451 Index r,
1452 const Range& c);
1453 // --|--|-
1454 Tensor5View operator()(const Range& l,
1455 const Range& v,
1456 Index s,
1457 const Range& b,
1458 const Range& p,
1459 Index r,
1460 const Range& c);
1461 // -|---|-
1462 Tensor5View operator()(const Range& l,
1463 Index v,
1464 const Range& s,
1465 const Range& b,
1466 const Range& p,
1467 Index r,
1468 const Range& c);
1469 // |----|-
1471 const Range& v,
1472 const Range& s,
1473 const Range& b,
1474 const Range& p,
1475 Index r,
1476 const Range& c);
1477 // ---||--
1478 Tensor5View operator()(const Range& l,
1479 const Range& v,
1480 const Range& s,
1481 Index b,
1482 Index p,
1483 const Range& r,
1484 const Range& c);
1485 // --|-|--
1486 Tensor5View operator()(const Range& l,
1487 const Range& v,
1488 Index s,
1489 const Range& b,
1490 Index p,
1491 const Range& r,
1492 const Range& c);
1493 // -|--|--
1494 Tensor5View operator()(const Range& l,
1495 Index v,
1496 const Range& s,
1497 const Range& b,
1498 Index p,
1499 const Range& r,
1500 const Range& c);
1501 // |---|--
1503 const Range& v,
1504 const Range& s,
1505 const Range& b,
1506 Index p,
1507 const Range& r,
1508 const Range& c);
1509 // --||---
1510 Tensor5View operator()(const Range& l,
1511 const Range& v,
1512 Index s,
1513 Index b,
1514 const Range& p,
1515 const Range& r,
1516 const Range& c);
1517 // -|-|---
1518 Tensor5View operator()(const Range& l,
1519 Index v,
1520 const Range& s,
1521 Index b,
1522 const Range& p,
1523 const Range& r,
1524 const Range& c);
1525 // |--|---
1527 const Range& v,
1528 const Range& s,
1529 Index b,
1530 const Range& p,
1531 const Range& r,
1532 const Range& c);
1533 // -||----
1534 Tensor5View operator()(const Range& l,
1535 Index v,
1536 Index s,
1537 const Range& b,
1538 const Range& p,
1539 const Range& r,
1540 const Range& c);
1541 // |-|----
1543 const Range& v,
1544 Index s,
1545 const Range& b,
1546 const Range& p,
1547 const Range& r,
1548 const Range& c);
1549 // ||-----
1551 Index v,
1552 const Range& s,
1553 const Range& b,
1554 const Range& p,
1555 const Range& r,
1556 const Range& c);
1557
1558 // Result 4D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1559 // ----|||
1560 Tensor4View operator()(const Range& l,
1561 const Range& v,
1562 const Range& s,
1563 const Range& b,
1564 Index p,
1565 Index r,
1566 Index c);
1567 // ---|-||
1568 Tensor4View operator()(const Range& l,
1569 const Range& v,
1570 const Range& s,
1571 Index b,
1572 const Range& p,
1573 Index r,
1574 Index c);
1575 // --|--||
1576 Tensor4View operator()(const Range& l,
1577 const Range& v,
1578 Index s,
1579 const Range& b,
1580 const Range& p,
1581 Index r,
1582 Index c);
1583 // -|---||
1584 Tensor4View operator()(const Range& l,
1585 Index v,
1586 const Range& s,
1587 const Range& b,
1588 const Range& p,
1589 Index r,
1590 Index c);
1591 // |----||
1593 const Range& v,
1594 const Range& s,
1595 const Range& b,
1596 const Range& p,
1597 Index r,
1598 Index c);
1599 // ---||-|
1600 Tensor4View operator()(const Range& l,
1601 const Range& v,
1602 const Range& s,
1603 Index b,
1604 Index p,
1605 const Range& r,
1606 Index c);
1607 // --|-|-|
1608 Tensor4View operator()(const Range& l,
1609 const Range& v,
1610 Index s,
1611 const Range& b,
1612 Index p,
1613 const Range& r,
1614 Index c);
1615 // -|--|-|
1616 Tensor4View operator()(const Range& l,
1617 Index v,
1618 const Range& s,
1619 const Range& b,
1620 Index p,
1621 const Range& r,
1622 Index c);
1623 // |---|-|
1625 const Range& v,
1626 const Range& s,
1627 const Range& b,
1628 Index p,
1629 const Range& r,
1630 Index c);
1631 // --||--|
1632 Tensor4View operator()(const Range& l,
1633 const Range& v,
1634 Index s,
1635 Index b,
1636 const Range& p,
1637 const Range& r,
1638 Index c);
1639 // -|-|--|
1640 Tensor4View operator()(const Range& l,
1641 Index v,
1642 const Range& s,
1643 Index b,
1644 const Range& p,
1645 const Range& r,
1646 Index c);
1647 // |--|--|
1649 const Range& v,
1650 const Range& s,
1651 Index b,
1652 const Range& p,
1653 const Range& r,
1654 Index c);
1655 // -||---|
1656 Tensor4View operator()(const Range& l,
1657 Index v,
1658 Index s,
1659 const Range& b,
1660 const Range& p,
1661 const Range& r,
1662 Index c);
1663 // |-|---|
1665 const Range& v,
1666 Index s,
1667 const Range& b,
1668 const Range& p,
1669 const Range& r,
1670 Index c);
1671 // ||----|
1673 Index v,
1674 const Range& s,
1675 const Range& b,
1676 const Range& p,
1677 const Range& r,
1678 Index c);
1679 // ---|||-
1680 Tensor4View operator()(const Range& l,
1681 const Range& v,
1682 const Range& s,
1683 Index b,
1684 Index p,
1685 Index r,
1686 const Range& c);
1687 // --|-||-
1688 Tensor4View operator()(const Range& l,
1689 const Range& v,
1690 Index s,
1691 const Range& b,
1692 Index p,
1693 Index r,
1694 const Range& c);
1695 // -|--||-
1696 Tensor4View operator()(const Range& l,
1697 Index v,
1698 const Range& s,
1699 const Range& b,
1700 Index p,
1701 Index r,
1702 const Range& c);
1703 // |---||-
1705 const Range& v,
1706 const Range& s,
1707 const Range& b,
1708 Index p,
1709 Index r,
1710 const Range& c);
1711 // --||-|-
1712 Tensor4View operator()(const Range& l,
1713 const Range& v,
1714 Index s,
1715 Index b,
1716 const Range& p,
1717 Index r,
1718 const Range& c);
1719 // -|-|-|-
1720 Tensor4View operator()(const Range& l,
1721 Index v,
1722 const Range& s,
1723 Index b,
1724 const Range& p,
1725 Index r,
1726 const Range& c);
1727 // |--|-|-
1729 const Range& v,
1730 const Range& s,
1731 Index b,
1732 const Range& p,
1733 Index r,
1734 const Range& c);
1735 // -||--|-
1736 Tensor4View operator()(const Range& l,
1737 Index v,
1738 Index s,
1739 const Range& b,
1740 const Range& p,
1741 Index r,
1742 const Range& c);
1743 // |-|--|-
1745 const Range& v,
1746 Index s,
1747 const Range& b,
1748 const Range& p,
1749 Index r,
1750 const Range& c);
1751 // ||---|-
1753 Index v,
1754 const Range& s,
1755 const Range& b,
1756 const Range& p,
1757 Index r,
1758 const Range& c);
1759 // --|||--
1760 Tensor4View operator()(const Range& l,
1761 const Range& v,
1762 Index s,
1763 Index b,
1764 Index p,
1765 const Range& r,
1766 const Range& c);
1767 // -|-||--
1768 Tensor4View operator()(const Range& l,
1769 Index v,
1770 const Range& s,
1771 Index b,
1772 Index p,
1773 const Range& r,
1774 const Range& c);
1775 // |--||--
1777 const Range& v,
1778 const Range& s,
1779 Index b,
1780 Index p,
1781 const Range& r,
1782 const Range& c);
1783 // -||-|--
1784 Tensor4View operator()(const Range& l,
1785 Index v,
1786 Index s,
1787 const Range& b,
1788 Index p,
1789 const Range& r,
1790 const Range& c);
1791 // |-|-|--
1793 const Range& v,
1794 Index s,
1795 const Range& b,
1796 Index p,
1797 const Range& r,
1798 const Range& c);
1799 // ||--|--
1801 Index v,
1802 const Range& s,
1803 const Range& b,
1804 Index p,
1805 const Range& r,
1806 const Range& c);
1807 // -|||---
1808 Tensor4View operator()(const Range& l,
1809 Index v,
1810 Index s,
1811 Index b,
1812 const Range& p,
1813 const Range& r,
1814 const Range& c);
1815 // |-||---
1817 const Range& v,
1818 Index s,
1819 Index b,
1820 const Range& p,
1821 const Range& r,
1822 const Range& c);
1823 // ||-|---
1825 Index v,
1826 const Range& s,
1827 Index b,
1828 const Range& p,
1829 const Range& r,
1830 const Range& c);
1831 // |||----
1833 Index v,
1834 Index s,
1835 const Range& b,
1836 const Range& p,
1837 const Range& r,
1838 const Range& c);
1839
1840 // Result 3D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1841 // ||||---
1843 Index v,
1844 Index s,
1845 Index b,
1846 const Range& p,
1847 const Range& r,
1848 const Range& c);
1849 // |||-|--
1851 Index v,
1852 Index s,
1853 const Range& b,
1854 Index p,
1855 const Range& r,
1856 const Range& c);
1857 // ||-||--
1859 Index v,
1860 const Range& s,
1861 Index b,
1862 Index p,
1863 const Range& r,
1864 const Range& c);
1865 // |-|||--
1867 const Range& v,
1868 Index s,
1869 Index b,
1870 Index p,
1871 const Range& r,
1872 const Range& c);
1873 // -||||--
1874 Tensor3View operator()(const Range& l,
1875 Index v,
1876 Index s,
1877 Index b,
1878 Index p,
1879 const Range& r,
1880 const Range& c);
1881 // |||--|-
1883 Index v,
1884 Index s,
1885 const Range& b,
1886 const Range& p,
1887 Index r,
1888 const Range& c);
1889 // ||-|-|-
1891 Index v,
1892 const Range& s,
1893 Index b,
1894 const Range& p,
1895 Index r,
1896 const Range& c);
1897 // |-||-|-
1899 const Range& v,
1900 Index s,
1901 Index b,
1902 const Range& p,
1903 Index r,
1904 const Range& c);
1905 // -|||-|-
1906 Tensor3View operator()(const Range& l,
1907 Index v,
1908 Index s,
1909 Index b,
1910 const Range& p,
1911 Index r,
1912 const Range& c);
1913 // ||--||-
1915 Index v,
1916 const Range& s,
1917 const Range& b,
1918 Index p,
1919 Index r,
1920 const Range& c);
1921 // |-|-||-
1923 const Range& v,
1924 Index s,
1925 const Range& b,
1926 Index p,
1927 Index r,
1928 const Range& c);
1929 // -||-||-
1930 Tensor3View operator()(const Range& l,
1931 Index v,
1932 Index s,
1933 const Range& b,
1934 Index p,
1935 Index r,
1936 const Range& c);
1937 // |--|||-
1939 const Range& v,
1940 const Range& s,
1941 Index b,
1942 Index p,
1943 Index r,
1944 const Range& c);
1945 // -|-|||-
1946 Tensor3View operator()(const Range& l,
1947 Index v,
1948 const Range& s,
1949 Index b,
1950 Index p,
1951 Index r,
1952 const Range& c);
1953 // --||||-
1954 Tensor3View operator()(const Range& l,
1955 const Range& v,
1956 Index s,
1957 Index b,
1958 Index p,
1959 Index r,
1960 const Range& c);
1961 // |||---|
1963 Index v,
1964 Index s,
1965 const Range& b,
1966 const Range& p,
1967 const Range& r,
1968 Index c);
1969 // ||-|--|
1971 Index v,
1972 const Range& s,
1973 Index b,
1974 const Range& p,
1975 const Range& r,
1976 Index c);
1977 // |-||--|
1979 const Range& v,
1980 Index s,
1981 Index b,
1982 const Range& p,
1983 const Range& r,
1984 Index c);
1985 // -|||--|
1986 Tensor3View operator()(const Range& l,
1987 Index v,
1988 Index s,
1989 Index b,
1990 const Range& p,
1991 const Range& r,
1992 Index c);
1993 // ||--|-|
1995 Index v,
1996 const Range& s,
1997 const Range& b,
1998 Index p,
1999 const Range& r,
2000 Index c);
2001 // |-|-|-|
2003 const Range& v,
2004 Index s,
2005 const Range& b,
2006 Index p,
2007 const Range& r,
2008 Index c);
2009 // -||-|-|
2010 Tensor3View operator()(const Range& l,
2011 Index v,
2012 Index s,
2013 const Range& b,
2014 Index p,
2015 const Range& r,
2016 Index c);
2017 // |--||-|
2019 const Range& v,
2020 const Range& s,
2021 Index b,
2022 Index p,
2023 const Range& r,
2024 Index c);
2025 // -|-||-|
2026 Tensor3View operator()(const Range& l,
2027 Index v,
2028 const Range& s,
2029 Index b,
2030 Index p,
2031 const Range& r,
2032 Index c);
2033 // --|||-|
2034 Tensor3View operator()(const Range& l,
2035 const Range& v,
2036 Index s,
2037 Index b,
2038 Index p,
2039 const Range& r,
2040 Index c);
2041 // ||---||
2043 Index v,
2044 const Range& s,
2045 const Range& b,
2046 const Range& p,
2047 Index r,
2048 Index c);
2049 // |-|--||
2051 const Range& v,
2052 Index s,
2053 const Range& b,
2054 const Range& p,
2055 Index r,
2056 Index c);
2057 // -||--||
2058 Tensor3View operator()(const Range& l,
2059 Index v,
2060 Index s,
2061 const Range& b,
2062 const Range& p,
2063 Index r,
2064 Index c);
2065 // |--|-||
2067 const Range& v,
2068 const Range& s,
2069 Index b,
2070 const Range& p,
2071 Index r,
2072 Index c);
2073 // -|-|-||
2074 Tensor3View operator()(const Range& l,
2075 Index v,
2076 const Range& s,
2077 Index b,
2078 const Range& p,
2079 Index r,
2080 Index c);
2081 // --||-||
2082 Tensor3View operator()(const Range& l,
2083 const Range& v,
2084 Index s,
2085 Index b,
2086 const Range& p,
2087 Index r,
2088 Index c);
2089 // |---|||
2091 const Range& v,
2092 const Range& s,
2093 const Range& b,
2094 Index p,
2095 Index r,
2096 Index c);
2097 // -|--|||
2098 Tensor3View operator()(const Range& l,
2099 Index v,
2100 const Range& s,
2101 const Range& b,
2102 Index p,
2103 Index r,
2104 Index c);
2105 // --|-|||
2106 Tensor3View operator()(const Range& l,
2107 const Range& v,
2108 Index s,
2109 const Range& b,
2110 Index p,
2111 Index r,
2112 Index c);
2113 // ---||||
2114 Tensor3View operator()(const Range& l,
2115 const Range& v,
2116 const Range& s,
2117 Index b,
2118 Index p,
2119 Index r,
2120 Index c);
2121
2122 // Result 2D (6+5+4+3+2+1 = 21 combinations)
2123 // |||||--
2125 Index v,
2126 Index s,
2127 Index b,
2128 Index p,
2129 const Range& r,
2130 const Range& c);
2131 // ||||-|-
2133 Index v,
2134 Index s,
2135 Index b,
2136 const Range& p,
2137 Index r,
2138 const Range& c);
2139 // |||-||-
2141 Index v,
2142 Index s,
2143 const Range& b,
2144 Index p,
2145 Index r,
2146 const Range& c);
2147 // ||-|||-
2149 Index v,
2150 const Range& s,
2151 Index b,
2152 Index p,
2153 Index r,
2154 const Range& c);
2155 // |-||||-
2157 const Range& v,
2158 Index s,
2159 Index b,
2160 Index p,
2161 Index r,
2162 const Range& c);
2163 // -|||||-
2164 MatrixView operator()(const Range& l,
2165 Index v,
2166 Index s,
2167 Index b,
2168 Index p,
2169 Index r,
2170 const Range& c);
2171 // ||||--|
2173 Index v,
2174 Index s,
2175 Index b,
2176 const Range& p,
2177 const Range& r,
2178 Index c);
2179 // |||-|-|
2181 Index v,
2182 Index s,
2183 const Range& b,
2184 Index p,
2185 const Range& r,
2186 Index c);
2187 // ||-||-|
2189 Index v,
2190 const Range& s,
2191 Index b,
2192 Index p,
2193 const Range& r,
2194 Index c);
2195 // |-|||-|
2197 const Range& v,
2198 Index s,
2199 Index b,
2200 Index p,
2201 const Range& r,
2202 Index c);
2203 // -||||-|
2204 MatrixView operator()(const Range& l,
2205 Index v,
2206 Index s,
2207 Index b,
2208 Index p,
2209 const Range& r,
2210 Index c);
2211 // |||--||
2213 Index v,
2214 Index s,
2215 const Range& b,
2216 const Range& p,
2217 Index r,
2218 Index c);
2219 // ||-|-||
2221 Index v,
2222 const Range& s,
2223 Index b,
2224 const Range& p,
2225 Index r,
2226 Index c);
2227 // |-||-||
2229 const Range& v,
2230 Index s,
2231 Index b,
2232 const Range& p,
2233 Index r,
2234 Index c);
2235 // -|||-||
2236 MatrixView operator()(const Range& l,
2237 Index v,
2238 Index s,
2239 Index b,
2240 const Range& p,
2241 Index r,
2242 Index c);
2243 // ||--|||
2245 Index v,
2246 const Range& s,
2247 const Range& b,
2248 Index p,
2249 Index r,
2250 Index c);
2251 // |-|-|||
2253 const Range& v,
2254 Index s,
2255 const Range& b,
2256 Index p,
2257 Index r,
2258 Index c);
2259 // -||-|||
2260 MatrixView operator()(const Range& l,
2261 Index v,
2262 Index s,
2263 const Range& b,
2264 Index p,
2265 Index r,
2266 Index c);
2267 // |--||||
2269 const Range& v,
2270 const Range& s,
2271 Index b,
2272 Index p,
2273 Index r,
2274 Index c);
2275 // -|-||||
2276 MatrixView operator()(const Range& l,
2277 Index v,
2278 const Range& s,
2279 Index b,
2280 Index p,
2281 Index r,
2282 Index c);
2283 // --|||||
2284 MatrixView operator()(const Range& l,
2285 const Range& v,
2286 Index s,
2287 Index b,
2288 Index p,
2289 Index r,
2290 Index c);
2291
2292 // Result 1D (7 combinations)
2293 // ||||||-
2295 Index l, Index v, Index s, Index b, Index p, Index r, const Range& c);
2296 // |||||-|
2298 Index l, Index v, Index s, Index b, Index p, const Range& r, Index c);
2299 // ||||-||
2301 Index l, Index v, Index s, Index b, const Range& p, Index r, Index c);
2302 // |||-|||
2304 Index l, Index v, Index s, const Range& b, Index p, Index r, Index c);
2305 // ||-||||
2307 Index l, Index v, const Range& s, Index b, Index p, Index r, Index c);
2308 // |-|||||
2310 Index l, const Range& v, Index s, Index b, Index p, Index r, Index c);
2311 // -||||||
2313 const Range& l, Index v, Index s, Index b, Index p, Index r, Index c);
2314
2315#define GETFUN(l, v, s, b, p, r, c) \
2316 *(mdata + OFFSET(l) + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + \
2317 OFFSET(r) + OFFSET(c))
2318 // Result scalar (1 combination)
2319 // |||||||
2321 Index l, Index v, Index s, Index b, Index p, Index r, Index c) {
2322 CHECK(l);
2323 CHECK(v);
2324 CHECK(s);
2325 CHECK(b);
2326 CHECK(p);
2327 CHECK(r);
2328 CHECK(c);
2329 return GETFUN(l, v, s, b, p, r, c);
2330 }
2331
2334 return GETFUN(l, v, s, b, p, r, c);
2335 }
2336#undef GETFUN
2337
2338 // Conversion to a plain C-array
2339 [[nodiscard]] const Numeric* get_c_array() const ARTS_NOEXCEPT;
2341
2342 // Functions returning iterators:
2343 Iterator7D begin();
2344 Iterator7D end();
2345
2346 // Assignment operators:
2347 Tensor7View& operator=(const ConstTensor7View& v);
2348 Tensor7View& operator=(const Tensor7View& v);
2349 Tensor7View& operator=(const Tensor7& v);
2350 Tensor7View& operator=(Numeric x);
2351
2352 // Other operators:
2353 Tensor7View& operator*=(Numeric x);
2354 Tensor7View& operator/=(Numeric x);
2355 Tensor7View& operator+=(Numeric x);
2356 Tensor7View& operator-=(Numeric x);
2357
2358 Tensor7View& operator*=(const ConstTensor7View& x);
2359 Tensor7View& operator/=(const ConstTensor7View& x);
2360 Tensor7View& operator+=(const ConstTensor7View& x);
2361 Tensor7View& operator-=(const ConstTensor7View& x);
2362
2364 ~Tensor7View() override = default;
2365
2366 // Friends:
2367
2368 // Special constructor to make a Tensor7 view of a Tensor6.
2369 Tensor7View(const Tensor6View& a);
2370
2371 protected:
2372 // Constructors:
2373 Tensor7View() = default;
2374 Tensor7View(Numeric* data,
2375 const Range& l,
2376 const Range& v,
2377 const Range& s,
2378 const Range& b,
2379 const Range& p,
2380 const Range& r,
2381 const Range& c);
2382 Tensor7View(Numeric* data,
2383 const Range& pl,
2384 const Range& pv,
2385 const Range& ps,
2386 const Range& pb,
2387 const Range& pp,
2388 const Range& pr,
2389 const Range& pc,
2390 const Range& nl,
2391 const Range& nv,
2392 const Range& ns,
2393 const Range& nb,
2394 const Range& np,
2395 const Range& nr,
2396 const Range& nc);
2397};
2398
2407class Tensor7 : public Tensor7View {
2408 public:
2409 // Constructors:
2410 Tensor7() = default;
2411 Tensor7(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2412 Tensor7(Index l,
2413 Index v,
2414 Index s,
2415 Index b,
2416 Index p,
2417 Index r,
2418 Index c,
2419 Numeric fill);
2420 Tensor7(const ConstTensor7View& v);
2421 Tensor7(const Tensor7& v);
2422 Tensor7(Tensor7&& v) noexcept : Tensor7View(std::forward<Tensor7View>(v)) {
2423 v.mdata = nullptr;
2424 }
2425
2428 : Tensor7(matpack::library_size(init), matpack::vitrine_size(init),
2429 matpack::shelf_size(init), matpack::book_size(init),
2430 matpack::page_size(init), matpack::row_size(init),
2431 matpack::column_size(init)) {
2432 *this = init;
2433 }
2434
2437 if (const auto s = matpack::shape<Index, 7>(init); shape().data not_eq s)
2438 resize(s[0], s[1], s[2], s[3], s[4], s[5], s[6]);
2439
2440 auto [I, J, K, L, M, N, O] = shape().data;
2441 for (Index i = 0; i < I; i++)
2442 for (Index j = 0; j < J; j++)
2443 for (Index k = 0; k < K; k++)
2444 for (Index x = 0; x < L; x++)
2445 for (Index m = 0; m < M; m++)
2446 for (Index n = 0; n < N; n++)
2447 for (Index o = 0; o < O; o++)
2448 operator()(i, j, k, x, m, n, o) = init(i, j, k, x, m, n, o);
2449
2450 return *this;
2451 }
2452
2453 // Assignment operators:
2454 Tensor7& operator=(const Tensor7& x);
2457
2458 // Resize function:
2459 void resize(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2460
2461 // Swap function:
2462 friend void swap(Tensor7& t1, Tensor7& t2) noexcept;
2463
2464 // Destructor:
2465 ~Tensor7() noexcept override;
2466
2468 template <std::size_t dim0>
2469 Vector reduce_rank() && ARTS_NOEXCEPT {
2470 static_assert(dim0 < 7, "Bad Dimension, Out-of-Bounds");
2471
2472 Range r0(0,
2473 dim0 == 0 ? nlibraries()
2474 : dim0 == 1 ? nvitrines()
2475 : dim0 == 2 ? nshelves()
2476 : dim0 == 3 ? nbooks()
2477 : dim0 == 4 ? npages()
2478 : dim0 == 5 ? nrows()
2479 : ncols());
2480
2481 Vector out(mdata, r0);
2482 ARTS_ASSERT(size() not_eq out.size(),
2483 "Can only reduce size on same size input");
2484 mdata = nullptr;
2485 return out;
2486 }
2487
2489 template <std::size_t dim0, std::size_t dim1>
2491 static_assert(dim1 < 7, "Bad Dimension, Out-of-Bounds");
2492 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2493
2494 const Range r1(0,
2495 dim1 == 1 ? nvitrines()
2496 : dim1 == 2 ? nshelves()
2497 : dim1 == 3 ? nbooks()
2498 : dim1 == 4 ? npages()
2499 : dim1 == 5 ? nrows()
2500 : ncols());
2501 const Range r0(0,
2502 dim0 == 0 ? nlibraries()
2503 : dim0 == 1 ? nvitrines()
2504 : dim0 == 2 ? nshelves()
2505 : dim0 == 3 ? nbooks()
2506 : dim0 == 4 ? npages()
2507 : nrows(),
2508 r1.get_extent());
2509
2510 Matrix out(mdata, r0, r1);
2511 ARTS_ASSERT(size() not_eq out.size(),
2512 "Can only reduce size on same size input");
2513 mdata = nullptr;
2514 return out;
2515 }
2516
2518 template <std::size_t dim0, std::size_t dim1, std::size_t dim2>
2520 static_assert(dim2 < 7, "Bad Dimension, Out-of-Bounds");
2521 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2522 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2523
2524 const Range r2(0,
2525 dim2 == 2 ? nshelves()
2526 : dim2 == 3 ? nbooks()
2527 : dim2 == 4 ? npages()
2528 : dim2 == 5 ? nrows()
2529 : ncols());
2530 const Range r1(0,
2531 dim1 == 1 ? nvitrines()
2532 : dim1 == 2 ? nshelves()
2533 : dim1 == 3 ? nbooks()
2534 : dim1 == 4 ? npages()
2535 : nrows(),
2536 r2.get_extent());
2537 const Range r0(0,
2538 dim0 == 0 ? nlibraries()
2539 : dim0 == 1 ? nvitrines()
2540 : dim0 == 2 ? nshelves()
2541 : dim0 == 3 ? nbooks()
2542 : npages(),
2543 r1.get_extent() * r2.get_extent());
2544
2545 Tensor3 out(mdata, r0, r1, r2);
2546 ARTS_ASSERT(size() not_eq out.size(),
2547 "Can only reduce size on same size input");
2548 mdata = nullptr;
2549 return out;
2550 }
2551
2553 template <std::size_t dim0,
2554 std::size_t dim1,
2555 std::size_t dim2,
2556 std::size_t dim3>
2558 static_assert(dim3 < 7, "Bad Dimension, Out-of-Bounds");
2559 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2560 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2561 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2562
2563 const Range r3(0,
2564 dim3 == 3 ? nbooks()
2565 : dim3 == 4 ? npages()
2566 : dim3 == 5 ? nrows()
2567 : ncols());
2568 const Range r2(0,
2569 dim2 == 2 ? nshelves()
2570 : dim2 == 3 ? nbooks()
2571 : dim2 == 4 ? npages()
2572 : nrows(),
2573 r3.get_extent());
2574 const Range r1(0,
2575 dim1 == 1 ? nvitrines()
2576 : dim1 == 2 ? nshelves()
2577 : dim1 == 3 ? nbooks()
2578 : npages(),
2579 r2.get_extent() * r3.get_extent());
2580 const Range r0(0,
2581 dim0 == 0 ? nlibraries()
2582 : dim0 == 1 ? nvitrines()
2583 : dim0 == 2 ? nshelves()
2584 : nbooks(),
2585 r1.get_extent() * r2.get_extent() * r3.get_extent());
2586
2587 Tensor4 out(mdata, r0, r1, r2, r3);
2588 ARTS_ASSERT(size() not_eq out.size(),
2589 "Can only reduce size on same size input");
2590 mdata = nullptr;
2591 return out;
2592 }
2593
2595 template <std::size_t dim0,
2596 std::size_t dim1,
2597 std::size_t dim2,
2598 std::size_t dim3,
2599 std::size_t dim4>
2601 static_assert(dim4 < 7, "Bad Dimension, Out-of-Bounds");
2602 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2603 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2604 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2605 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2606
2607 const Range r4(0, dim4 == 4 ? npages() : dim4 == 5 ? nrows() : ncols());
2608 const Range r3(0,
2609 dim3 == 3 ? nbooks()
2610 : dim3 == 4 ? npages()
2611 : nrows(),
2612 r4.get_extent());
2613 const Range r2(0,
2614 dim2 == 2 ? nshelves()
2615 : dim2 == 3 ? nbooks()
2616 : npages(),
2617 r3.get_extent() * r4.get_extent());
2618 const Range r1(0,
2619 dim1 == 1 ? nvitrines()
2620 : dim1 == 2 ? nshelves()
2621 : nbooks(),
2622 r2.get_extent() * r3.get_extent() * r4.get_extent());
2623 const Range r0(
2624 0,
2625 dim0 == 0 ? nlibraries()
2626 : dim0 == 1 ? nvitrines()
2627 : nshelves(),
2628 r1.get_extent() * r2.get_extent() * r3.get_extent() * r4.get_extent());
2629
2630 Tensor5 out(mdata, r0, r1, r2, r3, r4);
2631 ARTS_ASSERT(size() not_eq out.size(),
2632 "Can only reduce size on same size input");
2633 mdata = nullptr;
2634 return out;
2635 }
2636
2638 template <std::size_t dim0,
2639 std::size_t dim1,
2640 std::size_t dim2,
2641 std::size_t dim3,
2642 std::size_t dim4,
2643 std::size_t dim5>
2645 static_assert(dim5 < 7, "Bad Dimension, Out-of-Bounds");
2646 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2647 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2648 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2649 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2650 static_assert(dim4 < dim5, "Bad Dimensions, dim5 must be larger than dim4");
2651
2652 const Range r5(0, dim5 == 5 ? nrows() : ncols());
2653 const Range r4(0, dim4 == 4 ? npages() : nrows(), r5.get_extent());
2654 const Range r3(
2655 0, dim3 == 3 ? nbooks() : npages(), r4.get_extent() * r5.get_extent());
2656 const Range r2(0,
2657 dim2 == 2 ? nshelves() : nbooks(),
2658 r3.get_extent() * r4.get_extent() * r5.get_extent());
2659 const Range r1(
2660 0,
2661 dim1 == 1 ? nvitrines() : nshelves(),
2662 r2.get_extent() * r3.get_extent() * r4.get_extent() * r5.get_extent());
2663 const Range r0(0,
2664 dim0 == 0 ? nlibraries() : nvitrines(),
2665 r1.get_extent() * r2.get_extent() * r3.get_extent() *
2666 r4.get_extent() * r5.get_extent());
2667
2668 Tensor6 out(mdata, r0, r1, r2, r3, r4, r5);
2669 ARTS_ASSERT(size() not_eq out.size(),
2670 "Can only reduce size on same size input");
2671 mdata = nullptr;
2672 return out;
2673 }
2674
2675 template <class F>
2676 void transform_elementwise(F&& func) {
2677 std::transform(mdata, mdata + size(), mdata, func);
2678 }
2679};
2680
2681// Function declarations:
2682// ----------------------
2683
2684void copy(ConstIterator7D origin,
2685 const ConstIterator7D& end,
2686 Iterator7D target);
2687
2688void copy(Numeric x, Iterator7D target, const Iterator7D& end);
2689
2690void transform(Tensor7View y, double (&my_func)(double), ConstTensor7View x);
2691
2692Numeric max(const ConstTensor7View& x);
2693
2694Numeric min(const ConstTensor7View& x);
2695
2697// Helper function for debugging
2698#ifndef NDEBUG
2699
2701 Index l,
2702 Index v,
2703 Index s,
2704 Index b,
2705 Index p,
2706 Index r,
2707 Index c);
2708
2709#endif
2711
2714
2716
2717#endif // matpackVII_h
base max(const Array< base > &x)
Max function.
Definition: array.h:145
base min(const Array< base > &x)
Min function.
Definition: array.h:161
This can be used to make arrays out of anything.
Definition: array.h:48
Const version of Iterator7D.
Definition: matpackVII.h:86
ConstIterator7D(ConstTensor6View x, Index stride)
Explicit constructor.
Definition: matpackVII.h:93
const ConstTensor6View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVII.h:120
ConstTensor6View msv
Current position.
Definition: matpackVII.h:127
ConstIterator7D & operator++()
Prefix increment operator.
Definition: matpackVII.h:99
ConstIterator7D()=default
Default constructor.
const ConstTensor6View & operator*() const
Dereferencing.
Definition: matpackVII.h:123
Index mstride
Stride.
Definition: matpackVII.h:129
bool operator!=(const ConstIterator7D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackVII.h:108
A constant view of a Matrix.
Definition: matpackI.h:1065
Index size() const noexcept
Definition: matpackI.h:1085
A constant view of a Tensor3.
Definition: matpackIII.h:133
Index size() const noexcept
Definition: matpackIII.h:154
A constant view of a Tensor4.
Definition: matpackIV.h:133
Index size() const noexcept
Definition: matpackIV.h:149
A constant view of a Tensor5.
Definition: matpackV.h:144
Index size() const noexcept
Definition: matpackV.h:161
A constant view of a Tensor6.
Definition: matpackVI.h:150
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVI.h:611
Range mcr
The column range of mdata that is actually used.
Definition: matpackVI.h:621
Range mbr
The book range of mdata that is actually used.
Definition: matpackVI.h:615
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVI.h:623
Range mrr
The row range of mdata that is actually used.
Definition: matpackVI.h:619
Index size() const noexcept
Definition: matpackVI.h:166
Range mpr
The page range of mdata that is actually used.
Definition: matpackVI.h:617
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVI.h:613
A constant view of a Tensor7.
Definition: matpackVII.h:148
Shape< 7 > shape() const
Definition: matpackVII.h:174
Index ncols() const noexcept
Definition: matpackVII.h:164
Range mrr
The row range of mdata that is actually used.
Definition: matpackVII.h:1292
Range mcr
The column range of mdata that is actually used.
Definition: matpackVII.h:1294
Index npages() const noexcept
Definition: matpackVII.h:162
ConstTensor7View & operator=(const ConstTensor7View &)=default
ConstIterator7D end() const
Return const iterator behind last sub-tensor.
Definition: matpackVII.cc:2462
Numeric operator()(Index l, Index v, Index s, Index b, Index p, Index r, Index c) const
Definition: matpackVII.h:1218
Range mbr
The book range of mdata that is actually used.
Definition: matpackVII.h:1288
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVII.h:1284
Index nrows() const noexcept
Definition: matpackVII.h:163
ConstIterator7D begin() const
Return const iterator to first sub-tensor.
Definition: matpackVII.cc:2455
Range mpr
The page range of mdata that is actually used.
Definition: matpackVII.h:1290
Index nlibraries() const noexcept
Definition: matpackVII.h:158
ConstTensor7View()=default
Index nvitrines() const noexcept
Definition: matpackVII.h:159
Range mlr
The library range of mdata that is actually used.
Definition: matpackVII.h:1282
constexpr ConstTensor7View(ConstTensor7View &&)=default
constexpr ConstTensor7View(const ConstTensor7View &)=default
Index nshelves() const noexcept
Definition: matpackVII.h:160
Index size() const noexcept
Definition: matpackVII.h:167
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVII.h:1296
ConstTensor7View & operator=(ConstTensor7View &&)=default
friend std::ostream & operator<<(std::ostream &os, const ConstTensor7View &v)
Output operator.
Definition: matpackVII.cc:2542
bool empty() const noexcept
Definition: matpackVII.h:171
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:35
virtual ~ConstTensor7View()=default
Destructor.
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVII.h:1286
Index nbooks() const noexcept
Definition: matpackVII.h:161
static constexpr bool matpack_type
Definition: matpackVII.h:150
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:1231
A constant view of a Vector.
Definition: matpackI.h:521
Index size() const noexcept
Definition: matpackI.h:550
Implementation of Tensors of Rank 7.
Definition: matpackVII.h:39
Iterator7D()=default
Default constructor.
Tensor6View & operator*()
Dereferencing.
Definition: matpackVII.h:76
Iterator7D & operator++()
Prefix increment operator.
Definition: matpackVII.h:52
bool operator!=(const Iterator7D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackVII.h:61
Tensor6View msv
Current position.
Definition: matpackVII.h:80
Index mstride
Stride.
Definition: matpackVII.h:82
Tensor6View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVII.h:73
Iterator7D(const Tensor6View &x, Index stride)
Explicit constructor.
Definition: matpackVII.h:46
The MatrixView class.
Definition: matpackI.h:1188
The Matrix class.
Definition: matpackI.h:1285
The range class.
Definition: matpackI.h:160
Index mstart
The start index.
Definition: matpackI.h:377
constexpr Index get_extent() const noexcept
Returns the extent of the range.
Definition: matpackI.h:343
Index mextent
The number of elements.
Definition: matpackI.h:380
The Tensor3View class.
Definition: matpackIII.h:251
The Tensor3 class.
Definition: matpackIII.h:352
The Tensor4View class.
Definition: matpackIV.h:296
The Tensor4 class.
Definition: matpackIV.h:435
The Tensor5View class.
Definition: matpackV.h:348
The Tensor5 class.
Definition: matpackV.h:524
The Tensor6View class.
Definition: matpackVI.h:635
The Tensor6 class.
Definition: matpackVI.h:1105
The Tensor7View class.
Definition: matpackVII.h:1308
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackVII.cc:4999
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:2566
Iterator7D end()
Return iterator behind last sub-tensor.
Definition: matpackVII.cc:5044
Numeric & get(Index l, Index v, Index s, Index b, Index p, Index r, Index c)
Get element implementation without assertions.
Definition: matpackVII.h:2333
Tensor7View()=default
Tensor7View & operator=(const ConstTensor7View &v)
Assignment operator.
Definition: matpackVII.cc:5060
Numeric & operator()(Index l, Index v, Index s, Index b, Index p, Index r, Index c)
Definition: matpackVII.h:2320
Iterator7D begin()
Return iterator to first sub-tensor.
Definition: matpackVII.cc:5037
constexpr Tensor7View(const Tensor7View &)=default
The Tensor7 class.
Definition: matpackVII.h:2407
Tensor3 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2519
Tensor4 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2557
Matrix reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2490
Tensor7()=default
Tensor6 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2644
Tensor7 & operator=(const matpack::tensor7_like_not_tensor7 auto &init)
Set from a tensor type.
Definition: matpackVII.h:2436
void transform_elementwise(F &&func)
Definition: matpackVII.h:2676
Tensor7(Tensor7 &&v) noexcept
Definition: matpackVII.h:2422
Tensor7(const matpack::tensor7_like_not_tensor7 auto &init)
Initialization from a tensor type.
Definition: matpackVII.h:2427
Tensor5 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2600
The VectorView class.
Definition: matpackI.h:674
The Vector class.
Definition: matpackI.h:910
A concept precluding Arts types but allowing the tensor-like object.
#define ARTS_NOEXCEPT
Definition: debug.h:99
#define ARTS_ASSERT(condition,...)
Definition: debug.h:102
void copy(ConstIterator7D origin, const ConstIterator7D &end, Iterator7D target)
Copy data between begin and end to target.
Definition: matpackVII.cc:5306
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:5650
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:5570
#define GETFUN(l, v, s, b, p, r, c)
Definition: matpackVII.h:2315
#define CHECK(x)
Implementation of Tensors of Rank 6.
Definition: matpackVI.h:36
#define OFFSET(x)
Definition: matpackVI.h:39
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
void swap(ComplexVector &v1, ComplexVector &v2) noexcept
Swaps two objects.
#define N
Definition: rng.cc:164
#define M
Definition: rng.cc:165
Helper shape class.
Definition: matpackI.h:387
#define v
#define a
#define c
#define b