ARTS 2.5.10 (git: 2f1c442c)
matpackV.h
Go to the documentation of this file.
1/* Copyright (C) 2002-2012
2 Stefan Buehler <sbuehler@ltu.se>
3 Wolfram-Andre Haas <wolhaas@hermes.fho-emden.de>
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 USA. */
19
31#ifndef matpackV_h
32#define matpackV_h
33
34#include <utility>
35
36#include "matpackIV.h"
37#include "matpack_concepts.h"
38
42 public:
43 // Constructors:
44 // Functions for Iterator5D
45 // ------------------------
46
48 Iterator5D() = default;
49
51 Iterator5D(const Tensor4View& x, Index stride)
52 : msv(x), mstride(stride) { /* Nothing to do here. */
53 }
54
55 // Operators:
58 msv.mdata += mstride;
59 return *this;
60 }
61
63 bool operator!=(const Iterator5D& other) const {
65 msv.mcr.mstart !=
66 other.msv.mdata + other.msv.mbr.mstart + other.msv.mpr.mstart +
67 other.msv.mrr.mstart + other.msv.mcr.mstart)
68 return true;
69 return false;
70 }
71
74 Tensor4View* operator->() { return &msv; }
75
77 Tensor4View& operator*() { return msv; }
78
79 private:
84};
85
88 public:
89 // Constructors:
91 ConstIterator5D() = default;
92
95 : msv(std::move(x)), mstride(stride) { /* Nothing to do here. */
96 }
97
98 // Operators:
101 msv.mdata += mstride;
102 return *this;
103 }
104
106 bool operator!=(const ConstIterator5D& other) const {
108 msv.mcr.mstart !=
109 other.msv.mdata + other.msv.mbr.mstart + other.msv.mpr.mstart +
110 other.msv.mrr.mstart + other.msv.mcr.mstart)
111 return true;
112 return false;
113 }
114
117 const ConstTensor4View* operator->() const { return &msv; }
118
120 const ConstTensor4View& operator*() const { return msv; }
121
122 private:
127};
128
129// Declare class Tensor5:
130class Tensor5;
131
145 public:
146 static constexpr bool matpack_type{true};
147
148 constexpr ConstTensor5View(const ConstTensor5View&) = default;
149 constexpr ConstTensor5View(ConstTensor5View&&) = default;
152
153 // Member functions:
154 [[nodiscard]] Index nshelves() const noexcept { return msr.mextent; }
155 [[nodiscard]] Index nbooks() const noexcept { return mbr.mextent; }
156 [[nodiscard]] Index npages() const noexcept { return mpr.mextent; }
157 [[nodiscard]] Index nrows() const noexcept { return mrr.mextent; }
158 [[nodiscard]] Index ncols() const noexcept { return mcr.mextent; }
159
160 // Total size
161 [[nodiscard]] Index size() const noexcept {
162 return nshelves() * nbooks() * npages() * nrows() * ncols();
163 }
164 [[nodiscard]] bool empty() const noexcept { return size() == 0; }
165
167 [[nodiscard]] Shape<5> shape() const {
168 return {nshelves(), nbooks(), npages(), nrows(), ncols()};
169 }
170
171 // Const index operators:
173 const Range& b,
174 const Range& p,
175 const Range& r,
176 const Range& c) const;
177
179 const Range& b,
180 const Range& p,
181 const Range& r,
182 Index c) const;
184 const Range& b,
185 const Range& p,
186 Index r,
187 const Range& c) const;
189 const Range& b,
190 Index p,
191 const Range& r,
192 const Range& c) const;
194 Index b,
195 const Range& p,
196 const Range& r,
197 const Range& c) const;
199 const Range& b,
200 const Range& p,
201 const Range& r,
202 const Range& c) const;
203
205 const Range& s, const Range& b, const Range& p, Index r, Index c) const;
207 const Range& s, const Range& b, Index p, const Range& r, Index c) const;
209 const Range& s, const Range& b, Index p, Index r, const Range& c) const;
211 const Range& s, Index b, const Range& p, Index r, const Range& c) const;
213 const Range& s, Index b, const Range& p, const Range& r, Index c) const;
215 const Range& s, Index b, Index p, const Range& r, const Range& c) const;
217 Index s, const Range& b, Index p, const Range& r, const Range& c) const;
219 Index s, const Range& b, const Range& p, Index r, const Range& c) const;
221 Index s, const Range& b, const Range& p, const Range& r, Index c) const;
223 Index s, Index b, const Range& p, const Range& r, const Range& c) const;
224
226 const Range& s, const Range& b, Index p, Index r, Index c) const;
228 const Range& s, Index b, const Range& p, Index r, Index c) const;
230 const Range& s, Index b, Index p, const Range& r, Index c) const;
232 const Range& s, Index b, Index p, Index r, const Range& c) const;
234 Index s, const Range& b, Index p, Index r, const Range& c) const;
236 Index s, const Range& b, Index p, const Range& r, Index c) const;
238 Index s, const Range& b, const Range& p, Index r, Index c) const;
240 Index s, Index b, const Range& p, const Range& r, Index c) const;
242 Index s, Index b, const Range& p, Index r, const Range& c) const;
244 Index s, Index b, Index p, const Range& r, const Range& c) const;
245
247 const Range& s, Index b, Index p, Index r, Index c) const;
249 Index s, const Range& b, Index p, Index r, Index c) const;
251 Index s, Index b, const Range& p, Index r, Index c) const;
253 Index s, Index b, Index p, const Range& r, Index c) const;
255 Index s, Index b, Index p, Index r, const Range& c) const;
256
259 Index b,
260 Index p,
261 Index r,
262 Index c) const { // Check if indices are valid:
263 ARTS_ASSERT(0 <= s);
264 ARTS_ASSERT(0 <= b);
265 ARTS_ASSERT(0 <= p);
266 ARTS_ASSERT(0 <= r);
267 ARTS_ASSERT(0 <= c);
273
274 return get(s, b, p, r, c);
275 }
276
278 [[nodiscard]] Numeric get(Index s, Index b, Index p, Index r, Index c) const {
279 return *(mdata + msr.mstart + s * msr.mstride + mbr.mstart +
280 b * mbr.mstride + mpr.mstart + p * mpr.mstride + mrr.mstart +
281 r * mrr.mstride + mcr.mstart + c * mcr.mstride);
282 }
283
284 // Functions returning iterators:
285 [[nodiscard]] ConstIterator5D begin() const;
286 [[nodiscard]] ConstIterator5D end() const;
287
289 virtual ~ConstTensor5View() = default;
290
291 // Friends:
292 friend class Tensor5View;
293 friend class ConstIterator6D;
294 friend class ConstTensor6View;
295 friend class ConstTensor7View;
296
297 friend std::ostream& operator<<(std::ostream& os, const ConstTensor5View& v);
298
299 // Special constructor to make a Tensor5 view of a Tensor4.
301
302 protected:
303 // Constructors:
304 ConstTensor5View() = default;
306 const Range& s,
307 const Range& b,
308 const Range& p,
309 const Range& r,
310 const Range& c);
312 const Range& ps,
313 const Range& pb,
314 const Range& pp,
315 const Range& pr,
316 const Range& pc,
317 const Range& ns,
318 const Range& nb,
319 const Range& np,
320 const Range& nr,
321 const Range& nc);
322
323 // Data members:
324 // -------------
326 Range msr{0, 0, 1};
328 Range mbr{0, 0, 1};
330 Range mpr{0, 0, 1};
332 Range mrr{0, 0, 1};
334 Range mcr{0, 0, 1};
336 Numeric* mdata{nullptr};
337};
338
349 public:
350 // Make const methods visible from base class
353 using ConstTensor5View::operator();
355
356 constexpr Tensor5View(const Tensor5View&) = default;
357
358 // Non-const index operators:
359
361 const Range& b,
362 const Range& p,
363 const Range& r,
364 const Range& c);
365
367 const Range& s, const Range& b, const Range& p, const Range& r, Index c);
369 const Range& s, const Range& b, const Range& p, Index r, const Range& c);
371 const Range& s, const Range& b, Index p, const Range& r, const Range& c);
373 const Range& s, Index b, const Range& p, const Range& r, const Range& c);
375 Index s, const Range& b, const Range& p, const Range& r, const Range& c);
376
378 const Range& s, const Range& b, const Range& p, Index r, Index c);
380 const Range& s, const Range& b, Index p, const Range& r, Index c);
382 const Range& s, const Range& b, Index p, Index r, const Range& c);
384 const Range& s, Index b, const Range& p, Index r, const Range& c);
386 const Range& s, Index b, const Range& p, const Range& r, Index c);
388 const Range& s, Index b, Index p, const Range& r, const Range& c);
390 Index s, const Range& b, Index p, const Range& r, const Range& c);
392 Index s, const Range& b, const Range& p, Index r, const Range& c);
394 Index s, const Range& b, const Range& p, const Range& r, Index c);
396 Index s, Index b, const Range& p, const Range& r, const Range& c);
397
399 const Range& s, const Range& b, Index p, Index r, Index c);
401 const Range& s, Index b, const Range& p, Index r, Index c);
403 const Range& s, Index b, Index p, const Range& r, Index c);
405 const Range& s, Index b, Index p, Index r, const Range& c);
407 Index s, const Range& b, Index p, Index r, const Range& c);
409 Index s, const Range& b, Index p, const Range& r, Index c);
411 Index s, const Range& b, const Range& p, Index r, Index c);
413 Index s, Index b, const Range& p, const Range& r, Index c);
415 Index s, Index b, const Range& p, Index r, const Range& c);
417 Index s, Index b, Index p, const Range& r, const Range& c);
418
419 VectorView operator()(const Range& s, Index b, Index p, Index r, Index c);
420 VectorView operator()(Index s, const Range& b, Index p, Index r, Index c);
421 VectorView operator()(Index s, Index b, const Range& p, Index r, Index c);
422 VectorView operator()(Index s, Index b, Index p, const Range& r, Index c);
423 VectorView operator()(Index s, Index b, Index p, Index r, const Range& c);
424
425#define GETFUN(s, b, p, r, c) \
426 *(mdata + msr.mstart + s * msr.mstride + mbr.mstart + b * mbr.mstride + \
427 mpr.mstart + p * mpr.mstride + mrr.mstart + r * mrr.mstride + mcr.mstart + \
428 c * mcr.mstride)
431 Index b,
432 Index p,
433 Index r,
434 Index c) { // Check if indices are valid:
435 ARTS_ASSERT(0 <= s);
436 ARTS_ASSERT(0 <= b);
437 ARTS_ASSERT(0 <= p);
438 ARTS_ASSERT(0 <= r);
439 ARTS_ASSERT(0 <= c);
445
446 return GETFUN(s, b, p, r, c);
447 }
448
451 return GETFUN(s, b, p, r, c);
452 }
453#undef GETFUN
454
455 // Conversion to a plain C-array
456 [[nodiscard]] const Numeric* get_c_array() const ARTS_NOEXCEPT;
458
459 // Functions returning iterators:
461 Iterator5D end();
462
463 // Assignment operators:
464 Tensor5View& operator=(const ConstTensor5View& v);
465 Tensor5View& operator=(const Tensor5View& v);
466 Tensor5View& operator=(const Tensor5& v);
467 Tensor5View& operator=(Numeric x);
468
469 // Other operators:
470 Tensor5View& operator*=(Numeric x);
471 Tensor5View& operator/=(Numeric x);
472 Tensor5View& operator+=(Numeric x);
473 Tensor5View& operator-=(Numeric x);
474
475 Tensor5View& operator*=(const ConstTensor5View& x);
476 Tensor5View& operator/=(const ConstTensor5View& x);
477 Tensor5View& operator+=(const ConstTensor5View& x);
478 Tensor5View& operator-=(const ConstTensor5View& x);
479
481 ~Tensor5View() override = default;
482
483 // Friends:
484 // friend class VectorView;
485 // friend ConstTensor5View transpose(ConstTensor5View m);
486 // friend Tensor5View transpose(Tensor5View m);
487 friend class Iterator6D;
488 friend class Tensor6View;
489 friend class Tensor7View;
490
491 // Special constructor to make a Tensor5 view of a Tensor4.
492 Tensor5View(const Tensor4View& a);
493
494 protected:
495 // Constructors:
496 Tensor5View() = default;
497 Tensor5View(Numeric* data,
498 const Range& s,
499 const Range& b,
500 const Range& p,
501 const Range& r,
502 const Range& c);
503 Tensor5View(Numeric* data,
504 const Range& ps,
505 const Range& pb,
506 const Range& pp,
507 const Range& pr,
508 const Range& pc,
509 const Range& ns,
510 const Range& nb,
511 const Range& np,
512 const Range& nr,
513 const Range& nc);
514};
515
524class Tensor5 : public Tensor5View {
525 public:
526 // Constructors:
527 Tensor5() = default;
528 Tensor5(Index s, Index b, Index p, Index r, Index c);
529 Tensor5(Index s, Index b, Index p, Index r, Index c, Numeric fill);
530 Tensor5(const ConstTensor5View& v);
531 Tensor5(const Tensor5& v);
532 Tensor5(Tensor5&& v) noexcept : Tensor5View(std::forward<Tensor5View>(v)) {
533 v.mdata = nullptr;
534 }
535
538 : Tensor5(matpack::shelf_size(init), matpack::book_size(init),
539 matpack::page_size(init), matpack::row_size(init),
540 matpack::column_size(init)) {
541 *this = init;
542 }
543
546 if (const auto s = matpack::shape<Index, 5>(init); shape().data not_eq s)
547 resize(s[0], s[1], s[2], s[3], s[4]);
548
549 auto [I, J, K, L, M] = shape().data;
550 for (Index i = 0; i < I; i++)
551 for (Index j = 0; j < J; j++)
552 for (Index k = 0; k < K; k++)
553 for (Index x = 0; x < L; x++)
554 for (Index m = 0; m < M; m++)
555 operator()(i, j, k, x, m) = init(i, j, k, x, m);
556
557 return *this;
558 }
559
573 const Range& r0,
574 const Range& r1,
575 const Range& r2,
576 const Range& r3,
577 const Range& r4) ARTS_NOEXCEPT : Tensor5View(d, r0, r1, r2, r3, r4) {
578 ARTS_ASSERT(not(r0.get_extent() < 0), "Must have size");
579 ARTS_ASSERT(not(r1.get_extent() < 0), "Must have size");
580 ARTS_ASSERT(not(r2.get_extent() < 0), "Must have size");
581 ARTS_ASSERT(not(r3.get_extent() < 0), "Must have size");
582 ARTS_ASSERT(not(r4.get_extent() < 0), "Must have size");
583 }
584
585 // Assignment operators:
586 Tensor5& operator=(const Tensor5& x);
589
590 // Resize function:
591 void resize(Index s, Index b, Index p, Index r, Index c);
592
593 // Swap function:
594 friend void swap(Tensor5& t1, Tensor5& t2) noexcept;
595
596 // Destructor:
597 ~Tensor5() noexcept override;
598
600 template <std::size_t dim0>
601 Vector reduce_rank() && ARTS_NOEXCEPT {
602 static_assert(dim0 < 5, "Bad Dimension, Out-of-Bounds");
603
604 Range r0(0,
605 dim0 == 0 ? nshelves()
606 : dim0 == 1 ? nbooks()
607 : dim0 == 2 ? npages()
608 : dim0 == 3 ? nrows()
609 : ncols());
610
611 Vector out(mdata, r0);
612 ARTS_ASSERT(size() == out.size(),
613 "Can only reduce size on same size input");
614 mdata = nullptr;
615 return out;
616 }
617
619 template <std::size_t dim0, std::size_t dim1>
621 static_assert(dim1 < 5, "Bad Dimension, Out-of-Bounds");
622 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
623
624 const Range r1(0,
625 dim1 == 1 ? nbooks()
626 : dim1 == 2 ? npages()
627 : dim1 == 3 ? nrows()
628 : ncols());
629 const Range r0(0,
630 dim0 == 0 ? nshelves()
631 : dim0 == 1 ? nbooks()
632 : dim0 == 2 ? npages()
633 : nrows(),
634 r1.get_extent());
635
636 Matrix out(mdata, r0, r1);
637 ARTS_ASSERT(size() == out.size(),
638 "Can only reduce size on same size input");
639 mdata = nullptr;
640 return out;
641 }
642
644 template <std::size_t dim0, std::size_t dim1, std::size_t dim2>
646 static_assert(dim2 < 5, "Bad Dimension, Out-of-Bounds");
647 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
648 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
649
650 const Range r2(0, dim2 == 2 ? npages() : dim2 == 3 ? nrows() : ncols());
651 const Range r1(0,
652 dim1 == 1 ? nbooks()
653 : dim1 == 2 ? npages()
654 : nrows(),
655 r2.get_extent());
656 const Range r0(0,
657 dim0 == 0 ? nshelves()
658 : dim0 == 1 ? nbooks()
659 : npages(),
660 r1.get_extent() * r2.get_extent());
661
662 Tensor3 out(mdata, r0, r1, r2);
663 ARTS_ASSERT(size() == out.size(),
664 "Can only reduce size on same size input");
665 mdata = nullptr;
666 return out;
667 }
668
670 template <std::size_t dim0,
671 std::size_t dim1,
672 std::size_t dim2,
673 std::size_t dim3>
675 static_assert(dim3 < 5, "Bad Dimension, Out-of-Bounds");
676 static_assert(dim0 < dim1, "Bad Dimensions, dim1 must be larger than dim0");
677 static_assert(dim1 < dim2, "Bad Dimensions, dim2 must be larger than dim1");
678 static_assert(dim2 < dim3, "Bad Dimensions, dim3 must be larger than dim2");
679
680 const Range r3(0, dim3 == 3 ? nrows() : ncols());
681 const Range r2(0, dim2 == 2 ? npages() : nrows(), r3.get_extent());
682 const Range r1(
683 0, dim1 == 1 ? nbooks() : npages(), r2.get_extent() * r3.get_extent());
684 const Range r0(0,
685 dim0 == 0 ? nshelves() : nbooks(),
686 r1.get_extent() * r2.get_extent() * r3.get_extent());
687
688 Tensor4 out(mdata, r0, r1, r2, r3);
689 ARTS_ASSERT(size() == out.size(),
690 "Can only reduce size on same size input");
691 mdata = nullptr;
692 return out;
693 }
694
695 template <class F>
696 void transform_elementwise(F&& func) {
697 std::transform(mdata, mdata + size(), mdata, func);
698 }
699};
700
701// Function declarations:
702// ----------------------
703
704void copy(ConstIterator5D origin,
705 const ConstIterator5D& end,
706 Iterator5D target);
707
708void copy(Numeric x, Iterator5D target, const Iterator5D& end);
709
710void transform(Tensor5View y, double (&my_func)(double), ConstTensor5View x);
711
713
715
717// Helper function for debugging
718#ifndef NDEBUG
719
721 Tensor5View& tv, Index s, Index b, Index p, Index r, Index c);
722
723#endif
725
728
730
731#endif // matpackV_h
base max(const Array< base > &x)
Max function.
Definition: array.h:145
base min(const Array< base > &x)
Min function.
Definition: array.h:161
This can be used to make arrays out of anything.
Definition: array.h:48
Const version of Iterator5D.
Definition: matpackV.h:87
bool operator!=(const ConstIterator5D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackV.h:106
ConstIterator5D & operator++()
Prefix increment operator.
Definition: matpackV.h:100
Index mstride
Stride.
Definition: matpackV.h:126
const ConstTensor4View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 4D iterators.
Definition: matpackV.h:117
const ConstTensor4View & operator*() const
Dereferencing.
Definition: matpackV.h:120
ConstTensor4View msv
Current position.
Definition: matpackV.h:124
ConstIterator5D(ConstTensor4View x, Index stride)
Explicit constructor.
Definition: matpackV.h:94
ConstIterator5D()=default
Default constructor.
Const version of Iterator6D.
Definition: matpackVI.h:89
A constant view of a Matrix.
Definition: matpackI.h:1065
Index size() const noexcept
Definition: matpackI.h:1085
A constant view of a Tensor3.
Definition: matpackIII.h:133
Index size() const noexcept
Definition: matpackIII.h:154
A constant view of a Tensor4.
Definition: matpackIV.h:133
Range mrr
The row range of mdata that is actually used.
Definition: matpackIV.h:280
Range mbr
The book range of mdata that is actually used.
Definition: matpackIV.h:276
Index size() const noexcept
Definition: matpackIV.h:149
Range mcr
The column range of mdata that is actually used.
Definition: matpackIV.h:282
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackIV.h:284
Range mpr
The page range of mdata that is actually used.
Definition: matpackIV.h:278
A constant view of a Tensor5.
Definition: matpackV.h:144
virtual ~ConstTensor5View()=default
Destructor.
constexpr ConstTensor5View(ConstTensor5View &&)=default
Numeric get(Index s, Index b, Index p, Index r, Index c) const
Get element implementation without assertions.
Definition: matpackV.h:278
Index nrows() const noexcept
Definition: matpackV.h:157
ConstTensor5View operator()(const Range &s, const Range &b, const Range &p, const Range &r, const Range &c) const
Const index operator for subrange.
Definition: matpackV.cc:37
Index ncols() const noexcept
Definition: matpackV.h:158
Range mpr
The page range of mdata that is actually used.
Definition: matpackV.h:330
Range mcr
The column range of mdata that is actually used.
Definition: matpackV.h:334
constexpr ConstTensor5View(const ConstTensor5View &)=default
ConstTensor5View()=default
static constexpr bool matpack_type
Definition: matpackV.h:146
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackV.h:336
Index npages() const noexcept
Definition: matpackV.h:156
ConstTensor5View & operator=(ConstTensor5View &&)=default
ConstIterator5D end() const
Return const iterator behind last shelf.
Definition: matpackV.cc:694
ConstTensor5View & operator=(const ConstTensor5View &)=default
Index size() const noexcept
Definition: matpackV.h:161
Shape< 5 > shape() const
Definition: matpackV.h:167
Range mbr
The book range of mdata that is actually used.
Definition: matpackV.h:328
Range msr
The shelf range of mdata that is actually used.
Definition: matpackV.h:326
Numeric operator()(Index s, Index b, Index p, Index r, Index c) const
Plain const index operator.
Definition: matpackV.h:258
Range mrr
The row range of mdata that is actually used.
Definition: matpackV.h:332
Index nbooks() const noexcept
Definition: matpackV.h:155
Index nshelves() const noexcept
Definition: matpackV.h:154
friend std::ostream & operator<<(std::ostream &os, const ConstTensor5View &v)
Output operator.
Definition: matpackV.cc:756
bool empty() const noexcept
Definition: matpackV.h:164
ConstIterator5D begin() const
Return const iterator to first shelf.
Definition: matpackV.cc:688
A constant view of a Tensor6.
Definition: matpackVI.h:150
A constant view of a Tensor7.
Definition: matpackVII.h:148
A constant view of a Vector.
Definition: matpackI.h:521
Index size() const noexcept
Definition: matpackI.h:550
Implementation of Tensors of Rank 5.
Definition: matpackV.h:41
Tensor4View & operator*()
Dereferencing.
Definition: matpackV.h:77
Iterator5D()=default
Default constructor.
bool operator!=(const Iterator5D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackV.h:63
Tensor4View msv
Current position.
Definition: matpackV.h:81
Tensor4View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 4D iterators.
Definition: matpackV.h:74
Index mstride
Stride.
Definition: matpackV.h:83
Iterator5D & operator++()
Prefix increment operator.
Definition: matpackV.h:57
Iterator5D(const Tensor4View &x, Index stride)
Explicit constructor.
Definition: matpackV.h:51
The outermost iterator class for rank 6 tensors.
Definition: matpackVI.h:43
The MatrixView class.
Definition: matpackI.h:1188
The Matrix class.
Definition: matpackI.h:1285
The range class.
Definition: matpackI.h:160
Index mstart
The start index.
Definition: matpackI.h:377
constexpr Index get_extent() const noexcept
Returns the extent of the range.
Definition: matpackI.h:343
Index mstride
The stride.
Definition: matpackI.h:382
Index mextent
The number of elements.
Definition: matpackI.h:380
The Tensor3View class.
Definition: matpackIII.h:251
The Tensor3 class.
Definition: matpackIII.h:352
The Tensor4View class.
Definition: matpackIV.h:296
The Tensor4 class.
Definition: matpackIV.h:435
The Tensor5View class.
Definition: matpackV.h:348
Numeric & get(Index s, Index b, Index p, Index r, Index c)
Get element implementation without assertions.
Definition: matpackV.h:450
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Definition: matpackV.cc:662
Iterator5D end()
Return iterator behind last shelf.
Definition: matpackV.cc:1360
Numeric & operator()(Index s, Index b, Index p, Index r, Index c)
Plain const index operator.
Definition: matpackV.h:430
Tensor5View operator()(const Range &s, const Range &b, const Range &p, const Range &r, const Range &c)
Index operator for subrange.
Definition: matpackV.cc:780
Iterator5D begin()
Return iterator to first shelf.
Definition: matpackV.cc:1354
Tensor5View()=default
Tensor5View & operator=(const ConstTensor5View &v)
Assignment operator.
Definition: matpackV.cc:1371
constexpr Tensor5View(const Tensor5View &)=default
The Tensor5 class.
Definition: matpackV.h:524
Matrix reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackV.h:620
Tensor5(const matpack::tensor5_like_not_tensor5 auto &init)
Initialization from a tensor type.
Definition: matpackV.h:537
Tensor5()=default
Tensor5(Numeric *d, const Range &r0, const Range &r1, const Range &r2, const Range &r3, const Range &r4) ARTS_NOEXCEPT
Definition: matpackV.h:572
Tensor5(Tensor5 &&v) noexcept
Definition: matpackV.h:532
Tensor4 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackV.h:674
void transform_elementwise(F &&func)
Definition: matpackV.h:696
Tensor3 reduce_rank() &&ARTS_NOEXCEPT
Definition: matpackV.h:645
Tensor5 & operator=(const matpack::tensor5_like_not_tensor5 auto &init)
Set from a tensor type.
Definition: matpackV.h:545
The Tensor6View class.
Definition: matpackVI.h:635
The Tensor7View class.
Definition: matpackVII.h:1308
The VectorView class.
Definition: matpackI.h:674
The Vector class.
Definition: matpackI.h:910
A concept precluding Arts types but allowing the tensor-like object.
#define ARTS_NOEXCEPT
Definition: debug.h:99
#define ARTS_ASSERT(condition,...)
Definition: debug.h:102
void copy(ConstIterator5D origin, const ConstIterator5D &end, Iterator5D target)
Copy data between begin and end to target.
Definition: matpackV.cc:1591
void transform(Tensor5View y, double(&my_func)(double), ConstTensor5View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
Definition: matpackV.cc:1809
Numeric debug_tensor5view_get_elem(Tensor5View &tv, Index s, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
Definition: matpackV.cc:1885
#define GETFUN(s, b, p, r, c)
Definition: matpackV.h:425
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
void swap(ComplexVector &v1, ComplexVector &v2) noexcept
Swaps two objects.
#define M
Definition: rng.cc:165
Helper shape class.
Definition: matpackI.h:387
#define d
#define v
#define a
#define c
#define b