ARTS 2.5.4 (git: 4c0d3b4d)
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 // Special constructor to make a Tensor7 view of a Tensor6.
1244
1245 protected:
1246 // Constructors:
1247 ConstTensor7View() = default;
1249 const Range& l,
1250 const Range& v,
1251 const Range& s,
1252 const Range& b,
1253 const Range& p,
1254 const Range& r,
1255 const Range& c);
1257 const Range& pl,
1258 const Range& pv,
1259 const Range& ps,
1260 const Range& pb,
1261 const Range& pp,
1262 const Range& pr,
1263 const Range& pc,
1264 const Range& nl,
1265 const Range& nv,
1266 const Range& ns,
1267 const Range& nb,
1268 const Range& np,
1269 const Range& nr,
1270 const Range& nc);
1271
1272 // Data members:
1273 // -------------
1275 Range mlr{0, 0, 1};
1277 Range mvr{0, 0, 1};
1279 Range msr{0, 0, 1};
1281 Range mbr{0, 0, 1};
1283 Range mpr{0, 0, 1};
1285 Range mrr{0, 0, 1};
1287 Range mcr{0, 0, 1};
1289 Numeric* mdata{nullptr};
1290};
1291
1302 public:
1303 // Make const methods visible from base class
1306 using ConstTensor7View::operator();
1308
1309 constexpr Tensor7View(const Tensor7View&) = default;
1310
1311 // Non-const index operators:
1312
1313 // Result 7D (1 combination)
1314 // -------
1316 const Range& v,
1317 const Range& s,
1318 const Range& b,
1319 const Range& p,
1320 const Range& r,
1321 const Range& c);
1322
1323 // Result 6D (7 combinations)
1324 // ------|
1326 const Range& v,
1327 const Range& s,
1328 const Range& b,
1329 const Range& p,
1330 const Range& r,
1331 Index c);
1332 // -----|-
1334 const Range& v,
1335 const Range& s,
1336 const Range& b,
1337 const Range& p,
1338 Index r,
1339 const Range& c);
1340 // ----|--
1342 const Range& v,
1343 const Range& s,
1344 const Range& b,
1345 Index p,
1346 const Range& r,
1347 const Range& c);
1348 // ---|---
1350 const Range& v,
1351 const Range& s,
1352 Index b,
1353 const Range& p,
1354 const Range& r,
1355 const Range& c);
1356 // --|----
1358 const Range& v,
1359 Index s,
1360 const Range& b,
1361 const Range& p,
1362 const Range& r,
1363 const Range& c);
1364 // -|-----
1366 Index v,
1367 const Range& s,
1368 const Range& b,
1369 const Range& p,
1370 const Range& r,
1371 const Range& c);
1372 // |------
1374 const Range& v,
1375 const Range& s,
1376 const Range& b,
1377 const Range& p,
1378 const Range& r,
1379 const Range& c);
1380
1381 // Result 5D (6+5+4+3+2+1 = 21 combinations)
1382 // -----||
1384 const Range& v,
1385 const Range& s,
1386 const Range& b,
1387 const Range& p,
1388 Index r,
1389 Index c);
1390 // ----|-|
1392 const Range& v,
1393 const Range& s,
1394 const Range& b,
1395 Index p,
1396 const Range& r,
1397 Index c);
1398 // ---|--|
1400 const Range& v,
1401 const Range& s,
1402 Index b,
1403 const Range& p,
1404 const Range& r,
1405 Index c);
1406 // --|---|
1408 const Range& v,
1409 Index s,
1410 const Range& b,
1411 const Range& p,
1412 const Range& r,
1413 Index c);
1414 // -|----|
1416 Index v,
1417 const Range& s,
1418 const Range& b,
1419 const Range& p,
1420 const Range& r,
1421 Index c);
1422 // |-----|
1424 const Range& v,
1425 const Range& s,
1426 const Range& b,
1427 const Range& p,
1428 const Range& r,
1429 Index c);
1430 // ----||-
1432 const Range& v,
1433 const Range& s,
1434 const Range& b,
1435 Index p,
1436 Index r,
1437 const Range& c);
1438 // ---|-|-
1440 const Range& v,
1441 const Range& s,
1442 Index b,
1443 const Range& p,
1444 Index r,
1445 const Range& c);
1446 // --|--|-
1448 const Range& v,
1449 Index s,
1450 const Range& b,
1451 const Range& p,
1452 Index r,
1453 const Range& c);
1454 // -|---|-
1456 Index v,
1457 const Range& s,
1458 const Range& b,
1459 const Range& p,
1460 Index r,
1461 const Range& c);
1462 // |----|-
1464 const Range& v,
1465 const Range& s,
1466 const Range& b,
1467 const Range& p,
1468 Index r,
1469 const Range& c);
1470 // ---||--
1472 const Range& v,
1473 const Range& s,
1474 Index b,
1475 Index p,
1476 const Range& r,
1477 const Range& c);
1478 // --|-|--
1480 const Range& v,
1481 Index s,
1482 const Range& b,
1483 Index p,
1484 const Range& r,
1485 const Range& c);
1486 // -|--|--
1488 Index v,
1489 const Range& s,
1490 const Range& b,
1491 Index p,
1492 const Range& r,
1493 const Range& c);
1494 // |---|--
1496 const Range& v,
1497 const Range& s,
1498 const Range& b,
1499 Index p,
1500 const Range& r,
1501 const Range& c);
1502 // --||---
1504 const Range& v,
1505 Index s,
1506 Index b,
1507 const Range& p,
1508 const Range& r,
1509 const Range& c);
1510 // -|-|---
1512 Index v,
1513 const Range& s,
1514 Index b,
1515 const Range& p,
1516 const Range& r,
1517 const Range& c);
1518 // |--|---
1520 const Range& v,
1521 const Range& s,
1522 Index b,
1523 const Range& p,
1524 const Range& r,
1525 const Range& c);
1526 // -||----
1528 Index v,
1529 Index s,
1530 const Range& b,
1531 const Range& p,
1532 const Range& r,
1533 const Range& c);
1534 // |-|----
1536 const Range& v,
1537 Index s,
1538 const Range& b,
1539 const Range& p,
1540 const Range& r,
1541 const Range& c);
1542 // ||-----
1544 Index v,
1545 const Range& s,
1546 const Range& b,
1547 const Range& p,
1548 const Range& r,
1549 const Range& c);
1550
1551 // Result 4D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1552 // ----|||
1554 const Range& v,
1555 const Range& s,
1556 const Range& b,
1557 Index p,
1558 Index r,
1559 Index c);
1560 // ---|-||
1562 const Range& v,
1563 const Range& s,
1564 Index b,
1565 const Range& p,
1566 Index r,
1567 Index c);
1568 // --|--||
1570 const Range& v,
1571 Index s,
1572 const Range& b,
1573 const Range& p,
1574 Index r,
1575 Index c);
1576 // -|---||
1578 Index v,
1579 const Range& s,
1580 const Range& b,
1581 const Range& p,
1582 Index r,
1583 Index c);
1584 // |----||
1586 const Range& v,
1587 const Range& s,
1588 const Range& b,
1589 const Range& p,
1590 Index r,
1591 Index c);
1592 // ---||-|
1594 const Range& v,
1595 const Range& s,
1596 Index b,
1597 Index p,
1598 const Range& r,
1599 Index c);
1600 // --|-|-|
1602 const Range& v,
1603 Index s,
1604 const Range& b,
1605 Index p,
1606 const Range& r,
1607 Index c);
1608 // -|--|-|
1610 Index v,
1611 const Range& s,
1612 const Range& b,
1613 Index p,
1614 const Range& r,
1615 Index c);
1616 // |---|-|
1618 const Range& v,
1619 const Range& s,
1620 const Range& b,
1621 Index p,
1622 const Range& r,
1623 Index c);
1624 // --||--|
1626 const Range& v,
1627 Index s,
1628 Index b,
1629 const Range& p,
1630 const Range& r,
1631 Index c);
1632 // -|-|--|
1634 Index v,
1635 const Range& s,
1636 Index b,
1637 const Range& p,
1638 const Range& r,
1639 Index c);
1640 // |--|--|
1642 const Range& v,
1643 const Range& s,
1644 Index b,
1645 const Range& p,
1646 const Range& r,
1647 Index c);
1648 // -||---|
1650 Index v,
1651 Index s,
1652 const Range& b,
1653 const Range& p,
1654 const Range& r,
1655 Index c);
1656 // |-|---|
1658 const Range& v,
1659 Index s,
1660 const Range& b,
1661 const Range& p,
1662 const Range& r,
1663 Index c);
1664 // ||----|
1666 Index v,
1667 const Range& s,
1668 const Range& b,
1669 const Range& p,
1670 const Range& r,
1671 Index c);
1672 // ---|||-
1674 const Range& v,
1675 const Range& s,
1676 Index b,
1677 Index p,
1678 Index r,
1679 const Range& c);
1680 // --|-||-
1682 const Range& v,
1683 Index s,
1684 const Range& b,
1685 Index p,
1686 Index r,
1687 const Range& c);
1688 // -|--||-
1690 Index v,
1691 const Range& s,
1692 const Range& b,
1693 Index p,
1694 Index r,
1695 const Range& c);
1696 // |---||-
1698 const Range& v,
1699 const Range& s,
1700 const Range& b,
1701 Index p,
1702 Index r,
1703 const Range& c);
1704 // --||-|-
1706 const Range& v,
1707 Index s,
1708 Index b,
1709 const Range& p,
1710 Index r,
1711 const Range& c);
1712 // -|-|-|-
1714 Index v,
1715 const Range& s,
1716 Index b,
1717 const Range& p,
1718 Index r,
1719 const Range& c);
1720 // |--|-|-
1722 const Range& v,
1723 const Range& s,
1724 Index b,
1725 const Range& p,
1726 Index r,
1727 const Range& c);
1728 // -||--|-
1730 Index v,
1731 Index s,
1732 const Range& b,
1733 const Range& p,
1734 Index r,
1735 const Range& c);
1736 // |-|--|-
1738 const Range& v,
1739 Index s,
1740 const Range& b,
1741 const Range& p,
1742 Index r,
1743 const Range& c);
1744 // ||---|-
1746 Index v,
1747 const Range& s,
1748 const Range& b,
1749 const Range& p,
1750 Index r,
1751 const Range& c);
1752 // --|||--
1754 const Range& v,
1755 Index s,
1756 Index b,
1757 Index p,
1758 const Range& r,
1759 const Range& c);
1760 // -|-||--
1762 Index v,
1763 const Range& s,
1764 Index b,
1765 Index p,
1766 const Range& r,
1767 const Range& c);
1768 // |--||--
1770 const Range& v,
1771 const Range& s,
1772 Index b,
1773 Index p,
1774 const Range& r,
1775 const Range& c);
1776 // -||-|--
1778 Index v,
1779 Index s,
1780 const Range& b,
1781 Index p,
1782 const Range& r,
1783 const Range& c);
1784 // |-|-|--
1786 const Range& v,
1787 Index s,
1788 const Range& b,
1789 Index p,
1790 const Range& r,
1791 const Range& c);
1792 // ||--|--
1794 Index v,
1795 const Range& s,
1796 const Range& b,
1797 Index p,
1798 const Range& r,
1799 const Range& c);
1800 // -|||---
1802 Index v,
1803 Index s,
1804 Index b,
1805 const Range& p,
1806 const Range& r,
1807 const Range& c);
1808 // |-||---
1810 const Range& v,
1811 Index s,
1812 Index b,
1813 const Range& p,
1814 const Range& r,
1815 const Range& c);
1816 // ||-|---
1818 Index v,
1819 const Range& s,
1820 Index b,
1821 const Range& p,
1822 const Range& r,
1823 const Range& c);
1824 // |||----
1826 Index v,
1827 Index s,
1828 const Range& b,
1829 const Range& p,
1830 const Range& r,
1831 const Range& c);
1832
1833 // Result 3D (5+4+3+2+1 +4+3+2+1 +3+2+1 +2+1 +1 = 35 combinations)
1834 // ||||---
1836 Index v,
1837 Index s,
1838 Index b,
1839 const Range& p,
1840 const Range& r,
1841 const Range& c);
1842 // |||-|--
1844 Index v,
1845 Index s,
1846 const Range& b,
1847 Index p,
1848 const Range& r,
1849 const Range& c);
1850 // ||-||--
1852 Index v,
1853 const Range& s,
1854 Index b,
1855 Index p,
1856 const Range& r,
1857 const Range& c);
1858 // |-|||--
1860 const Range& v,
1861 Index s,
1862 Index b,
1863 Index p,
1864 const Range& r,
1865 const Range& c);
1866 // -||||--
1868 Index v,
1869 Index s,
1870 Index b,
1871 Index p,
1872 const Range& r,
1873 const Range& c);
1874 // |||--|-
1876 Index v,
1877 Index s,
1878 const Range& b,
1879 const Range& p,
1880 Index r,
1881 const Range& c);
1882 // ||-|-|-
1884 Index v,
1885 const Range& s,
1886 Index b,
1887 const Range& p,
1888 Index r,
1889 const Range& c);
1890 // |-||-|-
1892 const Range& v,
1893 Index s,
1894 Index b,
1895 const Range& p,
1896 Index r,
1897 const Range& c);
1898 // -|||-|-
1900 Index v,
1901 Index s,
1902 Index b,
1903 const Range& p,
1904 Index r,
1905 const Range& c);
1906 // ||--||-
1908 Index v,
1909 const Range& s,
1910 const Range& b,
1911 Index p,
1912 Index r,
1913 const Range& c);
1914 // |-|-||-
1916 const Range& v,
1917 Index s,
1918 const Range& b,
1919 Index p,
1920 Index r,
1921 const Range& c);
1922 // -||-||-
1924 Index v,
1925 Index s,
1926 const Range& b,
1927 Index p,
1928 Index r,
1929 const Range& c);
1930 // |--|||-
1932 const Range& v,
1933 const Range& s,
1934 Index b,
1935 Index p,
1936 Index r,
1937 const Range& c);
1938 // -|-|||-
1940 Index v,
1941 const Range& s,
1942 Index b,
1943 Index p,
1944 Index r,
1945 const Range& c);
1946 // --||||-
1948 const Range& v,
1949 Index s,
1950 Index b,
1951 Index p,
1952 Index r,
1953 const Range& c);
1954 // |||---|
1956 Index v,
1957 Index s,
1958 const Range& b,
1959 const Range& p,
1960 const Range& r,
1961 Index c);
1962 // ||-|--|
1964 Index v,
1965 const Range& s,
1966 Index b,
1967 const Range& p,
1968 const Range& r,
1969 Index c);
1970 // |-||--|
1972 const Range& v,
1973 Index s,
1974 Index b,
1975 const Range& p,
1976 const Range& r,
1977 Index c);
1978 // -|||--|
1980 Index v,
1981 Index s,
1982 Index b,
1983 const Range& p,
1984 const Range& r,
1985 Index c);
1986 // ||--|-|
1988 Index v,
1989 const Range& s,
1990 const Range& b,
1991 Index p,
1992 const Range& r,
1993 Index c);
1994 // |-|-|-|
1996 const Range& v,
1997 Index s,
1998 const Range& b,
1999 Index p,
2000 const Range& r,
2001 Index c);
2002 // -||-|-|
2004 Index v,
2005 Index s,
2006 const Range& b,
2007 Index p,
2008 const Range& r,
2009 Index c);
2010 // |--||-|
2012 const Range& v,
2013 const Range& s,
2014 Index b,
2015 Index p,
2016 const Range& r,
2017 Index c);
2018 // -|-||-|
2020 Index v,
2021 const Range& s,
2022 Index b,
2023 Index p,
2024 const Range& r,
2025 Index c);
2026 // --|||-|
2028 const Range& v,
2029 Index s,
2030 Index b,
2031 Index p,
2032 const Range& r,
2033 Index c);
2034 // ||---||
2036 Index v,
2037 const Range& s,
2038 const Range& b,
2039 const Range& p,
2040 Index r,
2041 Index c);
2042 // |-|--||
2044 const Range& v,
2045 Index s,
2046 const Range& b,
2047 const Range& p,
2048 Index r,
2049 Index c);
2050 // -||--||
2052 Index v,
2053 Index s,
2054 const Range& b,
2055 const Range& p,
2056 Index r,
2057 Index c);
2058 // |--|-||
2060 const Range& v,
2061 const Range& s,
2062 Index b,
2063 const Range& p,
2064 Index r,
2065 Index c);
2066 // -|-|-||
2068 Index v,
2069 const Range& s,
2070 Index b,
2071 const Range& p,
2072 Index r,
2073 Index c);
2074 // --||-||
2076 const Range& v,
2077 Index s,
2078 Index b,
2079 const Range& p,
2080 Index r,
2081 Index c);
2082 // |---|||
2084 const Range& v,
2085 const Range& s,
2086 const Range& b,
2087 Index p,
2088 Index r,
2089 Index c);
2090 // -|--|||
2092 Index v,
2093 const Range& s,
2094 const Range& b,
2095 Index p,
2096 Index r,
2097 Index c);
2098 // --|-|||
2100 const Range& v,
2101 Index s,
2102 const Range& b,
2103 Index p,
2104 Index r,
2105 Index c);
2106 // ---||||
2108 const Range& v,
2109 const Range& s,
2110 Index b,
2111 Index p,
2112 Index r,
2113 Index c);
2114
2115 // Result 2D (6+5+4+3+2+1 = 21 combinations)
2116 // |||||--
2118 Index v,
2119 Index s,
2120 Index b,
2121 Index p,
2122 const Range& r,
2123 const Range& c);
2124 // ||||-|-
2126 Index v,
2127 Index s,
2128 Index b,
2129 const Range& p,
2130 Index r,
2131 const Range& c);
2132 // |||-||-
2134 Index v,
2135 Index s,
2136 const Range& b,
2137 Index p,
2138 Index r,
2139 const Range& c);
2140 // ||-|||-
2142 Index v,
2143 const Range& s,
2144 Index b,
2145 Index p,
2146 Index r,
2147 const Range& c);
2148 // |-||||-
2150 const Range& v,
2151 Index s,
2152 Index b,
2153 Index p,
2154 Index r,
2155 const Range& c);
2156 // -|||||-
2158 Index v,
2159 Index s,
2160 Index b,
2161 Index p,
2162 Index r,
2163 const Range& c);
2164 // ||||--|
2166 Index v,
2167 Index s,
2168 Index b,
2169 const Range& p,
2170 const Range& r,
2171 Index c);
2172 // |||-|-|
2174 Index v,
2175 Index s,
2176 const Range& b,
2177 Index p,
2178 const Range& r,
2179 Index c);
2180 // ||-||-|
2182 Index v,
2183 const Range& s,
2184 Index b,
2185 Index p,
2186 const Range& r,
2187 Index c);
2188 // |-|||-|
2190 const Range& v,
2191 Index s,
2192 Index b,
2193 Index p,
2194 const Range& r,
2195 Index c);
2196 // -||||-|
2198 Index v,
2199 Index s,
2200 Index b,
2201 Index p,
2202 const Range& r,
2203 Index c);
2204 // |||--||
2206 Index v,
2207 Index s,
2208 const Range& b,
2209 const Range& p,
2210 Index r,
2211 Index c);
2212 // ||-|-||
2214 Index v,
2215 const Range& s,
2216 Index b,
2217 const Range& p,
2218 Index r,
2219 Index c);
2220 // |-||-||
2222 const Range& v,
2223 Index s,
2224 Index b,
2225 const Range& p,
2226 Index r,
2227 Index c);
2228 // -|||-||
2230 Index v,
2231 Index s,
2232 Index b,
2233 const Range& p,
2234 Index r,
2235 Index c);
2236 // ||--|||
2238 Index v,
2239 const Range& s,
2240 const Range& b,
2241 Index p,
2242 Index r,
2243 Index c);
2244 // |-|-|||
2246 const Range& v,
2247 Index s,
2248 const Range& b,
2249 Index p,
2250 Index r,
2251 Index c);
2252 // -||-|||
2254 Index v,
2255 Index s,
2256 const Range& b,
2257 Index p,
2258 Index r,
2259 Index c);
2260 // |--||||
2262 const Range& v,
2263 const Range& s,
2264 Index b,
2265 Index p,
2266 Index r,
2267 Index c);
2268 // -|-||||
2270 Index v,
2271 const Range& s,
2272 Index b,
2273 Index p,
2274 Index r,
2275 Index c);
2276 // --|||||
2278 const Range& v,
2279 Index s,
2280 Index b,
2281 Index p,
2282 Index r,
2283 Index c);
2284
2285 // Result 1D (7 combinations)
2286 // ||||||-
2288 Index l, Index v, Index s, Index b, Index p, Index r, const Range& c);
2289 // |||||-|
2291 Index l, Index v, Index s, Index b, Index p, const Range& r, Index c);
2292 // ||||-||
2294 Index l, Index v, Index s, Index b, const Range& p, Index r, Index c);
2295 // |||-|||
2297 Index l, Index v, Index s, const Range& b, Index p, Index r, Index c);
2298 // ||-||||
2300 Index l, Index v, const Range& s, Index b, Index p, Index r, Index c);
2301 // |-|||||
2303 Index l, const Range& v, Index s, Index b, Index p, Index r, Index c);
2304 // -||||||
2306 const Range& l, Index v, Index s, Index b, Index p, Index r, Index c);
2307
2308 // Result scalar (1 combination)
2309 // |||||||
2311 Index l, Index v, Index s, Index b, Index p, Index r, Index c) {
2312 CHECK(l);
2313 CHECK(v);
2314 CHECK(s);
2315 CHECK(b);
2316 CHECK(p);
2317 CHECK(r);
2318 CHECK(c);
2319 return get(l, v, s, b, p, r, c);
2320 }
2321
2324 return *(mdata + OFFSET(l) + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) +
2325 OFFSET(r) + OFFSET(c));
2326 }
2327
2328 // Conversion to a plain C-array
2329 [[nodiscard]] const Numeric* get_c_array() const ARTS_NOEXCEPT;
2331
2332 // Functions returning iterators:
2333 Iterator7D begin();
2334 Iterator7D end();
2335
2336 // Assignment operators:
2337 Tensor7View& operator=(const ConstTensor7View& v);
2338 Tensor7View& operator=(const Tensor7View& v);
2339 Tensor7View& operator=(const Tensor7& v);
2340 Tensor7View& operator=(Numeric x);
2341
2342 // Other operators:
2343 Tensor7View& operator*=(Numeric x);
2344 Tensor7View& operator/=(Numeric x);
2345 Tensor7View& operator+=(Numeric x);
2346 Tensor7View& operator-=(Numeric x);
2347
2348 Tensor7View& operator*=(const ConstTensor7View& x);
2349 Tensor7View& operator/=(const ConstTensor7View& x);
2350 Tensor7View& operator+=(const ConstTensor7View& x);
2351 Tensor7View& operator-=(const ConstTensor7View& x);
2352
2354 virtual ~Tensor7View() = default;
2355
2356 // Friends:
2357
2358 // Special constructor to make a Tensor7 view of a Tensor6.
2359 Tensor7View(const Tensor6View& a);
2360
2361 protected:
2362 // Constructors:
2363 Tensor7View() = default;
2364 Tensor7View(Numeric* data,
2365 const Range& l,
2366 const Range& v,
2367 const Range& s,
2368 const Range& b,
2369 const Range& p,
2370 const Range& r,
2371 const Range& c);
2372 Tensor7View(Numeric* data,
2373 const Range& pl,
2374 const Range& pv,
2375 const Range& ps,
2376 const Range& pb,
2377 const Range& pp,
2378 const Range& pr,
2379 const Range& pc,
2380 const Range& nl,
2381 const Range& nv,
2382 const Range& ns,
2383 const Range& nb,
2384 const Range& np,
2385 const Range& nr,
2386 const Range& nc);
2387};
2388
2397class Tensor7 : public Tensor7View {
2398 public:
2399 // Constructors:
2400 Tensor7() = default;
2401 Tensor7(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2402 Tensor7(Index l,
2403 Index v,
2404 Index s,
2405 Index b,
2406 Index p,
2407 Index r,
2408 Index c,
2409 Numeric fill);
2410 Tensor7(const ConstTensor7View& v);
2411 Tensor7(const Tensor7& v);
2412 Tensor7(Tensor7&& v) noexcept : Tensor7View(std::forward<Tensor7View>(v)) {
2413 v.mdata = nullptr;
2414 }
2415
2416 // Assignment operators:
2417 Tensor7& operator=(const Tensor7& x);
2418 Tensor7& operator=(Tensor7&& x) noexcept;
2420
2421 // Resize function:
2422 void resize(Index l, Index v, Index s, Index b, Index p, Index r, Index c);
2423
2424 // Swap function:
2425 friend void swap(Tensor7& t1, Tensor7& t2);
2426
2427 // Destructor:
2428 virtual ~Tensor7();
2429
2431 template <std::size_t dim0>
2433 static_assert(dim0 < 7, "Bad Dimension, Out-of-Bounds");
2434
2435 Range r0(0,
2436 dim0 == 0 ? nlibraries()
2437 : dim0 == 1 ? nvitrines()
2438 : dim0 == 2 ? nshelves()
2439 : dim0 == 3 ? nbooks()
2440 : dim0 == 4 ? npages()
2441 : dim0 == 5 ? nrows()
2442 : ncols());
2443
2444 Vector out(mdata, r0);
2445 ARTS_ASSERT(size() not_eq out.size(),
2446 "Can only reduce size on same size input");
2447 mdata = nullptr;
2448 return out;
2449 }
2450
2452 template <std::size_t dim0, std::size_t dim1>
2454 static_assert(dim1 < 7, "Bad Dimension, Out-of-Bounds");
2455 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2456
2457 const Range r1(0,
2458 dim1 == 1 ? nvitrines()
2459 : dim1 == 2 ? nshelves()
2460 : dim1 == 3 ? nbooks()
2461 : dim1 == 4 ? npages()
2462 : dim1 == 5 ? nrows()
2463 : ncols());
2464 const Range r0(0,
2465 dim0 == 0 ? nlibraries()
2466 : dim0 == 1 ? nvitrines()
2467 : dim0 == 2 ? nshelves()
2468 : dim0 == 3 ? nbooks()
2469 : dim0 == 4 ? npages()
2470 : nrows(),
2471 r1.get_extent());
2472
2473 Matrix out(mdata, r0, r1);
2474 ARTS_ASSERT(size() not_eq out.size(),
2475 "Can only reduce size on same size input");
2476 mdata = nullptr;
2477 return out;
2478 }
2479
2481 template <std::size_t dim0, std::size_t dim1, std::size_t dim2>
2483 static_assert(dim2 < 7, "Bad Dimension, Out-of-Bounds");
2484 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2485 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2486
2487 const Range r2(0,
2488 dim2 == 2 ? nshelves()
2489 : dim2 == 3 ? nbooks()
2490 : dim2 == 4 ? npages()
2491 : dim2 == 5 ? nrows()
2492 : ncols());
2493 const Range r1(0,
2494 dim1 == 1 ? nvitrines()
2495 : dim1 == 2 ? nshelves()
2496 : dim1 == 3 ? nbooks()
2497 : dim1 == 4 ? npages()
2498 : nrows(),
2499 r2.get_extent());
2500 const Range r0(0,
2501 dim0 == 0 ? nlibraries()
2502 : dim0 == 1 ? nvitrines()
2503 : dim0 == 2 ? nshelves()
2504 : dim0 == 3 ? nbooks()
2505 : npages(),
2506 r1.get_extent() * r2.get_extent());
2507
2508 Tensor3 out(mdata, r0, r1, r2);
2509 ARTS_ASSERT(size() not_eq out.size(),
2510 "Can only reduce size on same size input");
2511 mdata = nullptr;
2512 return out;
2513 }
2514
2516 template <std::size_t dim0,
2517 std::size_t dim1,
2518 std::size_t dim2,
2519 std::size_t dim3>
2521 static_assert(dim3 < 7, "Bad Dimension, Out-of-Bounds");
2522 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2523 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2524 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2525
2526 const Range r3(0,
2527 dim3 == 3 ? nbooks()
2528 : dim3 == 4 ? npages()
2529 : dim3 == 5 ? nrows()
2530 : ncols());
2531 const Range r2(0,
2532 dim2 == 2 ? nshelves()
2533 : dim2 == 3 ? nbooks()
2534 : dim2 == 4 ? npages()
2535 : nrows(),
2536 r3.get_extent());
2537 const Range r1(0,
2538 dim1 == 1 ? nvitrines()
2539 : dim1 == 2 ? nshelves()
2540 : dim1 == 3 ? nbooks()
2541 : npages(),
2542 r2.get_extent() * r3.get_extent());
2543 const Range r0(0,
2544 dim0 == 0 ? nlibraries()
2545 : dim0 == 1 ? nvitrines()
2546 : dim0 == 2 ? nshelves()
2547 : nbooks(),
2548 r1.get_extent() * r2.get_extent() * r3.get_extent());
2549
2550 Tensor4 out(mdata, r0, r1, r2, r3);
2551 ARTS_ASSERT(size() not_eq out.size(),
2552 "Can only reduce size on same size input");
2553 mdata = nullptr;
2554 return out;
2555 }
2556
2558 template <std::size_t dim0,
2559 std::size_t dim1,
2560 std::size_t dim2,
2561 std::size_t dim3,
2562 std::size_t dim4>
2564 static_assert(dim4 < 7, "Bad Dimension, Out-of-Bounds");
2565 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2566 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2567 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2568 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2569
2570 const Range r4(0, dim4 == 4 ? npages() : dim4 == 5 ? nrows() : ncols());
2571 const Range r3(0,
2572 dim3 == 3 ? nbooks()
2573 : dim3 == 4 ? npages()
2574 : nrows(),
2575 r4.get_extent());
2576 const Range r2(0,
2577 dim2 == 2 ? nshelves()
2578 : dim2 == 3 ? nbooks()
2579 : npages(),
2580 r3.get_extent() * r4.get_extent());
2581 const Range r1(0,
2582 dim1 == 1 ? nvitrines()
2583 : dim1 == 2 ? nshelves()
2584 : nbooks(),
2585 r2.get_extent() * r3.get_extent() * r4.get_extent());
2586 const Range r0(
2587 0,
2588 dim0 == 0 ? nlibraries()
2589 : dim0 == 1 ? nvitrines()
2590 : nshelves(),
2591 r1.get_extent() * r2.get_extent() * r3.get_extent() * r4.get_extent());
2592
2593 Tensor5 out(mdata, r0, r1, r2, r3, r4);
2594 ARTS_ASSERT(size() not_eq out.size(),
2595 "Can only reduce size on same size input");
2596 mdata = nullptr;
2597 return out;
2598 }
2599
2601 template <std::size_t dim0,
2602 std::size_t dim1,
2603 std::size_t dim2,
2604 std::size_t dim3,
2605 std::size_t dim4,
2606 std::size_t dim5>
2608 static_assert(dim5 < 7, "Bad Dimension, Out-of-Bounds");
2609 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
2610 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
2611 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
2612 static_assert(dim3 < dim4, "Bad Dimensions, dim4 must be larger than dim3");
2613 static_assert(dim4 < dim5, "Bad Dimensions, dim5 must be larger than dim4");
2614
2615 const Range r5(0, dim5 == 5 ? nrows() : ncols());
2616 const Range r4(0, dim4 == 4 ? npages() : nrows(), r5.get_extent());
2617 const Range r3(
2618 0, dim3 == 3 ? nbooks() : npages(), r4.get_extent() * r5.get_extent());
2619 const Range r2(0,
2620 dim2 == 2 ? nshelves() : nbooks(),
2621 r3.get_extent() * r4.get_extent() * r5.get_extent());
2622 const Range r1(
2623 0,
2624 dim1 == 1 ? nvitrines() : nshelves(),
2625 r2.get_extent() * r3.get_extent() * r4.get_extent() * r5.get_extent());
2626 const Range r0(0,
2627 dim0 == 0 ? nlibraries() : nvitrines(),
2628 r1.get_extent() * r2.get_extent() * r3.get_extent() *
2629 r4.get_extent() * r5.get_extent());
2630
2631 Tensor6 out(mdata, r0, r1, r2, r3, r4, r5);
2632 ARTS_ASSERT(size() not_eq out.size(),
2633 "Can only reduce size on same size input");
2634 mdata = nullptr;
2635 return out;
2636 }
2637
2638 template <class F>
2639 void transform_elementwise(F&& func) {
2640 std::transform(mdata, mdata + size(), mdata, func);
2641 }
2642};
2643
2644// Function declarations:
2645// ----------------------
2646
2647void copy(ConstIterator7D origin,
2648 const ConstIterator7D& end,
2649 Iterator7D target);
2650
2651void copy(Numeric x, Iterator7D target, const Iterator7D& end);
2652
2653void transform(Tensor7View y, double (&my_func)(double), ConstTensor7View x);
2654
2655Numeric max(const ConstTensor7View& x);
2656
2657Numeric min(const ConstTensor7View& x);
2658
2659std::ostream& operator<<(std::ostream& os, const ConstTensor7View& v);
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
2677#endif // matpackVII_h
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:1050
Index size() const noexcept
Definition: matpackI.h:1065
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:606
Range mcr
The column range of mdata that is actually used.
Definition: matpackVI.h:616
Range mbr
The book range of mdata that is actually used.
Definition: matpackVI.h:610
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVI.h:618
Range mrr
The row range of mdata that is actually used.
Definition: matpackVI.h:614
Index size() const noexcept
Definition: matpackVI.h:163
Range mpr
The page range of mdata that is actually used.
Definition: matpackVI.h:612
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVI.h:608
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:1285
Range mcr
The column range of mdata that is actually used.
Definition: matpackVII.h:1287
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:1281
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVII.h:1277
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:1283
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:1275
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:1289
ConstTensor7View & operator=(ConstTensor7View &&)=default
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:1279
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:517
Index size() const noexcept
Definition: matpackI.h:544
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:1169
The Matrix class.
Definition: matpackI.h:1270
The range class.
Definition: matpackI.h:166
Index mstart
The start index.
Definition: matpackI.h:368
constexpr Index get_extent() const noexcept
Returns the extent of the range.
Definition: matpackI.h:349
Index mextent
The number of elements.
Definition: matpackI.h:375
The Tensor3View class.
Definition: matpackIII.h:244
The Tensor3 class.
Definition: matpackIII.h:344
The Tensor4View class.
Definition: matpackIV.h:290
The Tensor4 class.
Definition: matpackIV.h:427
The Tensor5View class.
Definition: matpackV.h:341
The Tensor5 class.
Definition: matpackV.h:514
The Tensor6View class.
Definition: matpackVI.h:630
The Tensor6 class.
Definition: matpackVI.h:1097
The Tensor7View class.
Definition: matpackVII.h:1301
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:2323
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:2310
Iterator7D begin()
Return iterator to first sub-tensor.
Definition: matpackVII.cc:5037
constexpr Tensor7View(const Tensor7View &)=default
The Tensor7 class.
Definition: matpackVII.h:2397
Tensor3 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2482
Tensor4 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2520
Matrix reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2453
Tensor7()=default
Tensor6 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2607
void transform_elementwise(F &&func)
Definition: matpackVII.h:2639
Tensor7(Tensor7 &&v) noexcept
Definition: matpackVII.h:2412
Vector reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2432
Tensor5 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackVII.h:2563
The VectorView class.
Definition: matpackI.h:658
The Vector class.
Definition: matpackI.h:908
#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
std::ostream & operator<<(std::ostream &os, const ConstTensor7View &v)
Output operator.
Definition: matpackVII.cc:2542
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
#define v
#define a
#define c
#define b
Helper shape class.
Definition: matpackI.h:382