ARTS  2.4.0(git:4fb77825)
matpackVI.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2012 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
28 #ifndef matpackVI_h
29 #define matpackVI_h
30 
31 #include "matpackV.h"
32 
33 #define CHECK(x) \
34  assert(0 <= x); \
35  assert(x < m##x##r.mextent)
36 #define OFFSET(x) m##x##r.mstart + x* m##x##r.mstride
37 
40 class Iterator6D {
41  public:
42  // Constructors:
44  Iterator6D() = default;
45 
47  Iterator6D(const Tensor5View& x, Index stride)
48  : msv(x), mstride(stride) { /* Nothing to do here. */
49  }
50 
51  // Operators:
54  msv.mdata += mstride;
55  return *this;
56  }
57 
62  bool operator!=(const Iterator6D& other) const {
64  msv.mrr.mstart + msv.mcr.mstart !=
65  other.msv.mdata + other.msv.msr.mstart + other.msv.mbr.mstart +
66  other.msv.mpr.mstart + other.msv.mrr.mstart + other.msv.mcr.mstart)
67  return true;
68  else
69  return false;
70  }
71 
74  Tensor5View* operator->() { return &msv; }
75 
77  Tensor5View& operator*() { return msv; }
78 
79  private:
84 };
85 
88  public:
89  // Constructors:
91  ConstIterator6D() = default;
92 
95  : msv(x), mstride(stride) { /* Nothing to do here. */
96  }
97 
98  // Operators:
101  msv.mdata += mstride;
102  return *this;
103  }
104 
109  bool operator!=(const ConstIterator6D& other) const {
111  msv.mrr.mstart + msv.mcr.mstart !=
112  other.msv.mdata + other.msv.msr.mstart + other.msv.mbr.mstart +
113  other.msv.mpr.mstart + other.msv.mrr.mstart + other.msv.mcr.mstart)
114  return true;
115  else
116  return false;
117  }
118 
121  const ConstTensor5View* operator->() const { return &msv; }
122 
124  const ConstTensor5View& operator*() const { return msv; }
125 
126  private:
131 };
132 
133 // Declare class Tensor6:
134 class Tensor6;
135 
150  public:
151  constexpr ConstTensor6View(const ConstTensor6View&) = default;
152  constexpr ConstTensor6View(ConstTensor6View&&) = default;
155 
156  // Member functions:
157  bool empty() const;
158  Index nvitrines() const;
159  Index nshelves() const;
160  Index nbooks() const;
161  Index npages() const;
162  Index nrows() const;
163  Index ncols() const;
164 
165  // Const index operators:
166 
167  // Result 6D (1 combination)
168  // ------
170  const Range& s,
171  const Range& b,
172  const Range& p,
173  const Range& r,
174  const Range& c) const;
175 
176  // Result 5D (6 combinations)
177  // -----|
179  const Range& s,
180  const Range& b,
181  const Range& p,
182  const Range& r,
183  Index c) const;
184  // ----|-
186  const Range& s,
187  const Range& b,
188  const Range& p,
189  Index r,
190  const Range& c) const;
191  // ---|--
193  const Range& s,
194  const Range& b,
195  Index p,
196  const Range& r,
197  const Range& c) const;
198  // --|---
200  const Range& s,
201  Index b,
202  const Range& p,
203  const Range& r,
204  const Range& c) const;
205  // -|----
207  Index s,
208  const Range& b,
209  const Range& p,
210  const Range& r,
211  const Range& c) const;
212  // |-----
214  const Range& s,
215  const Range& b,
216  const Range& p,
217  const Range& r,
218  const Range& c) const;
219 
220  // Result 4D (5+4+3+2+1 = 15 combinations)
221  // ----||
223  const Range& s,
224  const Range& b,
225  const Range& p,
226  Index r,
227  Index c) const;
228  // ---|-|
230  const Range& s,
231  const Range& b,
232  Index p,
233  const Range& r,
234  Index c) const;
235  // --|--|
237  const Range& s,
238  Index b,
239  const Range& p,
240  const Range& r,
241  Index c) const;
242  // -|---|
244  Index s,
245  const Range& b,
246  const Range& p,
247  const Range& r,
248  Index c) const;
249  // |----|
251  const Range& s,
252  const Range& b,
253  const Range& p,
254  const Range& r,
255  Index c) const;
256  // ---||-
258  const Range& s,
259  const Range& b,
260  Index p,
261  Index r,
262  const Range& c) const;
263  // --|-|-
265  const Range& s,
266  Index b,
267  const Range& p,
268  Index r,
269  const Range& c) const;
270  // -|--|-
272  Index s,
273  const Range& b,
274  const Range& p,
275  Index r,
276  const Range& c) const;
277  // |---|-
279  const Range& s,
280  const Range& b,
281  const Range& p,
282  Index r,
283  const Range& c) const;
284  // --||--
286  const Range& s,
287  Index b,
288  Index p,
289  const Range& r,
290  const Range& c) const;
291  // -|-|--
293  Index s,
294  const Range& b,
295  Index p,
296  const Range& r,
297  const Range& c) const;
298  // |--|--
300  const Range& s,
301  const Range& b,
302  Index p,
303  const Range& r,
304  const Range& c) const;
305  // -||---
307  Index s,
308  Index b,
309  const Range& p,
310  const Range& r,
311  const Range& c) const;
312  // |-|---
314  const Range& s,
315  Index b,
316  const Range& p,
317  const Range& r,
318  const Range& c) const;
319  // ||----
321  Index s,
322  const Range& b,
323  const Range& p,
324  const Range& r,
325  const Range& c) const;
326 
327  // Result 3D (4+3+2+1+ 3+2+1+ 2+1 +1 = 20 combinations)
328  // ---|||
330  const Range& s,
331  const Range& b,
332  Index p,
333  Index r,
334  Index c) const;
335  // --|-||
337  const Range& s,
338  Index b,
339  const Range& p,
340  Index r,
341  Index c) const;
342  // -|--||
344  Index s,
345  const Range& b,
346  const Range& p,
347  Index r,
348  Index c) const;
349  // |---||
351  const Range& s,
352  const Range& b,
353  const Range& p,
354  Index r,
355  Index c) const;
356  // --||-|
358  const Range& s,
359  Index b,
360  Index p,
361  const Range& r,
362  Index c) const;
363  // -|-|-|
365  Index s,
366  const Range& b,
367  Index p,
368  const Range& r,
369  Index c) const;
370  // |--|-|
372  const Range& s,
373  const Range& b,
374  Index p,
375  const Range& r,
376  Index c) const;
377  // -||--|
379  Index s,
380  Index b,
381  const Range& p,
382  const Range& r,
383  Index c) const;
384  // |-|--|
386  const Range& s,
387  Index b,
388  const Range& p,
389  const Range& r,
390  Index c) const;
391  // ||---|
393  Index s,
394  const Range& b,
395  const Range& p,
396  const Range& r,
397  Index c) const;
398  // --|||-
400  const Range& s,
401  Index b,
402  Index p,
403  Index r,
404  const Range& c) const;
405  // -|-||-
407  Index s,
408  const Range& b,
409  Index p,
410  Index r,
411  const Range& c) const;
412  // |--||-
414  const Range& s,
415  const Range& b,
416  Index p,
417  Index r,
418  const Range& c) const;
419  // -||-|-
421  Index s,
422  Index b,
423  const Range& p,
424  Index r,
425  const Range& c) const;
426  // |-|-|-
428  const Range& s,
429  Index b,
430  const Range& p,
431  Index r,
432  const Range& c) const;
433  // ||--|-
435  Index s,
436  const Range& b,
437  const Range& p,
438  Index r,
439  const Range& c) const;
440  // -|||--
442  Index s,
443  Index b,
444  Index p,
445  const Range& r,
446  const Range& c) const;
447  // |-||--
449  const Range& s,
450  Index b,
451  Index p,
452  const Range& r,
453  const Range& c) const;
454  // ||-|--
456  Index s,
457  const Range& b,
458  Index p,
459  const Range& r,
460  const Range& c) const;
461  // |||---
463  Index s,
464  Index b,
465  const Range& p,
466  const Range& r,
467  const Range& c) const;
468 
469  // Result 2D (15 combinations)
470  // IIII--
472  Index v, Index s, Index b, Index p, const Range& r, const Range& c) const;
473  // III-I-
475  Index v, Index s, Index b, const Range& p, Index r, const Range& c) const;
476  // II-II-
478  Index v, Index s, const Range& b, Index p, Index r, const Range& c) const;
479  // I-III-
481  Index v, const Range& s, Index b, Index p, Index r, const Range& c) const;
482  // -IIII-
484  const Range& v, Index s, Index b, Index p, Index r, const Range& c) const;
485  // III--I
487  Index v, Index s, Index b, const Range& p, const Range& r, Index c) const;
488  // II-I-I
490  Index v, Index s, const Range& b, Index p, const Range& r, Index c) const;
491  // I-II-I
493  Index v, const Range& s, Index b, Index p, const Range& r, Index c) const;
494  // -III-I
496  const Range& v, Index s, Index b, Index p, const Range& r, Index c) const;
497  // II--II
499  Index v, Index s, const Range& b, const Range& p, Index r, Index c) const;
500  // I-I-II
502  Index v, const Range& s, Index b, const Range& p, Index r, Index c) const;
503  // -II-II
505  const Range& v, Index s, Index b, const Range& p, Index r, Index c) const;
506  // I--III
508  Index v, const Range& s, const Range& b, Index p, Index r, Index c) const;
509  // -I-III
511  const Range& v, Index s, const Range& b, Index p, Index r, Index c) const;
512  // --IIII
514  const Range& v, const Range& s, Index b, Index p, Index r, Index c) const;
515 
516  // Result 1D (6 combinations)
517  // IIIII-
519  Index v, Index s, Index b, Index p, Index r, const Range& c) const;
520  // IIII-I
522  Index v, Index s, Index b, Index p, const Range& r, Index c) const;
523  // III-II
525  Index v, Index s, Index b, const Range& p, Index r, Index c) const;
526  // II-III
528  Index v, Index s, const Range& b, Index p, Index r, Index c) const;
529  // I-IIII
531  Index v, const Range& s, Index b, Index p, Index r, Index c) const;
532  // -IIIII
534  const Range& v, Index s, Index b, Index p, Index r, Index c) const;
535 
536  // Result scalar (1 combination)
537  // IIIIII
539  Index v, Index s, Index b, Index p, Index r, Index c) const {
540  CHECK(v);
541  CHECK(s);
542  CHECK(b);
543  CHECK(p);
544  CHECK(r);
545  CHECK(c);
546  return get(v, s, b, p, r, c);
547  }
548 
550  Numeric get(Index v, Index s, Index b, Index p, Index r, Index c) const {
551  return *(mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r) +
552  OFFSET(c));
553  }
554 
555  // Functions returning iterators:
556  ConstIterator6D begin() const;
557  ConstIterator6D end() const;
558 
559  // Destructor:
560  virtual ~ConstTensor6View() = default;
561 
562  // Friends:
563  friend class ConstIterator7D;
564  friend class Tensor6View;
565  friend class ConstTensor7View;
566 
567  // Special constructor to make a Tensor6 view of a Tensor5.
569 
570  protected:
571  // Constructors:
572  ConstTensor6View() = default;
574  const Range& v,
575  const Range& s,
576  const Range& b,
577  const Range& p,
578  const Range& r,
579  const Range& c);
581  const Range& pv,
582  const Range& ps,
583  const Range& pb,
584  const Range& pp,
585  const Range& pr,
586  const Range& pc,
587  const Range& nv,
588  const Range& ns,
589  const Range& nb,
590  const Range& np,
591  const Range& nr,
592  const Range& nc);
593 
594  // Data members:
595  // -------------
597  Range mvr{0, 0, 1};
599  Range msr{0, 0, 1};
601  Range mbr{0, 0, 1};
603  Range mpr{0, 0, 1};
605  Range mrr{0, 0, 1};
607  Range mcr{0, 0, 1};
609  Numeric* mdata{nullptr};
610 };
611 
622  public:
623  // Make const methods visible from base class
625  using ConstTensor6View::end;
626  using ConstTensor6View::operator();
627  using ConstTensor6View::get;
628 
629  constexpr Tensor6View(const Tensor6View&) = default;
630 
631  // Non-const index operators:
632 
633  // Result 6D (1 combination)
634  // ------
635  Tensor6View operator()(const Range& v,
636  const Range& s,
637  const Range& b,
638  const Range& p,
639  const Range& r,
640  const Range& c);
641 
642  // Result 5D (6 combinations)
643  // -----|
644  Tensor5View operator()(const Range& v,
645  const Range& s,
646  const Range& b,
647  const Range& p,
648  const Range& r,
649  Index c);
650  // ----|-
651  Tensor5View operator()(const Range& v,
652  const Range& s,
653  const Range& b,
654  const Range& p,
655  Index r,
656  const Range& c);
657  // ---|--
658  Tensor5View operator()(const Range& v,
659  const Range& s,
660  const Range& b,
661  Index p,
662  const Range& r,
663  const Range& c);
664  // --|---
665  Tensor5View operator()(const Range& v,
666  const Range& s,
667  Index b,
668  const Range& p,
669  const Range& r,
670  const Range& c);
671  // -|----
672  Tensor5View operator()(const Range& v,
673  Index s,
674  const Range& b,
675  const Range& p,
676  const Range& r,
677  const Range& c);
678  // |-----
680  const Range& s,
681  const Range& b,
682  const Range& p,
683  const Range& r,
684  const Range& c);
685 
686  // Result 4D (5+4+3+2+1 = 15 combinations)
687  // ----||
688  Tensor4View operator()(const Range& v,
689  const Range& s,
690  const Range& b,
691  const Range& p,
692  Index r,
693  Index c);
694  // ---|-|
695  Tensor4View operator()(const Range& v,
696  const Range& s,
697  const Range& b,
698  Index p,
699  const Range& r,
700  Index c);
701  // --|--|
702  Tensor4View operator()(const Range& v,
703  const Range& s,
704  Index b,
705  const Range& p,
706  const Range& r,
707  Index c);
708  // -|---|
709  Tensor4View operator()(const Range& v,
710  Index s,
711  const Range& b,
712  const Range& p,
713  const Range& r,
714  Index c);
715  // |----|
717  const Range& s,
718  const Range& b,
719  const Range& p,
720  const Range& r,
721  Index c);
722  // ---||-
723  Tensor4View operator()(const Range& v,
724  const Range& s,
725  const Range& b,
726  Index p,
727  Index r,
728  const Range& c);
729  // --|-|-
730  Tensor4View operator()(const Range& v,
731  const Range& s,
732  Index b,
733  const Range& p,
734  Index r,
735  const Range& c);
736  // -|--|-
737  Tensor4View operator()(const Range& v,
738  Index s,
739  const Range& b,
740  const Range& p,
741  Index r,
742  const Range& c);
743  // |---|-
745  const Range& s,
746  const Range& b,
747  const Range& p,
748  Index r,
749  const Range& c);
750  // --||--
751  Tensor4View operator()(const Range& v,
752  const Range& s,
753  Index b,
754  Index p,
755  const Range& r,
756  const Range& c);
757  // -|-|--
758  Tensor4View operator()(const Range& v,
759  Index s,
760  const Range& b,
761  Index p,
762  const Range& r,
763  const Range& c);
764  // |--|--
766  const Range& s,
767  const Range& b,
768  Index p,
769  const Range& r,
770  const Range& c);
771  // -||---
772  Tensor4View operator()(const Range& v,
773  Index s,
774  Index b,
775  const Range& p,
776  const Range& r,
777  const Range& c);
778  // |-|---
780  const Range& s,
781  Index b,
782  const Range& p,
783  const Range& r,
784  const Range& c);
785  // ||----
787  Index s,
788  const Range& b,
789  const Range& p,
790  const Range& r,
791  const Range& c);
792 
793  // Result 3D (4+3+2+1+ 3+2+1+ 2+1 +1 = 20 combinations)
794  // ---|||
795  Tensor3View operator()(const Range& v,
796  const Range& s,
797  const Range& b,
798  Index p,
799  Index r,
800  Index c);
801  // --|-||
802  Tensor3View operator()(const Range& v,
803  const Range& s,
804  Index b,
805  const Range& p,
806  Index r,
807  Index c);
808  // -|--||
809  Tensor3View operator()(const Range& v,
810  Index s,
811  const Range& b,
812  const Range& p,
813  Index r,
814  Index c);
815  // |---||
817  const Range& s,
818  const Range& b,
819  const Range& p,
820  Index r,
821  Index c);
822  // --||-|
823  Tensor3View operator()(const Range& v,
824  const Range& s,
825  Index b,
826  Index p,
827  const Range& r,
828  Index c);
829  // -|-|-|
830  Tensor3View operator()(const Range& v,
831  Index s,
832  const Range& b,
833  Index p,
834  const Range& r,
835  Index c);
836  // |--|-|
838  const Range& s,
839  const Range& b,
840  Index p,
841  const Range& r,
842  Index c);
843  // -||--|
844  Tensor3View operator()(const Range& v,
845  Index s,
846  Index b,
847  const Range& p,
848  const Range& r,
849  Index c);
850  // |-|--|
852  const Range& s,
853  Index b,
854  const Range& p,
855  const Range& r,
856  Index c);
857  // ||---|
859  Index s,
860  const Range& b,
861  const Range& p,
862  const Range& r,
863  Index c);
864  // --|||-
865  Tensor3View operator()(const Range& v,
866  const Range& s,
867  Index b,
868  Index p,
869  Index r,
870  const Range& c);
871  // -|-||-
872  Tensor3View operator()(const Range& v,
873  Index s,
874  const Range& b,
875  Index p,
876  Index r,
877  const Range& c);
878  // |--||-
880  const Range& s,
881  const Range& b,
882  Index p,
883  Index r,
884  const Range& c);
885  // -||-|-
886  Tensor3View operator()(const Range& v,
887  Index s,
888  Index b,
889  const Range& p,
890  Index r,
891  const Range& c);
892  // |-|-|-
894  const Range& s,
895  Index b,
896  const Range& p,
897  Index r,
898  const Range& c);
899  // ||--|-
901  Index s,
902  const Range& b,
903  const Range& p,
904  Index r,
905  const Range& c);
906  // -|||--
907  Tensor3View operator()(const Range& v,
908  Index s,
909  Index b,
910  Index p,
911  const Range& r,
912  const Range& c);
913  // |-||--
915  const Range& s,
916  Index b,
917  Index p,
918  const Range& r,
919  const Range& c);
920  // ||-|--
922  Index s,
923  const Range& b,
924  Index p,
925  const Range& r,
926  const Range& c);
927  // |||---
929  Index s,
930  Index b,
931  const Range& p,
932  const Range& r,
933  const Range& c);
934 
935  // Result 2D (15 combinations)
936  // IIII--
938  Index v, Index s, Index b, Index p, const Range& r, const Range& c);
939  // III-I-
941  Index v, Index s, Index b, const Range& p, Index r, const Range& c);
942  // II-II-
944  Index v, Index s, const Range& b, Index p, Index r, const Range& c);
945  // I-III-
947  Index v, const Range& s, Index b, Index p, Index r, const Range& c);
948  // -IIII-
950  const Range& v, Index s, Index b, Index p, Index r, const Range& c);
951  // III--I
953  Index v, Index s, Index b, const Range& p, const Range& r, Index c);
954  // II-I-I
956  Index v, Index s, const Range& b, Index p, const Range& r, Index c);
957  // I-II-I
959  Index v, const Range& s, Index b, Index p, const Range& r, Index c);
960  // -III-I
962  const Range& v, Index s, Index b, Index p, const Range& r, Index c);
963  // II--II
965  Index v, Index s, const Range& b, const Range& p, Index r, Index c);
966  // I-I-II
968  Index v, const Range& s, Index b, const Range& p, Index r, Index c);
969  // -II-II
971  const Range& v, Index s, Index b, const Range& p, Index r, Index c);
972  // I--III
974  Index v, const Range& s, const Range& b, Index p, Index r, Index c);
975  // -I-III
977  const Range& v, Index s, const Range& b, Index p, Index r, Index c);
978  // --IIII
980  const Range& v, const Range& s, Index b, Index p, Index r, Index c);
981 
982  // Result 1D (6 combinations)
983  // IIIII-
985  Index v, Index s, Index b, Index p, Index r, const Range& c);
986  // IIII-I
988  Index v, Index s, Index b, Index p, const Range& r, Index c);
989  // III-II
991  Index v, Index s, Index b, const Range& p, Index r, Index c);
992  // II-III
994  Index v, Index s, const Range& b, Index p, Index r, Index c);
995  // I-IIII
997  Index v, const Range& s, Index b, Index p, Index r, Index c);
998  // -IIIII
1000  const Range& v, Index s, Index b, Index p, Index r, Index c);
1001 
1002  // Result scalar (1 combination)
1003  // IIIIII
1005  CHECK(v);
1006  CHECK(s);
1007  CHECK(b);
1008  CHECK(p);
1009  CHECK(r);
1010  CHECK(c);
1011  return get(v, s, b, p, r, c);
1012  }
1013 
1015  Numeric& get(Index v, Index s, Index b, Index p, Index r, Index c) {
1016  return *(mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r) +
1017  OFFSET(c));
1018  }
1019 
1020  // Conversion to a plain C-array
1021  const Numeric* get_c_array() const;
1022  Numeric* get_c_array();
1023 
1024  // Functions returning iterators:
1025  Iterator6D begin();
1026  Iterator6D end();
1027 
1028  // Assignment operators:
1030  Tensor6View& operator=(const Tensor6View& v);
1031  Tensor6View& operator=(const Tensor6& v);
1033 
1034  // Other operators:
1039 
1044 
1045  // Destructor:
1046  virtual ~Tensor6View() = default;
1047 
1048  // Friends:
1049  friend class Iterator7D;
1050  friend class Tensor7View;
1051 
1052  // Special constructor to make a Tensor6 view of a Tensor5.
1053  Tensor6View(const Tensor5View& a);
1054 
1055  protected:
1056  // Constructors:
1057  Tensor6View() = default;
1059  const Range& v,
1060  const Range& s,
1061  const Range& b,
1062  const Range& p,
1063  const Range& r,
1064  const Range& c);
1066  const Range& pv,
1067  const Range& ps,
1068  const Range& pb,
1069  const Range& pp,
1070  const Range& pr,
1071  const Range& pc,
1072  const Range& nv,
1073  const Range& ns,
1074  const Range& nb,
1075  const Range& np,
1076  const Range& nr,
1077  const Range& nc);
1078 };
1079 
1088 class Tensor6 : public Tensor6View {
1089  public:
1090  // Constructors:
1091  Tensor6() = default;
1092  Tensor6(Index v, Index s, Index b, Index p, Index r, Index c);
1093  Tensor6(Index v, Index s, Index b, Index p, Index r, Index c, Numeric fill);
1094  Tensor6(const ConstTensor6View& v);
1095  Tensor6(const Tensor6& v);
1096  Tensor6(Tensor6&& v) noexcept : Tensor6View(std::forward<Tensor6View>(v)) {
1097  v.mdata = nullptr;
1098  }
1099 
1100  // Assignment operators:
1101  Tensor6& operator=(const Tensor6& x);
1102  Tensor6& operator=(Tensor6&& x) noexcept;
1104 
1105  // Resize function:
1106  void resize(Index v, Index s, Index b, Index p, Index r, Index c);
1107 
1108  // Swap function:
1109  friend void swap(Tensor6& t1, Tensor6& t2);
1110 
1111  // Destructor:
1112  virtual ~Tensor6();
1113 };
1114 
1115 // Function declarations:
1116 // ----------------------
1117 
1118 void copy(ConstIterator6D origin,
1119  const ConstIterator6D& end,
1120  Iterator6D target);
1121 
1122 void copy(Numeric x, Iterator6D target, const Iterator6D& end);
1123 
1124 void transform(Tensor6View y, double (&my_func)(double), ConstTensor6View x);
1125 
1126 Numeric max(const ConstTensor6View& x);
1127 
1128 Numeric min(const ConstTensor6View& x);
1129 
1130 std::ostream& operator<<(std::ostream& os, const ConstTensor6View& v);
1131 
1133 // Helper function for debugging
1134 #ifndef NDEBUG
1135 
1137  Tensor6View& tv, Index v, Index s, Index b, Index p, Index r, Index c);
1138 
1139 #endif
1140 
1142 #endif // matpackVI_h
ConstTensor6View::ConstTensor6View
ConstTensor6View()=default
ConstIterator7D
Const version of Iterator7D.
Definition: matpackVII.h:84
Tensor6::Tensor6
Tensor6(Tensor6 &&v) noexcept
Definition: matpackVI.h:1096
Tensor7View
The Tensor7View class.
Definition: matpackVII.h:1286
ConstTensor6View::begin
ConstIterator6D begin() const
Return const iterator to first sub-tensor.
Definition: matpackVI.cc:875
ConstTensor6View::nshelves
Index nshelves() const
Returns the number of shelves.
Definition: matpackVI.cc:45
MatrixView
The MatrixView class.
Definition: matpackI.h:1093
ConstIterator6D::operator->
const ConstTensor5View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVI.h:121
Tensor6::resize
void resize(Index v, Index s, Index b, Index p, Index r, Index c)
Resize function.
Definition: matpackVI.cc:2175
Iterator6D::Iterator6D
Iterator6D()=default
Default constructor.
ConstTensor6View::mvr
Range mvr
The vitrine range of mdata that is actually used.
Definition: matpackVI.h:597
Tensor6View::Tensor6View
Tensor6View()=default
ConstTensor6View::mbr
Range mbr
The book range of mdata that is actually used.
Definition: matpackVI.h:601
ConstTensor6View::npages
Index npages() const
Returns the number of pages.
Definition: matpackVI.cc:51
ConstTensor7View
A constant view of a Tensor7.
Definition: matpackVII.h:147
Iterator6D::msv
Tensor5View msv
Current position.
Definition: matpackVI.h:81
Tensor6View::end
Iterator6D end()
Return iterator behind last sub-tensor.
Definition: matpackVI.cc:1758
OFFSET
#define OFFSET(x)
Definition: matpackVI.h:36
Iterator6D::operator!=
bool operator!=(const Iterator6D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackVI.h:62
ConstTensor5View::mbr
Range mbr
The book range of mdata that is actually used.
Definition: matpackV.h:313
Iterator7D
Implementation of Tensors of Rank 7.
Definition: matpackVII.h:36
ConstTensor6View::ConstTensor6View
constexpr ConstTensor6View(const ConstTensor6View &)=default
ConstIterator6D::ConstIterator6D
ConstIterator6D(const ConstTensor5View &x, Index stride)
Explicit constructor.
Definition: matpackVI.h:94
Tensor6::operator=
Tensor6 & operator=(const Tensor6 &x)
Assignment operator from another tensor.
Definition: matpackVI.cc:2124
ConstTensor6View::nrows
Index nrows() const
Returns the number of rows.
Definition: matpackVI.cc:54
ARTS::Var::y
Vector y(Workspace &ws) noexcept
Definition: autoarts.h:7401
Tensor6View::operator/=
Tensor6View & operator/=(Numeric x)
Division by scalar.
Definition: matpackVI.cc:1840
ConstTensor6View::~ConstTensor6View
virtual ~ConstTensor6View()=default
ConstIterator6D::operator++
ConstIterator6D & operator++()
Prefix increment operator.
Definition: matpackVI.h:100
data
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
Definition: arts_api_classes.cc:232
Iterator6D::operator++
Iterator6D & operator++()
Prefix increment operator.
Definition: matpackVI.h:53
Range::mstart
Index mstart
The start index.
Definition: matpackI.h:346
ConstTensor5View::msr
Range msr
The shelf range of mdata that is actually used.
Definition: matpackV.h:311
min
Numeric min(const ConstTensor6View &x)
Min function, tensor version.
Definition: matpackVI.cc:2287
CHECK
#define CHECK(x)
Implementation of Tensors of Rank 6.
Definition: matpackVI.h:33
ConstTensor6View::mrr
Range mrr
The row range of mdata that is actually used.
Definition: matpackVI.h:605
Tensor6View::operator+=
Tensor6View & operator+=(Numeric x)
Addition of scalar.
Definition: matpackVI.cc:1849
Iterator6D::mstride
Index mstride
Stride.
Definition: matpackVI.h:83
ConstTensor4View
A constant view of a Tensor4.
Definition: matpackIV.h:133
Tensor3View
The Tensor3View class.
Definition: matpackIII.h:239
Tensor6View::operator*=
Tensor6View & operator*=(Numeric x)
Multiplication by scalar.
Definition: matpackVI.cc:1831
ConstTensor6View::get
Numeric get(Index v, Index s, Index b, Index p, Index r, Index c) const
Get element implementation without assertions.
Definition: matpackVI.h:550
Tensor6View::get
Numeric & get(Index v, Index s, Index b, Index p, Index r, Index c)
Get element implementation without assertions.
Definition: matpackVI.h:1015
Tensor6::Tensor6
Tensor6()=default
Tensor6View::operator-=
Tensor6View & operator-=(Numeric x)
Subtraction of scalar.
Definition: matpackVI.cc:1858
ConstTensor6View::nvitrines
Index nvitrines() const
Returns the number of vitrines.
Definition: matpackVI.cc:42
Iterator6D::operator*
Tensor5View & operator*()
Dereferencing.
Definition: matpackVI.h:77
ConstTensor6View::mdata
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackVI.h:609
ConstTensor6View::mpr
Range mpr
The page range of mdata that is actually used.
Definition: matpackVI.h:603
ConstIterator6D
Const version of Iterator6D.
Definition: matpackVI.h:87
ConstTensor6View::end
ConstIterator6D end() const
Return const iterator behind last sub-tensor.
Definition: matpackVI.cc:882
ConstTensor5View::mrr
Range mrr
The row range of mdata that is actually used.
Definition: matpackV.h:317
VectorView
The VectorView class.
Definition: matpackI.h:610
ConstTensor6View::msr
Range msr
The shelf range of mdata that is actually used.
Definition: matpackVI.h:599
debug_tensor6view_get_elem
Numeric debug_tensor6view_get_elem(Tensor6View &tv, Index v, Index s, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
Definition: matpackVI.cc:2326
ConstTensor6View
A constant view of a Tensor6.
Definition: matpackVI.h:149
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Tensor5View
The Tensor5View class.
Definition: matpackV.h:333
ConstIterator6D::ConstIterator6D
ConstIterator6D()=default
Default constructor.
ConstTensor6View::operator=
ConstTensor6View & operator=(ConstTensor6View &&)=default
Tensor6View::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackVI.cc:1734
ConstTensor6View::ConstTensor6View
constexpr ConstTensor6View(ConstTensor6View &&)=default
ConstTensor6View::operator()
ConstTensor6View operator()(const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c) const
Definition: matpackVI.cc:63
ConstIterator6D::msv
ConstTensor5View msv
Current position.
Definition: matpackVI.h:128
Tensor6View::begin
Iterator6D begin()
Return iterator to first sub-tensor.
Definition: matpackVI.cc:1752
ConstIterator6D::operator!=
bool operator!=(const ConstIterator6D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackVI.h:109
ConstTensor5View::mcr
Range mcr
The column range of mdata that is actually used.
Definition: matpackV.h:319
Zeeman::end
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Definition: zeemandata.h:108
Iterator6D::operator->
Tensor5View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackVI.h:74
Tensor6View::operator=
Tensor6View & operator=(const ConstTensor6View &v)
Assignment operator.
Definition: matpackVI.cc:1773
Iterator6D
The outermost iterator class for rank 6 tensors.
Definition: matpackVI.h:40
ConstTensor6View::nbooks
Index nbooks() const
Returns the number of books.
Definition: matpackVI.cc:48
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:982
Tensor6View::Tensor6View
constexpr Tensor6View(const Tensor6View &)=default
Range
The range class.
Definition: matpackI.h:160
Tensor6::swap
friend void swap(Tensor6 &t1, Tensor6 &t2)
Swaps two objects.
Definition: matpackVI.cc:2215
Tensor6View::operator()
Numeric & operator()(Index v, Index s, Index b, Index p, Index r, Index c)
Definition: matpackVI.h:1004
matpackV.h
ConstTensor5View::mpr
Range mpr
The page range of mdata that is actually used.
Definition: matpackV.h:315
Tensor6View::get
Numeric get(Index v, Index s, Index b, Index p, Index r, Index c) const
Get element implementation without assertions.
Definition: matpackVI.h:550
ConstTensor6View::mcr
Range mcr
The column range of mdata that is actually used.
Definition: matpackVI.h:607
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:132
Tensor4View
The Tensor4View class.
Definition: matpackIV.h:284
ConstIterator6D::operator*
const ConstTensor5View & operator*() const
Dereferencing.
Definition: matpackVI.h:124
transform
void transform(Tensor6View y, double(&my_func)(double), ConstTensor6View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
Definition: matpackVI.cc:2248
ConstTensor5View::mdata
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackV.h:321
ConstIterator6D::mstride
Index mstride
Stride.
Definition: matpackVI.h:130
ARTS::Var::x
Vector x(Workspace &ws) noexcept
Definition: autoarts.h:7346
copy
void copy(ConstIterator6D origin, const ConstIterator6D &end, Iterator6D target)
Copy data between begin and end to target.
Definition: matpackVI.cc:2006
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Tensor6
The Tensor6 class.
Definition: matpackVI.h:1088
max
Numeric max(const ConstTensor6View &x)
Max function, tensor version.
Definition: matpackVI.cc:2268
Tensor6::~Tensor6
virtual ~Tensor6()
Destructor for Tensor6.
Definition: matpackVI.cc:2227
Tensor6View::~Tensor6View
virtual ~Tensor6View()=default
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:476
Iterator6D::Iterator6D
Iterator6D(const Tensor5View &x, Index stride)
Explicit constructor.
Definition: matpackVI.h:47
operator<<
std::ostream & operator<<(std::ostream &os, const ConstTensor6View &v)
Output operator.
Definition: matpackVI.cc:956
ConstTensor6View::ncols
Index ncols() const
Returns the number of columns.
Definition: matpackVI.cc:57
ConstTensor5View
A constant view of a Tensor5.
Definition: matpackV.h:143
Tensor6View
The Tensor6View class.
Definition: matpackVI.h:621
ns
#define ns
Definition: legacy_continua.cc:22183
Tensor6View::operator()
Tensor6View operator()(const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c)
Definition: matpackVI.cc:981
ConstTensor6View::operator=
ConstTensor6View & operator=(const ConstTensor6View &)=default
ConstTensor6View::operator()
Numeric operator()(Index v, Index s, Index b, Index p, Index r, Index c) const
Definition: matpackVI.h:538
ConstTensor6View::empty
bool empty() const
Check if variable is empty.
Definition: matpackVI.cc:36