ARTS 2.5.4 (git: 31ce4f0e)
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 return false;
66 }
67
70 Tensor6View* operator->() { return &msv; }
71
73 Tensor6View& operator*() { return msv; }
74
75 private:
80};
81
84 public:
85 // Constructors:
87 ConstIterator7D() = default;
88
91 : msv(x), mstride(stride) { /* Nothing to do here. */
92 }
93
94 // Operators:
97 msv.mdata += mstride;
98 return *this;
99 }
100
105 bool operator!=(const ConstIterator7D& other) const {
108 other.msv.mdata + other.msv.mvr.mstart + other.msv.msr.mstart +
109 other.msv.mbr.mstart + other.msv.mpr.mstart + other.msv.mrr.mstart +
110 other.msv.mcr.mstart)
111 return true;
112 return false;
113 }
114
117 const ConstTensor6View* operator->() const { return &msv; }
118
120 const ConstTensor6View& operator*() const { return msv; }
121
122 private:
127};
128
129// Declare class Tensor7:
130class Tensor7;
131
146 public:
147 constexpr ConstTensor7View(const ConstTensor7View&) = default;
148 constexpr ConstTensor7View(ConstTensor7View&&) = default;
151
152 // Member functions:
153 [[nodiscard]] Index nlibraries() const noexcept { return mlr.mextent; }
154 [[nodiscard]] Index nvitrines() const noexcept { return mvr.mextent; }
155 [[nodiscard]] Index nshelves() const noexcept { return msr.mextent; }
156 [[nodiscard]] Index nbooks() const noexcept { return mbr.mextent; }
157 [[nodiscard]] Index npages() const noexcept { return mpr.mextent; }
158 [[nodiscard]] Index nrows() const noexcept { return mrr.mextent; }
159 [[nodiscard]] Index ncols() const noexcept { return mcr.mextent; }
160
161 // Total size
162 [[nodiscard]] Index size() const noexcept {
163 return nlibraries() * nvitrines() * nshelves() * nbooks() * npages() *
164 nrows() * ncols();
165 }
166 [[nodiscard]] bool empty() const noexcept { return size() == 0; }
167
169 [[nodiscard]] Shape<7> shape() const {
170 return {nlibraries(),
171 nvitrines(),
172 nshelves(),
173 nbooks(),
174 npages(),
175 nrows(),
176 ncols()};
177 }
178
179 // Const index operators:
180
181 // Result 7D (1 combination)
182 // -------
184 const Range& v,
185 const Range& s,
186 const Range& b,
187 const Range& p,
188 const Range& r,
189 const Range& c) const;
190
191 // Result 6D (7 combinations)
192 // ------|
194 const Range& v,
195 const Range& s,
196 const Range& b,
197 const Range& p,
198 const Range& r,
199 Index c) const;
200 // -----|-
202 const Range& v,
203 const Range& s,
204 const Range& b,
205 const Range& p,
206 Index r,
207 const Range& c) const;
208 // ----|--
210 const Range& v,
211 const Range& s,
212 const Range& b,
213 Index p,
214 const Range& r,
215 const Range& c) const;
216 // ---|---
218 const Range& v,
219 const Range& s,
220 Index b,
221 const Range& p,
222 const Range& r,
223 const Range& c) const;
224 // --|----
226 const Range& v,
227 Index s,
228 const Range& b,
229 const Range& p,
230 const Range& r,
231 const Range& c) const;
232 // -|-----
234 Index v,
235 const Range& s,
236 const Range& b,
237 const Range& p,
238 const Range& r,
239 const Range& c) const;
240 // |------
242 const Range& v,
243 const Range& s,
244 const Range& b,
245 const Range& p,
246 const Range& r,
247 const Range& c) const;
248
249 // Result 5D (6+5+4+3+2+1 = 21 combinations)
250 // -----||
252 const Range& v,
253 const Range& s,
254 const Range& b,
255 const Range& p,
256 Index r,
257 Index c) const;
258 // ----|-|
260 const Range& v,
261 const Range& s,
262 const Range& b,
263 Index p,
264 const Range& r,
265 Index c) const;
266 // ---|--|
268 const Range& v,
269 const Range& s,
270 Index b,
271 const Range& p,
272 const Range& r,
273 Index c) const;
274 // --|---|
276 const Range& v,
277 Index s,
278 const Range& b,
279 const Range& p,
280 const Range& r,
281 Index c) const;
282 // -|----|
284 Index v,
285 const Range& s,
286 const Range& b,
287 const Range& p,
288 const Range& r,
289 Index c) const;
290 // |-----|
292 const Range& v,
293 const Range& s,
294 const Range& b,
295 const Range& p,
296 const Range& r,
297 Index c) const;
298 // ----||-
300 const Range& v,
301 const Range& s,
302 const Range& b,
303 Index p,
304 Index r,
305 const Range& c) const;
306 // ---|-|-
308 const Range& v,
309 const Range& s,
310 Index b,
311 const Range& p,
312 Index r,
313 const Range& c) const;
314 // --|--|-
316 const Range& v,
317 Index s,
318 const Range& b,
319 const Range& p,
320 Index r,
321 const Range& c) const;
322 // -|---|-
324 Index v,
325 const Range& s,
326 const Range& b,
327 const Range& p,
328 Index r,
329 const Range& c) const;
330 // |----|-
332 const Range& v,
333 const Range& s,
334 const Range& b,
335 const Range& p,
336 Index r,
337 const Range& c) const;
338 // ---||--
340 const Range& v,
341 const Range& s,
342 Index b,
343 Index p,
344 const Range& r,
345 const Range& c) const;
346 // --|-|--
348 const Range& v,
349 Index s,
350 const Range& b,
351 Index p,
352 const Range& r,
353 const Range& c) const;
354 // -|--|--
356 Index v,
357 const Range& s,
358 const Range& b,
359 Index p,
360 const Range& r,
361 const Range& c) const;
362 // |---|--
364 const Range& v,
365 const Range& s,
366 const Range& b,
367 Index p,
368 const Range& r,
369 const Range& c) const;
370 // --||---
372 const Range& v,
373 Index s,
374 Index b,
375 const Range& p,
376 const Range& r,
377 const Range& c) const;
378 // -|-|---
380 Index v,
381 const Range& s,
382 Index b,
383 const Range& p,
384 const Range& r,
385 const Range& c) const;
386 // |--|---
388 const Range& v,
389 const Range& s,
390 Index b,
391 const Range& p,
392 const Range& r,
393 const Range& c) const;
394 // -||----
396 Index v,
397 Index s,
398 const Range& b,
399 const Range& p,
400 const Range& r,
401 const Range& c) const;
402 // |-|----
404 const Range& v,
405 Index s,
406 const Range& b,
407 const Range& p,
408 const Range& r,
409 const Range& c) const;
410 // ||-----
412 Index v,
413 const Range& s,
414 const Range& b,
415 const Range& p,
416 const Range& r,
417 const Range& c) const;
418
419 // Result 4D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
420 // ----|||
422 const Range& v,
423 const Range& s,
424 const Range& b,
425 Index p,
426 Index r,
427 Index c) const;
428 // ---|-||
430 const Range& v,
431 const Range& s,
432 Index b,
433 const Range& p,
434 Index r,
435 Index c) const;
436 // --|--||
438 const Range& v,
439 Index s,
440 const Range& b,
441 const Range& p,
442 Index r,
443 Index c) const;
444 // -|---||
446 Index v,
447 const Range& s,
448 const Range& b,
449 const Range& p,
450 Index r,
451 Index c) const;
452 // |----||
454 const Range& v,
455 const Range& s,
456 const Range& b,
457 const Range& p,
458 Index r,
459 Index c) const;
460 // ---||-|
462 const Range& v,
463 const Range& s,
464 Index b,
465 Index p,
466 const Range& r,
467 Index c) const;
468 // --|-|-|
470 const Range& v,
471 Index s,
472 const Range& b,
473 Index p,
474 const Range& r,
475 Index c) const;
476 // -|--|-|
478 Index v,
479 const Range& s,
480 const Range& b,
481 Index p,
482 const Range& r,
483 Index c) const;
484 // |---|-|
486 const Range& v,
487 const Range& s,
488 const Range& b,
489 Index p,
490 const Range& r,
491 Index c) const;
492 // --||--|
494 const Range& v,
495 Index s,
496 Index b,
497 const Range& p,
498 const Range& r,
499 Index c) const;
500 // -|-|--|
502 Index v,
503 const Range& s,
504 Index b,
505 const Range& p,
506 const Range& r,
507 Index c) const;
508 // |--|--|
510 const Range& v,
511 const Range& s,
512 Index b,
513 const Range& p,
514 const Range& r,
515 Index c) const;
516 // -||---|
518 Index v,
519 Index s,
520 const Range& b,
521 const Range& p,
522 const Range& r,
523 Index c) const;
524 // |-|---|
526 const Range& v,
527 Index s,
528 const Range& b,
529 const Range& p,
530 const Range& r,
531 Index c) const;
532 // ||----|
534 Index v,
535 const Range& s,
536 const Range& b,
537 const Range& p,
538 const Range& r,
539 Index c) const;
540 // ---|||-
542 const Range& v,
543 const Range& s,
544 Index b,
545 Index p,
546 Index r,
547 const Range& c) const;
548 // --|-||-
550 const Range& v,
551 Index s,
552 const Range& b,
553 Index p,
554 Index r,
555 const Range& c) const;
556 // -|--||-
558 Index v,
559 const Range& s,
560 const Range& b,
561 Index p,
562 Index r,
563 const Range& c) const;
564 // |---||-
566 const Range& v,
567 const Range& s,
568 const Range& b,
569 Index p,
570 Index r,
571 const Range& c) const;
572 // --||-|-
574 const Range& v,
575 Index s,
576 Index b,
577 const Range& p,
578 Index r,
579 const Range& c) const;
580 // -|-|-|-
582 Index v,
583 const Range& s,
584 Index b,
585 const Range& p,
586 Index r,
587 const Range& c) const;
588 // |--|-|-
590 const Range& v,
591 const Range& s,
592 Index b,
593 const Range& p,
594 Index r,
595 const Range& c) const;
596 // -||--|-
598 Index v,
599 Index s,
600 const Range& b,
601 const Range& p,
602 Index r,
603 const Range& c) const;
604 // |-|--|-
606 const Range& v,
607 Index s,
608 const Range& b,
609 const Range& p,
610 Index r,
611 const Range& c) const;
612 // ||---|-
614 Index v,
615 const Range& s,
616 const Range& b,
617 const Range& p,
618 Index r,
619 const Range& c) const;
620 // --|||--
622 const Range& v,
623 Index s,
624 Index b,
625 Index p,
626 const Range& r,
627 const Range& c) const;
628 // -|-||--
630 Index v,
631 const Range& s,
632 Index b,
633 Index p,
634 const Range& r,
635 const Range& c) const;
636 // |--||--
638 const Range& v,
639 const Range& s,
640 Index b,
641 Index p,
642 const Range& r,
643 const Range& c) const;
644 // -||-|--
646 Index v,
647 Index s,
648 const Range& b,
649 Index p,
650 const Range& r,
651 const Range& c) const;
652 // |-|-|--
654 const Range& v,
655 Index s,
656 const Range& b,
657 Index p,
658 const Range& r,
659 const Range& c) const;
660 // ||--|--
662 Index v,
663 const Range& s,
664 const Range& b,
665 Index p,
666 const Range& r,
667 const Range& c) const;
668 // -|||---
670 Index v,
671 Index s,
672 Index b,
673 const Range& p,
674 const Range& r,
675 const Range& c) const;
676 // |-||---
678 const Range& v,
679 Index s,
680 Index b,
681 const Range& p,
682 const Range& r,
683 const Range& c) const;
684 // ||-|---
686 Index v,
687 const Range& s,
688 Index b,
689 const Range& p,
690 const Range& r,
691 const Range& c) const;
692 // |||----
694 Index v,
695 Index s,
696 const Range& b,
697 const Range& p,
698 const Range& r,
699 const Range& c) const;
700
701 // Result 3D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
702 // ||||---
704 Index v,
705 Index s,
706 Index b,
707 const Range& p,
708 const Range& r,
709 const Range& c) const;
710 // |||-|--
712 Index v,
713 Index s,
714 const Range& b,
715 Index p,
716 const Range& r,
717 const Range& c) const;
718 // ||-||--
720 Index v,
721 const Range& s,
722 Index b,
723 Index p,
724 const Range& r,
725 const Range& c) const;
726 // |-|||--
728 const Range& v,
729 Index s,
730 Index b,
731 Index p,
732 const Range& r,
733 const Range& c) const;
734 // -||||--
736 Index v,
737 Index s,
738 Index b,
739 Index p,
740 const Range& r,
741 const Range& c) const;
742 // |||--|-
744 Index v,
745 Index s,
746 const Range& b,
747 const Range& p,
748 Index r,
749 const Range& c) const;
750 // ||-|-|-
752 Index v,
753 const Range& s,
754 Index b,
755 const Range& p,
756 Index r,
757 const Range& c) const;
758 // |-||-|-
760 const Range& v,
761 Index s,
762 Index b,
763 const Range& p,
764 Index r,
765 const Range& c) const;
766 // -|||-|-
768 Index v,
769 Index s,
770 Index b,
771 const Range& p,
772 Index r,
773 const Range& c) const;
774 // ||--||-
776 Index v,
777 const Range& s,
778 const Range& b,
779 Index p,
780 Index r,
781 const Range& c) const;
782 // |-|-||-
784 const Range& v,
785 Index s,
786 const Range& b,
787 Index p,
788 Index r,
789 const Range& c) const;
790 // -||-||-
792 Index v,
793 Index s,
794 const Range& b,
795 Index p,
796 Index r,
797 const Range& c) const;
798 // |--|||-
800 const Range& v,
801 const Range& s,
802 Index b,
803 Index p,
804 Index r,
805 const Range& c) const;
806 // -|-|||-
808 Index v,
809 const Range& s,
810 Index b,
811 Index p,
812 Index r,
813 const Range& c) const;
814 // --||||-
816 const Range& v,
817 Index s,
818 Index b,
819 Index p,
820 Index r,
821 const Range& c) const;
822 // |||---|
824 Index v,
825 Index s,
826 const Range& b,
827 const Range& p,
828 const Range& r,
829 Index c) const;
830 // ||-|--|
832 Index v,
833 const Range& s,
834 Index b,
835 const Range& p,
836 const Range& r,
837 Index c) const;
838 // |-||--|
840 const Range& v,
841 Index s,
842 Index b,
843 const Range& p,
844 const Range& r,
845 Index c) const;
846 // -|||--|
848 Index v,
849 Index s,
850 Index b,
851 const Range& p,
852 const Range& r,
853 Index c) const;
854 // ||--|-|
856 Index v,
857 const Range& s,
858 const Range& b,
859 Index p,
860 const Range& r,
861 Index c) const;
862 // |-|-|-|
864 const Range& v,
865 Index s,
866 const Range& b,
867 Index p,
868 const Range& r,
869 Index c) const;
870 // -||-|-|
872 Index v,
873 Index s,
874 const Range& b,
875 Index p,
876 const Range& r,
877 Index c) const;
878 // |--||-|
880 const Range& v,
881 const Range& s,
882 Index b,
883 Index p,
884 const Range& r,
885 Index c) const;
886 // -|-||-|
888 Index v,
889 const Range& s,
890 Index b,
891 Index p,
892 const Range& r,
893 Index c) const;
894 // --|||-|
896 const Range& v,
897 Index s,
898 Index b,
899 Index p,
900 const Range& r,
901 Index c) const;
902 // ||---||
904 Index v,
905 const Range& s,
906 const Range& b,
907 const Range& p,
908 Index r,
909 Index c) const;
910 // |-|--||
912 const Range& v,
913 Index s,
914 const Range& b,
915 const Range& p,
916 Index r,
917 Index c) const;
918 // -||--||
920 Index v,
921 Index s,
922 const Range& b,
923 const Range& p,
924 Index r,
925 Index c) const;
926 // |--|-||
928 const Range& v,
929 const Range& s,
930 Index b,
931 const Range& p,
932 Index r,
933 Index c) const;
934 // -|-|-||
936 Index v,
937 const Range& s,
938 Index b,
939 const Range& p,
940 Index r,
941 Index c) const;
942 // --||-||
944 const Range& v,
945 Index s,
946 Index b,
947 const Range& p,
948 Index r,
949 Index c) const;
950 // |---|||
952 const Range& v,
953 const Range& s,
954 const Range& b,
955 Index p,
956 Index r,
957 Index c) const;
958 // -|--|||
960 Index v,
961 const Range& s,
962 const Range& b,
963 Index p,
964 Index r,
965 Index c) const;
966 // --|-|||
968 const Range& v,
969 Index s,
970 const Range& b,
971 Index p,
972 Index r,
973 Index c) const;
974 // ---||||
976 const Range& v,
977 const Range& s,
978 Index b,
979 Index p,
980 Index r,
981 Index c) const;
982
983 // Result 2D (6+5+4+3+2+1 = 21 combinations)
984 // |||||--
986 Index v,
987 Index s,
988 Index b,
989 Index p,
990 const Range& r,
991 const Range& c) const;
992 // ||||-|-
994 Index v,
995 Index s,
996 Index b,
997 const Range& p,
998 Index r,
999 const Range& c) const;
1000 // |||-||-
1002 Index v,
1003 Index s,
1004 const Range& b,
1005 Index p,
1006 Index r,
1007 const Range& c) const;
1008 // ||-|||-
1010 Index v,
1011 const Range& s,
1012 Index b,
1013 Index p,
1014 Index r,
1015 const Range& c) const;
1016 // |-||||-
1018 const Range& v,
1019 Index s,
1020 Index b,
1021 Index p,
1022 Index r,
1023 const Range& c) const;
1024 // -|||||-
1026 Index v,
1027 Index s,
1028 Index b,
1029 Index p,
1030 Index r,
1031 const Range& c) const;
1032 // ||||--|
1034 Index v,
1035 Index s,
1036 Index b,
1037 const Range& p,
1038 const Range& r,
1039 Index c) const;
1040 // |||-|-|
1042 Index v,
1043 Index s,
1044 const Range& b,
1045 Index p,
1046 const Range& r,
1047 Index c) const;
1048 // ||-||-|
1050 Index v,
1051 const Range& s,
1052 Index b,
1053 Index p,
1054 const Range& r,
1055 Index c) const;
1056 // |-|||-|
1058 const Range& v,
1059 Index s,
1060 Index b,
1061 Index p,
1062 const Range& r,
1063 Index c) const;
1064 // -||||-|
1066 Index v,
1067 Index s,
1068 Index b,
1069 Index p,
1070 const Range& r,
1071 Index c) const;
1072 // |||--||
1074 Index v,
1075 Index s,
1076 const Range& b,
1077 const Range& p,
1078 Index r,
1079 Index c) const;
1080 // ||-|-||
1082 Index v,
1083 const Range& s,
1084 Index b,
1085 const Range& p,
1086 Index r,
1087 Index c) const;
1088 // |-||-||
1090 const Range& v,
1091 Index s,
1092 Index b,
1093 const Range& p,
1094 Index r,
1095 Index c) const;
1096 // -|||-||
1098 Index v,
1099 Index s,
1100 Index b,
1101 const Range& p,
1102 Index r,
1103 Index c) const;
1104 // ||--|||
1106 Index v,
1107 const Range& s,
1108 const Range& b,
1109 Index p,
1110 Index r,
1111 Index c) const;
1112 // |-|-|||
1114 const Range& v,
1115 Index s,
1116 const Range& b,
1117 Index p,
1118 Index r,
1119 Index c) const;
1120 // -||-|||
1122 Index v,
1123 Index s,
1124 const Range& b,
1125 Index p,
1126 Index r,
1127 Index c) const;
1128 // |--||||
1130 const Range& v,
1131 const Range& s,
1132 Index b,
1133 Index p,
1134 Index r,
1135 Index c) const;
1136 // -|-||||
1138 Index v,
1139 const Range& s,
1140 Index b,
1141 Index p,
1142 Index r,
1143 Index c) const;
1144 // --|||||
1146 const Range& v,
1147 Index s,
1148 Index b,
1149 Index p,
1150 Index r,
1151 Index c) const;
1152
1153 // Result 1D (7 combinations)
1154 // ||||||-
1156 Index v,
1157 Index s,
1158 Index b,
1159 Index p,
1160 Index r,
1161 const Range& c) const;
1162 // |||||-|
1164 Index v,
1165 Index s,
1166 Index b,
1167 Index p,
1168 const Range& r,
1169 Index c) const;
1170 // ||||-||
1172 Index v,
1173 Index s,
1174 Index b,
1175 const Range& p,
1176 Index r,
1177 Index c) const;
1178 // |||-|||
1180 Index v,
1181 Index s,
1182 const Range& b,
1183 Index p,
1184 Index r,
1185 Index c) const;
1186 // ||-||||
1188 Index v,
1189 const Range& s,
1190 Index b,
1191 Index p,
1192 Index r,
1193 Index c) const;
1194 // |-|||||
1196 const Range& v,
1197 Index s,
1198 Index b,
1199 Index p,
1200 Index r,
1201 Index c) const;
1202 // -||||||
1204 Index v,
1205 Index s,
1206 Index b,
1207 Index p,
1208 Index r,
1209 Index c) const;
1210
1211 // Result scalar (1 combination)
1212 // |||||||
1214 Index l, Index v, Index s, Index b, Index p, Index r, Index c) const {
1215 CHECK(l);
1216 CHECK(v);
1217 CHECK(s);
1218 CHECK(b);
1219 CHECK(p);
1220 CHECK(r);
1221 CHECK(c);
1222 return get(l, v, s, b, p, r, c);
1223 }
1224
1226 [[nodiscard]] Numeric get(
1227 Index l, Index v, Index s, Index b, Index p, Index r, Index c) const {
1228 return *(mdata + OFFSET(l) + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) +
1229 OFFSET(r) + OFFSET(c));
1230 }
1231
1232 // Functions returning iterators:
1233 [[nodiscard]] ConstIterator7D begin() const;
1234 [[nodiscard]] ConstIterator7D end() const;
1235
1237 virtual ~ConstTensor7View() = default;
1238
1239 // Friends:
1240 friend class Tensor7View;
1241
1242 friend std::ostream& operator<<(std::ostream& os, const ConstTensor7View& v);
1243
1244 // Special constructor to make a Tensor7 view of a Tensor6.
1246
1247 protected:
1248 // Constructors:
1249 ConstTensor7View() = default;
1251 const Range& l,
1252 const Range& v,
1253 const Range& s,
1254 const Range& b,
1255 const Range& p,
1256 const Range& r,
1257 const Range& c);
1259 const Range& pl,
1260 const Range& pv,
1261 const Range& ps,
1262 const Range& pb,
1263 const Range& pp,
1264 const Range& pr,
1265 const Range& pc,
1266 const Range& nl,
1267 const Range& nv,
1268 const Range& ns,
1269 const Range& nb,
1270 const Range& np,
1271 const Range& nr,
1272 const Range& nc);
1273
1274 // Data members:
1275 // -------------
1277 Range mlr{0, 0, 1};
1279 Range mvr{0, 0, 1};
1281 Range msr{0, 0, 1};
1283 Range mbr{0, 0, 1};
1285 Range mpr{0, 0, 1};
1287 Range mrr{0, 0, 1};
1289 Range mcr{0, 0, 1};
1291 Numeric* mdata{nullptr};
1292};
1293
1304 public:
1305 // Make const methods visible from base class
1308 using ConstTensor7View::operator();
1310
1311 constexpr Tensor7View(const Tensor7View&) = default;
1312
1313 // Non-const index operators:
1314
1315 // Result 7D (1 combination)
1316 // -------
1318 const Range& v,
1319 const Range& s,
1320 const Range& b,
1321 const Range& p,
1322 const Range& r,
1323 const Range& c);
1324
1325 // Result 6D (7 combinations)
1326 // ------|
1328 const Range& v,
1329 const Range& s,
1330 const Range& b,
1331 const Range& p,
1332 const Range& r,
1333 Index c);
1334 // -----|-
1336 const Range& v,
1337 const Range& s,
1338 const Range& b,
1339 const Range& p,
1340 Index r,
1341 const Range& c);
1342 // ----|--
1344 const Range& v,
1345 const Range& s,
1346 const Range& b,
1347 Index p,
1348 const Range& r,
1349 const Range& c);
1350 // ---|---
1352 const Range& v,
1353 const Range& s,
1354 Index b,
1355 const Range& p,
1356 const Range& r,
1357 const Range& c);
1358 // --|----
1360 const Range& v,
1361 Index s,
1362 const Range& b,
1363 const Range& p,
1364 const Range& r,
1365 const Range& c);
1366 // -|-----
1368 Index v,
1369 const Range& s,
1370 const Range& b,
1371 const Range& p,
1372 const Range& r,
1373 const Range& c);
1374 // |------
1376 const Range& v,
1377 const Range& s,
1378 const Range& b,
1379 const Range& p,
1380 const Range& r,
1381 const Range& c);
1382
1383 // Result 5D (6+5+4+3+2+1 = 21 combinations)
1384 // -----||
1386 const Range& v,
1387 const Range& s,
1388 const Range& b,
1389 const Range& p,
1390 Index r,
1391 Index c);
1392 // ----|-|
1394 const Range& v,
1395 const Range& s,
1396 const Range& b,
1397 Index p,
1398 const Range& r,
1399 Index c);
1400 // ---|--|
1402 const Range& v,
1403 const Range& s,
1404 Index b,
1405 const Range& p,
1406 const Range& r,
1407 Index c);
1408 // --|---|
1410 const Range& v,
1411 Index s,
1412 const Range& b,
1413 const Range& p,
1414 const Range& r,
1415 Index c);
1416 // -|----|
1418 Index v,
1419 const Range& s,
1420 const Range& b,
1421 const Range& p,
1422 const Range& r,
1423 Index c);
1424 // |-----|
1426 const Range& v,
1427 const Range& s,
1428 const Range& b,
1429 const Range& p,
1430 const Range& r,
1431 Index c);
1432 // ----||-
1434 const Range& v,
1435 const Range& s,
1436 const Range& b,
1437 Index p,
1438 Index r,
1439 const Range& c);
1440 // ---|-|-
1442 const Range& v,
1443 const Range& s,
1444 Index b,
1445 const Range& p,
1446 Index r,
1447 const Range& c);
1448 // --|--|-
1450 const Range& v,
1451 Index s,
1452 const Range& b,
1453 const Range& p,
1454 Index r,
1455 const Range& c);
1456 // -|---|-
1458 Index v,
1459 const Range& s,
1460 const Range& b,
1461 const Range& p,
1462 Index r,
1463 const Range& c);
1464 // |----|-
1466 const Range& v,
1467 const Range& s,
1468 const Range& b,
1469 const Range& p,
1470 Index r,
1471 const Range& c);
1472 // ---||--
1474 const Range& v,
1475 const Range& s,
1476 Index b,
1477 Index p,
1478 const Range& r,
1479 const Range& c);
1480 // --|-|--
1482 const Range& v,
1483 Index s,
1484 const Range& b,
1485 Index p,
1486 const Range& r,
1487 const Range& c);
1488 // -|--|--
1490 Index v,
1491 const Range& s,
1492 const Range& b,
1493 Index p,
1494 const Range& r,
1495 const Range& c);
1496 // |---|--
1498 const Range& v,
1499 const Range& s,
1500 const Range& b,
1501 Index p,
1502 const Range& r,
1503 const Range& c);
1504 // --||---
1506 const Range& v,
1507 Index s,
1508 Index b,
1509 const Range& p,
1510 const Range& r,
1511 const Range& c);
1512 // -|-|---
1514 Index v,
1515 const Range& s,
1516 Index b,
1517 const Range& p,
1518 const Range& r,
1519 const Range& c);
1520 // |--|---
1522 const Range& v,
1523 const Range& s,
1524 Index b,
1525 const Range& p,
1526 const Range& r,
1527 const Range& c);
1528 // -||----
1530 Index v,
1531 Index s,
1532 const Range& b,
1533 const Range& p,
1534 const Range& r,
1535 const Range& c);
1536 // |-|----
1538 const Range& v,
1539 Index s,
1540 const Range& b,
1541 const Range& p,
1542 const Range& r,
1543 const Range& c);
1544 // ||-----
1546 Index v,
1547 const Range& s,
1548 const Range& b,
1549 const Range& p,
1550 const Range& r,
1551 const Range& c);
1552
1553 // Result 4D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1554 // ----|||
1556 const Range& v,
1557 const Range& s,
1558 const Range& b,
1559 Index p,
1560 Index r,
1561 Index c);
1562 // ---|-||
1564 const Range& v,
1565 const Range& s,
1566 Index b,
1567 const Range& p,
1568 Index r,
1569 Index c);
1570 // --|--||
1572 const Range& v,
1573 Index s,
1574 const Range& b,
1575 const Range& p,
1576 Index r,
1577 Index c);
1578 // -|---||
1580 Index v,
1581 const Range& s,
1582 const Range& b,
1583 const Range& p,
1584 Index r,
1585 Index c);
1586 // |----||
1588 const Range& v,
1589 const Range& s,
1590 const Range& b,
1591 const Range& p,
1592 Index r,
1593 Index c);
1594 // ---||-|
1596 const Range& v,
1597 const Range& s,
1598 Index b,
1599 Index p,
1600 const Range& r,
1601 Index c);
1602 // --|-|-|
1604 const Range& v,
1605 Index s,
1606 const Range& b,
1607 Index p,
1608 const Range& r,
1609 Index c);
1610 // -|--|-|
1612 Index v,
1613 const Range& s,
1614 const Range& b,
1615 Index p,
1616 const Range& r,
1617 Index c);
1618 // |---|-|
1620 const Range& v,
1621 const Range& s,
1622 const Range& b,
1623 Index p,
1624 const Range& r,
1625 Index c);
1626 // --||--|
1628 const Range& v,
1629 Index s,
1630 Index b,
1631 const Range& p,
1632 const Range& r,
1633 Index c);
1634 // -|-|--|
1636 Index v,
1637 const Range& s,
1638 Index b,
1639 const Range& p,
1640 const Range& r,
1641 Index c);
1642 // |--|--|
1644 const Range& v,
1645 const Range& s,
1646 Index b,
1647 const Range& p,
1648 const Range& r,
1649 Index c);
1650 // -||---|
1652 Index v,
1653 Index s,
1654 const Range& b,
1655 const Range& p,
1656 const Range& r,
1657 Index c);
1658 // |-|---|
1660 const Range& v,
1661 Index s,
1662 const Range& b,
1663 const Range& p,
1664 const Range& r,
1665 Index c);
1666 // ||----|
1668 Index v,
1669 const Range& s,
1670 const Range& b,
1671 const Range& p,
1672 const Range& r,
1673 Index c);
1674 // ---|||-
1676 const Range& v,
1677 const Range& s,
1678 Index b,
1679 Index p,
1680 Index r,
1681 const Range& c);
1682 // --|-||-
1684 const Range& v,
1685 Index s,
1686 const Range& b,
1687 Index p,
1688 Index r,
1689 const Range& c);
1690 // -|--||-
1692 Index v,
1693 const Range& s,
1694 const Range& b,
1695 Index p,
1696 Index r,
1697 const Range& c);
1698 // |---||-
1700 const Range& v,
1701 const Range& s,
1702 const Range& b,
1703 Index p,
1704 Index r,
1705 const Range& c);
1706 // --||-|-
1708 const Range& v,
1709 Index s,
1710 Index b,
1711 const Range& p,
1712 Index r,
1713 const Range& c);
1714 // -|-|-|-
1716 Index v,
1717 const Range& s,
1718 Index b,
1719 const Range& p,
1720 Index r,
1721 const Range& c);
1722 // |--|-|-
1724 const Range& v,
1725 const Range& s,
1726 Index b,
1727 const Range& p,
1728 Index r,
1729 const Range& c);
1730 // -||--|-
1732 Index v,
1733 Index s,
1734 const Range& b,
1735 const Range& p,
1736 Index r,
1737 const Range& c);
1738 // |-|--|-
1740 const Range& v,
1741 Index s,
1742 const Range& b,
1743 const Range& p,
1744 Index r,
1745 const Range& c);
1746 // ||---|-
1748 Index v,
1749 const Range& s,
1750 const Range& b,
1751 const Range& p,
1752 Index r,
1753 const Range& c);
1754 // --|||--
1756 const Range& v,
1757 Index s,
1758 Index b,
1759 Index p,
1760 const Range& r,
1761 const Range& c);
1762 // -|-||--
1764 Index v,
1765 const Range& s,
1766 Index b,
1767 Index p,
1768 const Range& r,
1769 const Range& c);
1770 // |--||--
1772 const Range& v,
1773 const Range& s,
1774 Index b,
1775 Index p,
1776 const Range& r,
1777 const Range& c);
1778 // -||-|--
1780 Index v,
1781 Index s,
1782 const Range& b,
1783 Index p,
1784 const Range& r,
1785 const Range& c);
1786 // |-|-|--
1788 const Range& v,
1789 Index s,
1790 const Range& b,
1791 Index p,
1792 const Range& r,
1793 const Range& c);
1794 // ||--|--
1796 Index v,
1797 const Range& s,
1798 const Range& b,
1799 Index p,
1800 const Range& r,
1801 const Range& c);
1802 // -|||---
1804 Index v,
1805 Index s,
1806 Index b,
1807 const Range& p,
1808 const Range& r,
1809 const Range& c);
1810 // |-||---
1812 const Range& v,
1813 Index s,
1814 Index b,
1815 const Range& p,
1816 const Range& r,
1817 const Range& c);
1818 // ||-|---
1820 Index v,
1821 const Range& s,
1822 Index b,
1823 const Range& p,
1824 const Range& r,
1825 const Range& c);
1826 // |||----
1828 Index v,
1829 Index s,
1830 const Range& b,
1831 const Range& p,
1832 const Range& r,
1833 const Range& c);
1834
1835 // Result 3D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1836 // ||||---
1838 Index v,
1839 Index s,
1840 Index b,
1841 const Range& p,
1842 const Range& r,
1843 const Range& c);
1844 // |||-|--
1846 Index v,
1847 Index s,
1848 const Range& b,
1849 Index p,
1850 const Range& r,
1851 const Range& c);
1852 // ||-||--
1854 Index v,
1855 const Range& s,
1856 Index b,
1857 Index p,
1858 const Range& r,
1859 const Range& c);
1860 // |-|||--
1862 const Range& v,
1863 Index s,
1864 Index b,
1865 Index p,
1866 const Range& r,
1867 const Range& c);
1868 // -||||--
1870 Index v,
1871 Index s,
1872 Index b,
1873 Index p,
1874 const Range& r,
1875 const Range& c);
1876 // |||--|-
1878 Index v,
1879 Index s,
1880 const Range& b,
1881 const Range& p,
1882 Index r,
1883 const Range& c);
1884 // ||-|-|-
1886 Index v,
1887 const Range& s,
1888 Index b,
1889 const Range& p,
1890 Index r,
1891 const Range& c);
1892 // |-||-|-
1894 const Range& v,
1895 Index s,
1896 Index b,
1897 const Range& p,
1898 Index r,
1899 const Range& c);
1900 // -|||-|-
1902 Index v,
1903 Index s,
1904 Index b,
1905 const Range& p,
1906 Index r,
1907 const Range& c);
1908 // ||--||-
1910 Index v,
1911 const Range& s,
1912 const Range& b,
1913 Index p,
1914 Index r,
1915 const Range& c);
1916 // |-|-||-
1918 const Range& v,
1919 Index s,
1920 const Range& b,
1921 Index p,
1922 Index r,
1923 const Range& c);
1924 // -||-||-
1926 Index v,
1927 Index s,
1928 const Range& b,
1929 Index p,
1930 Index r,
1931 const Range& c);
1932 // |--|||-
1934 const Range& v,
1935 const Range& s,
1936 Index b,
1937 Index p,
1938 Index r,
1939 const Range& c);
1940 // -|-|||-
1942 Index v,
1943 const Range& s,
1944 Index b,
1945 Index p,
1946 Index r,
1947 const Range& c);
1948 // --||||-
1950 const Range& v,
1951 Index s,
1952 Index b,
1953 Index p,
1954 Index r,
1955 const Range& c);
1956 // |||---|
1958 Index v,
1959 Index s,
1960 const Range& b,
1961 const Range& p,
1962 const Range& r,
1963 Index c);
1964 // ||-|--|
1966 Index v,
1967 const Range& s,
1968 Index b,
1969 const Range& p,
1970 const Range& r,
1971 Index c);
1972 // |-||--|
1974 const Range& v,
1975 Index s,
1976 Index b,
1977 const Range& p,
1978 const Range& r,
1979 Index c);
1980 // -|||--|
1982 Index v,
1983 Index s,
1984 Index b,
1985 const Range& p,
1986 const Range& r,
1987 Index c);
1988 // ||--|-|
1990 Index v,
1991 const Range& s,
1992 const Range& b,
1993 Index p,
1994 const Range& r,
1995 Index c);
1996 // |-|-|-|
1998 const Range& v,
1999 Index s,
2000 const Range& b,
2001 Index p,
2002 const Range& r,
2003 Index c);
2004 // -||-|-|
2006 Index v,
2007 Index s,
2008 const Range& b,
2009 Index p,
2010 const Range& r,
2011 Index c);
2012 // |--||-|
2014 const Range& v,
2015 const Range& s,
2016 Index b,
2017 Index p,
2018 const Range& r,
2019 Index c);
2020 // -|-||-|
2022 Index v,
2023 const Range& s,
2024 Index b,
2025 Index p,
2026 const Range& r,
2027 Index c);
2028 // --|||-|
2030 const Range& v,
2031 Index s,
2032 Index b,
2033 Index p,
2034 const Range& r,
2035 Index c);
2036 // ||---||
2038 Index v,
2039 const Range& s,
2040 const Range& b,
2041 const Range& p,
2042 Index r,
2043 Index c);
2044 // |-|--||
2046 const Range& v,
2047 Index s,
2048 const Range& b,
2049 const Range& p,
2050 Index r,
2051 Index c);
2052 // -||--||
2054 Index v,
2055 Index s,
2056 const Range& b,
2057 const Range& p,
2058 Index r,
2059 Index c);
2060 // |--|-||
2062 const Range& v,
2063 const Range& s,
2064 Index b,
2065 const Range& p,
2066 Index r,
2067 Index c);
2068 // -|-|-||
2070 Index v,
2071 const Range& s,
2072 Index b,
2073 const Range& p,
2074 Index r,
2075 Index c);
2076 // --||-||
2078 const Range& v,
2079 Index s,
2080 Index b,
2081 const Range& p,
2082 Index r,
2083 Index c);
2084 // |---|||
2086 const Range& v,
2087 const Range& s,
2088 const Range& b,
2089 Index p,
2090 Index r,
2091 Index c);
2092 // -|--|||
2094 Index v,
2095 const Range& s,
2096 const Range& b,
2097 Index p,
2098 Index r,
2099 Index c);
2100 // --|-|||
2102 const Range& v,
2103 Index s,
2104 const Range& b,
2105 Index p,
2106 Index r,
2107 Index c);
2108 // ---||||
2110 const Range& v,
2111 const Range& s,
2112 Index b,
2113 Index p,
2114 Index r,
2115 Index c);
2116
2117 // Result 2D (6+5+4+3+2+1 = 21 combinations)
2118 // |||||--
2120 Index v,
2121 Index s,
2122 Index b,
2123 Index p,
2124 const Range& r,
2125 const Range& c);
2126 // ||||-|-
2128 Index v,
2129 Index s,
2130 Index b,
2131 const Range& p,
2132 Index r,
2133 const Range& c);
2134 // |||-||-
2136 Index v,
2137 Index s,
2138 const Range& b,
2139 Index p,
2140 Index r,
2141 const Range& c);
2142 // ||-|||-
2144 Index v,
2145 const Range& s,
2146 Index b,
2147 Index p,
2148 Index r,
2149 const Range& c);
2150 // |-||||-
2152 const Range& v,
2153 Index s,
2154 Index b,
2155 Index p,
2156 Index r,
2157 const Range& c);
2158 // -|||||-
2160 Index v,
2161 Index s,
2162 Index b,
2163 Index p,
2164 Index r,
2165 const Range& c);
2166 // ||||--|
2168 Index v,
2169 Index s,
2170 Index b,
2171 const Range& p,
2172 const Range& r,
2173 Index c);
2174 // |||-|-|
2176 Index v,
2177 Index s,
2178 const Range& b,
2179 Index p,
2180 const Range& r,
2181 Index c);
2182 // ||-||-|
2184 Index v,
2185 const Range& s,
2186 Index b,
2187 Index p,
2188 const Range& r,
2189 Index c);
2190 // |-|||-|
2192 const Range& v,
2193 Index s,
2194 Index b,
2195 Index p,
2196 const Range& r,
2197 Index c);
2198 // -||||-|
2200 Index v,
2201 Index s,
2202 Index b,
2203 Index p,
2204 const Range& r,
2205 Index c);
2206 // |||--||
2208 Index v,
2209 Index s,
2210 const Range& b,
2211 const Range& p,
2212 Index r,
2213 Index c);
2214 // ||-|-||
2216 Index v,
2217 const Range& s,
2218 Index b,
2219 const Range& p,
2220 Index r,
2221 Index c);
2222 // |-||-||
2224 const Range& v,
2225 Index s,
2226 Index b,
2227 const Range& p,
2228 Index r,
2229 Index c);
2230 // -|||-||
2232 Index v,
2233 Index s,
2234 Index b,
2235 const Range& p,
2236 Index r,
2237 Index c);
2238 // ||--|||
2240 Index v,
2241 const Range& s,
2242 const Range& b,
2243 Index p,
2244 Index r,
2245 Index c);
2246 // |-|-|||
2248 const Range& v,
2249 Index s,
2250 const Range& b,
2251 Index p,
2252 Index r,
2253 Index c);
2254 // -||-|||
2256 Index v,
2257 Index s,
2258 const Range& b,
2259 Index p,
2260 Index r,
2261 Index c);
2262 // |--||||
2264 const Range& v,
2265 const Range& s,
2266 Index b,
2267 Index p,
2268 Index r,
2269 Index c);
2270 // -|-||||
2272 Index v,
2273 const Range& s,
2274 Index b,
2275 Index p,
2276 Index r,
2277 Index c);
2278 // --|||||
2280 const Range& v,
2281 Index s,
2282 Index b,
2283 Index p,
2284 Index r,
2285 Index c);
2286
2287 // Result 1D (7 combinations)
2288 // ||||||-
2290 Index l, Index v, Index s, Index b, Index p, Index r, const Range& c);
2291 // |||||-|
2293 Index l, Index v, Index s, Index b, Index p, const Range& r, Index c);
2294 // ||||-||
2296 Index l, Index v, Index s, Index b, const Range& p, Index r, Index c);
2297 // |||-|||
2299 Index l, Index v, Index s, const Range& b, Index p, Index r, Index c);
2300 // ||-||||
2302 Index l, Index v, const Range& s, Index b, Index p, Index r, Index c);
2303 // |-|||||
2305 Index l, const Range& v, Index s, Index b, Index p, Index r, Index c);
2306 // -||||||
2308 const Range& l, Index v, Index s, Index b, Index p, Index r, Index c);
2309
2310 // Result scalar (1 combination)
2311 // |||||||
2313 Index l, Index v, Index s, Index b, Index p, Index r, Index c) {
2314 CHECK(l);
2315 CHECK(v);
2316 CHECK(s);
2317 CHECK(b);
2318 CHECK(p);
2319 CHECK(r);
2320 CHECK(c);
2321 return get(l, v, s, b, p, r, c);
2322 }
2323
2326 return *(mdata + OFFSET(l) + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) +
2327 OFFSET(r) + OFFSET(c));
2328 }
2329
2330 // Conversion to a plain C-array
2331 [[nodiscard]] const Numeric* get_c_array() const ARTS_NOEXCEPT;
2333
2334 // Functions returning iterators:
2335 Iterator7D begin();
2336 Iterator7D end();
2337
2338 // Assignment operators:
2339 Tensor7View& operator=(const ConstTensor7View& v);
2340 Tensor7View& operator=(const Tensor7View& v);
2341 Tensor7View& operator=(const Tensor7& v);
2342 Tensor7View& operator=(Numeric x);
2343
2344 // Other operators:
2345 Tensor7View& operator*=(Numeric x);
2346 Tensor7View& operator/=(Numeric x);
2347 Tensor7View& operator+=(Numeric x);
2348 Tensor7View& operator-=(Numeric x);
2349
2350 Tensor7View& operator*=(const ConstTensor7View& x);
2351 Tensor7View& operator/=(const ConstTensor7View& x);
2352 Tensor7View& operator+=(const ConstTensor7View& x);
2353 Tensor7View& operator-=(const ConstTensor7View& x);
2354
2356 virtual ~Tensor7View() = default;
2357
2358 // Friends:
2359
2360 // Special constructor to make a Tensor7 view of a Tensor6.
2361 Tensor7View(const Tensor6View& a);
2362
2363 protected:
2364 // Constructors:
2365 Tensor7View() = default;
2366 Tensor7View(Numeric* data,
2367 const Range& l,
2368 const Range& v,
2369 const Range& s,
2370 const Range& b,
2371 const Range& p,
2372 const Range& r,
2373 const Range& c);
2374 Tensor7View(Numeric* data,
2375 const Range& pl,
2376 const Range& pv,
2377 const Range& ps,
2378 const Range& pb,
2379 const Range& pp,
2380 const Range& pr,
2381 const Range& pc,
2382 const Range& nl,
2383 const Range& nv,
2384 const Range& ns,
2385 const Range& nb,
2386 const Range& np,
2387 const Range& nr,
2388 const Range& nc);
2389};
2390
2399class Tensor7 : public Tensor7View {
2400 public:
2401 // Constructors:
2402 Tensor7() = default;
2403 Tensor7(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2404 Tensor7(Index l,
2405 Index v,
2406 Index s,
2407 Index b,
2408 Index p,
2409 Index r,
2410 Index c,
2411 Numeric fill);
2412 Tensor7(const ConstTensor7View& v);
2413 Tensor7(const Tensor7& v);
2414 Tensor7(Tensor7&& v) noexcept : Tensor7View(std::forward<Tensor7View>(v)) {
2415 v.mdata = nullptr;
2416 }
2417
2418 // Assignment operators:
2419 Tensor7& operator=(const Tensor7& x);
2420 Tensor7& operator=(Tensor7&& x) noexcept;
2422
2423 // Resize function:
2424 void resize(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2425
2426 // Swap function:
2427 friend void swap(Tensor7& t1, Tensor7& t2);
2428
2429 // Destructor:
2430 virtual ~Tensor7();
2431
2433 template <std::size_t dim0>
2435 static_assert(dim0 < 7, "Bad Dimension, Out-of-Bounds");
2436
2437 Range r0(0,
2438 dim0 == 0 ? nlibraries()
2439 : dim0 == 1 ? nvitrines()
2440 : dim0 == 2 ? nshelves()
2441 : dim0 == 3 ? nbooks()
2442 : dim0 == 4 ? npages()
2443 : dim0 == 5 ? nrows()
2444 : ncols());
2445
2446 Vector out(mdata, r0);
2447 ARTS_ASSERT(size() not_eq out.size(),
2448 "Can only reduce size on same size input");
2449 mdata = nullptr;
2450 return out;
2451 }
2452
2454 template <std::size_t dim0, std::size_t dim1>
2456 static_assert(dim1 < 7, "Bad Dimension, Out-of-Bounds");
2457 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2458
2459 const Range r1(0,
2460 dim1 == 1 ? nvitrines()
2461 : dim1 == 2 ? nshelves()
2462 : dim1 == 3 ? nbooks()
2463 : dim1 == 4 ? npages()
2464 : dim1 == 5 ? nrows()
2465 : ncols());
2466 const Range r0(0,
2467 dim0 == 0 ? nlibraries()
2468 : dim0 == 1 ? nvitrines()
2469 : dim0 == 2 ? nshelves()
2470 : dim0 == 3 ? nbooks()
2471 : dim0 == 4 ? npages()
2472 : nrows(),
2473 r1.get_extent());
2474
2475 Matrix out(mdata, r0, r1);
2476 ARTS_ASSERT(size() not_eq out.size(),
2477 "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>
2485 static_assert(dim2 < 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
2489 const Range r2(0,
2490 dim2 == 2 ? nshelves()
2491 : dim2 == 3 ? nbooks()
2492 : dim2 == 4 ? npages()
2493 : dim2 == 5 ? nrows()
2494 : ncols());
2495 const Range r1(0,
2496 dim1 == 1 ? nvitrines()
2497 : dim1 == 2 ? nshelves()
2498 : dim1 == 3 ? nbooks()
2499 : dim1 == 4 ? npages()
2500 : nrows(),
2501 r2.get_extent());
2502 const Range r0(0,
2503 dim0 == 0 ? nlibraries()
2504 : dim0 == 1 ? nvitrines()
2505 : dim0 == 2 ? nshelves()
2506 : dim0 == 3 ? nbooks()
2507 : npages(),
2508 r1.get_extent() * r2.get_extent());
2509
2510 Tensor3 out(mdata, r0, r1, r2);
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,
2519 std::size_t dim1,
2520 std::size_t dim2,
2521 std::size_t dim3>
2523 static_assert(dim3 < 7, "Bad Dimension, Out-of-Bounds");
2524 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2525 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2526 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2527
2528 const Range r3(0,
2529 dim3 == 3 ? nbooks()
2530 : dim3 == 4 ? npages()
2531 : dim3 == 5 ? nrows()
2532 : ncols());
2533 const Range r2(0,
2534 dim2 == 2 ? nshelves()
2535 : dim2 == 3 ? nbooks()
2536 : dim2 == 4 ? npages()
2537 : nrows(),
2538 r3.get_extent());
2539 const Range r1(0,
2540 dim1 == 1 ? nvitrines()
2541 : dim1 == 2 ? nshelves()
2542 : dim1 == 3 ? nbooks()
2543 : npages(),
2544 r2.get_extent() * r3.get_extent());
2545 const Range r0(0,
2546 dim0 == 0 ? nlibraries()
2547 : dim0 == 1 ? nvitrines()
2548 : dim0 == 2 ? nshelves()
2549 : nbooks(),
2550 r1.get_extent() * r2.get_extent() * r3.get_extent());
2551
2552 Tensor4 out(mdata, r0, r1, r2, r3);
2553 ARTS_ASSERT(size() not_eq out.size(),
2554 "Can only reduce size on same size input");
2555 mdata = nullptr;
2556 return out;
2557 }
2558
2560 template <std::size_t dim0,
2561 std::size_t dim1,
2562 std::size_t dim2,
2563 std::size_t dim3,
2564 std::size_t dim4>
2566 static_assert(dim4 < 7, "Bad Dimension, Out-of-Bounds");
2567 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2568 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2569 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2570 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2571
2572 const Range r4(0, dim4 == 4 ? npages() : dim4 == 5 ? nrows() : ncols());
2573 const Range r3(0,
2574 dim3 == 3 ? nbooks()
2575 : dim3 == 4 ? npages()
2576 : nrows(),
2577 r4.get_extent());
2578 const Range r2(0,
2579 dim2 == 2 ? nshelves()
2580 : dim2 == 3 ? nbooks()
2581 : npages(),
2582 r3.get_extent() * r4.get_extent());
2583 const Range r1(0,
2584 dim1 == 1 ? nvitrines()
2585 : dim1 == 2 ? nshelves()
2586 : nbooks(),
2587 r2.get_extent() * r3.get_extent() * r4.get_extent());
2588 const Range r0(
2589 0,
2590 dim0 == 0 ? nlibraries()
2591 : dim0 == 1 ? nvitrines()
2592 : nshelves(),
2593 r1.get_extent() * r2.get_extent() * r3.get_extent() * r4.get_extent());
2594
2595 Tensor5 out(mdata, r0, r1, r2, r3, r4);
2596 ARTS_ASSERT(size() not_eq out.size(),
2597 "Can only reduce size on same size input");
2598 mdata = nullptr;
2599 return out;
2600 }
2601
2603 template <std::size_t dim0,
2604 std::size_t dim1,
2605 std::size_t dim2,
2606 std::size_t dim3,
2607 std::size_t dim4,
2608 std::size_t dim5>
2610 static_assert(dim5 < 7, "Bad Dimension, Out-of-Bounds");
2611 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2612 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2613 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2614 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2615 static_assert(dim4 < dim5, "Bad Dimensions, dim5 must be larger than dim4");
2616
2617 const Range r5(0, dim5 == 5 ? nrows() : ncols());
2618 const Range r4(0, dim4 == 4 ? npages() : nrows(), r5.get_extent());
2619 const Range r3(
2620 0, dim3 == 3 ? nbooks() : npages(), r4.get_extent() * r5.get_extent());
2621 const Range r2(0,
2622 dim2 == 2 ? nshelves() : nbooks(),
2623 r3.get_extent() * r4.get_extent() * r5.get_extent());
2624 const Range r1(
2625 0,
2626 dim1 == 1 ? nvitrines() : nshelves(),
2627 r2.get_extent() * r3.get_extent() * r4.get_extent() * r5.get_extent());
2628 const Range r0(0,
2629 dim0 == 0 ? nlibraries() : nvitrines(),
2630 r1.get_extent() * r2.get_extent() * r3.get_extent() *
2631 r4.get_extent() * r5.get_extent());
2632
2633 Tensor6 out(mdata, r0, r1, r2, r3, r4, r5);
2634 ARTS_ASSERT(size() not_eq out.size(),
2635 "Can only reduce size on same size input");
2636 mdata = nullptr;
2637 return out;
2638 }
2639
2640 template <class F>
2641 void transform_elementwise(F&& func) {
2642 std::transform(mdata, mdata + size(), mdata, func);
2643 }
2644};
2645
2646// Function declarations:
2647// ----------------------
2648
2649void copy(ConstIterator7D origin,
2650 const ConstIterator7D& end,
2651 Iterator7D target);
2652
2653void copy(Numeric x, Iterator7D target, const Iterator7D& end);
2654
2655void transform(Tensor7View y, double (&my_func)(double), ConstTensor7View x);
2656
2657Numeric max(const ConstTensor7View& x);
2658
2659Numeric min(const ConstTensor7View& x);
2660
2662// Helper function for debugging
2663#ifndef NDEBUG
2664
2666 Index l,
2667 Index v,
2668 Index s,
2669 Index b,
2670 Index p,
2671 Index r,
2672 Index c);
2673
2674#endif
2676
2679
2681
2682#endif // matpackVII_h
This can be used to make arrays out of anything.
Definition: array.h:48
Const version of Iterator7D.
Definition: matpackVII.h:83
const ConstTensor6View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVII.h:117
ConstTensor6View msv
Current position.
Definition: matpackVII.h:124
ConstIterator7D & operator++()
Prefix increment operator.
Definition: matpackVII.h:96
ConstIterator7D()=default
Default constructor.
const ConstTensor6View & operator*() const
Dereferencing.
Definition: matpackVII.h:120
Index mstride
Stride.
Definition: matpackVII.h:126
ConstIterator7D(const ConstTensor6View &x, Index stride)
Explicit constructor.
Definition: matpackVII.h:90
bool operator!=(const ConstIterator7D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackVII.h:105
A constant view of a Matrix.
Definition: matpackI.h:1043
Index size() const noexcept
Definition: matpackI.h:1061
A constant view of a Tensor3.
Definition: matpackIII.h:130
Index size() const noexcept
Definition: matpackIII.h:149
A constant view of a Tensor4.
Definition: matpackIV.h:131
Index size() const noexcept
Definition: matpackIV.h:145
A constant view of a Tensor5.
Definition: matpackV.h:141
Index size() const noexcept
Definition: matpackV.h:156
A constant view of a Tensor6.
Definition: matpackVI.h:147
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVI.h:608
Range mcr
The column range of mdata that is actually used.
Definition: matpackVI.h:618
Range mbr
The book range of mdata that is actually used.
Definition: matpackVI.h:612
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVI.h:620
Range mrr
The row range of mdata that is actually used.
Definition: matpackVI.h:616
Index size() const noexcept
Definition: matpackVI.h:163
Range mpr
The page range of mdata that is actually used.
Definition: matpackVI.h:614
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVI.h:610
A constant view of a Tensor7.
Definition: matpackVII.h:145
Shape< 7 > shape() const
Definition: matpackVII.h:169
Index ncols() const noexcept
Definition: matpackVII.h:159
Range mrr
The row range of mdata that is actually used.
Definition: matpackVII.h:1287
Range mcr
The column range of mdata that is actually used.
Definition: matpackVII.h:1289
Index npages() const noexcept
Definition: matpackVII.h:157
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:1213
Range mbr
The book range of mdata that is actually used.
Definition: matpackVII.h:1283
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVII.h:1279
Index nrows() const noexcept
Definition: matpackVII.h:158
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:1285
Index nlibraries() const noexcept
Definition: matpackVII.h:153
ConstTensor7View()=default
Index nvitrines() const noexcept
Definition: matpackVII.h:154
Range mlr
The library range of mdata that is actually used.
Definition: matpackVII.h:1277
constexpr ConstTensor7View(ConstTensor7View &&)=default
constexpr ConstTensor7View(const ConstTensor7View &)=default
Index nshelves() const noexcept
Definition: matpackVII.h:155
Index size() const noexcept
Definition: matpackVII.h:162
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVII.h:1291
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:166
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:1281
Index nbooks() const noexcept
Definition: matpackVII.h:156
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:1226
A constant view of a Vector.
Definition: matpackI.h:512
Index size() const noexcept
Definition: matpackI.h:539
Implementation of Tensors of Rank 7.
Definition: matpackVII.h:36
Iterator7D()=default
Default constructor.
Tensor6View & operator*()
Dereferencing.
Definition: matpackVII.h:73
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:77
Index mstride
Stride.
Definition: matpackVII.h:79
Tensor6View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVII.h:70
Iterator7D(const Tensor6View &x, Index stride)
Explicit constructor.
Definition: matpackVII.h:43
The MatrixView class.
Definition: matpackI.h:1164
The Matrix class.
Definition: matpackI.h:1261
The range class.
Definition: matpackI.h:159
Index mstart
The start index.
Definition: matpackI.h:367
constexpr Index get_extent() const noexcept
Returns the extent of the range.
Definition: matpackI.h:342
Index mextent
The number of elements.
Definition: matpackI.h:370
The Tensor3View class.
Definition: matpackIII.h:246
The Tensor3 class.
Definition: matpackIII.h:346
The Tensor4View class.
Definition: matpackIV.h:292
The Tensor4 class.
Definition: matpackIV.h:429
The Tensor5View class.
Definition: matpackV.h:343
The Tensor5 class.
Definition: matpackV.h:516
The Tensor6View class.
Definition: matpackVI.h:632
The Tensor6 class.
Definition: matpackVI.h:1099
The Tensor7View class.
Definition: matpackVII.h:1303
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:2325
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:2312
Iterator7D begin()
Return iterator to first sub-tensor.
Definition: matpackVII.cc:5037
constexpr Tensor7View(const Tensor7View &)=default
The Tensor7 class.
Definition: matpackVII.h:2399
Tensor3 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2484
Tensor4 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2522
Matrix reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2455
Tensor7()=default
Tensor6 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2609
void transform_elementwise(F &&func)
Definition: matpackVII.h:2641
Tensor7(Tensor7 &&v) noexcept
Definition: matpackVII.h:2414
Vector reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2434
Tensor5 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2565
The VectorView class.
Definition: matpackI.h:663
The Vector class.
Definition: matpackI.h:899
#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:5590
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:5649
Numeric min(const ConstTensor7View &x)
Min function, tensor version.
Definition: matpackVII.cc:5609
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:5569
#define CHECK(x)
Implementation of Tensors of Rank 6.
Definition: matpackVI.h:33
#define OFFSET(x)
Definition: matpackVI.h:36
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
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
Helper shape class.
Definition: matpackI.h:377
#define v
#define a
#define c
#define b