19#include "matpack_data.h"
25 for (ArrayOfIndex::const_iterator it = dim_sizes.begin();
26 it != dim_sizes.end();
35 const Index min_num_elem,
38 if (type.nelem() > min_num_elem) dim_sizes.push_back(type.nelem());
43 const Index min_num_elem,
46 if (type.nrows() > min_num_elem) dim_sizes.push_back(type.nrows());
47 if (type.ncols() > min_num_elem) dim_sizes.push_back(type.ncols());
52 const Index min_num_elem,
53 const Tensor3& type) {
55 if (type.npages() > min_num_elem) dim_sizes.push_back(type.npages());
56 if (type.nrows() > min_num_elem) dim_sizes.push_back(type.nrows());
57 if (type.ncols() > min_num_elem) dim_sizes.push_back(type.ncols());
62 const Index min_num_elem,
63 const Tensor4& type) {
65 if (type.nbooks() > min_num_elem) dim_sizes.push_back(type.nbooks());
66 if (type.npages() > min_num_elem) dim_sizes.push_back(type.npages());
67 if (type.nrows() > min_num_elem) dim_sizes.push_back(type.nrows());
68 if (type.ncols() > min_num_elem) dim_sizes.push_back(type.ncols());
73 const Index min_num_elem,
74 const Tensor5& type) {
76 if (type.nshelves() > min_num_elem) dim_sizes.push_back(type.nshelves());
77 if (type.nbooks() > min_num_elem) dim_sizes.push_back(type.nbooks());
78 if (type.npages() > min_num_elem) dim_sizes.push_back(type.npages());
79 if (type.nrows() > min_num_elem) dim_sizes.push_back(type.nrows());
80 if (type.ncols() > min_num_elem) dim_sizes.push_back(type.ncols());
85 const Index min_num_elem,
86 const Tensor6& type) {
88 if (type.nvitrines() > min_num_elem) dim_sizes.push_back(type.nvitrines());
89 if (type.nshelves() > min_num_elem) dim_sizes.push_back(type.nshelves());
90 if (type.nbooks() > min_num_elem) dim_sizes.push_back(type.nbooks());
91 if (type.npages() > min_num_elem) dim_sizes.push_back(type.npages());
92 if (type.nrows() > min_num_elem) dim_sizes.push_back(type.nrows());
93 if (type.ncols() > min_num_elem) dim_sizes.push_back(type.ncols());
98 const Index min_num_elem,
99 const Tensor7& type) {
101 if (type.nlibraries() > min_num_elem) dim_sizes.push_back(type.nlibraries());
102 if (type.nvitrines() > min_num_elem) dim_sizes.push_back(type.nvitrines());
103 if (type.nshelves() > min_num_elem) dim_sizes.push_back(type.nshelves());
104 if (type.nbooks() > min_num_elem) dim_sizes.push_back(type.nbooks());
105 if (type.npages() > min_num_elem) dim_sizes.push_back(type.npages());
106 if (type.nrows() > min_num_elem) dim_sizes.push_back(type.nrows());
107 if (type.ncols() > min_num_elem) dim_sizes.push_back(type.ncols());
126 os <<
"The Vector is not also a Numeric";
127 throw std::runtime_error(os.str());
139 if (i.ncols() == 1 && i.nrows() == 1)
143 os <<
"The Matrix is not also a Numeric";
144 throw std::runtime_error(os.str());
156 if (i.ncols() == 1 && i.nrows() == 1 && i.npages() == 1)
160 os <<
"The Tensor3 is not also a Numeric";
161 throw std::runtime_error(os.str());
173 if (i.ncols() == 1 && i.nrows() == 1 && i.npages() == 1 && i.nbooks() == 1)
177 os <<
"The Tensor4 is not also a Numeric";
178 throw std::runtime_error(os.str());
190 if (i.ncols() == 1 && i.nrows() == 1 && i.npages() == 1 && i.nbooks() == 1 &&
192 o = i(0, 0, 0, 0, 0);
195 os <<
"The Tensor5 is not also a Numeric";
196 throw std::runtime_error(os.str());
208 if (i.ncols() == 1 && i.nrows() == 1 && i.npages() == 1 && i.nbooks() == 1 &&
209 i.nshelves() == 1 && i.nvitrines() == 1)
210 o = i(0, 0, 0, 0, 0, 0);
213 os <<
"The Tensor6 is not also a Numeric";
214 throw std::runtime_error(os.str());
226 if (i.ncols() == 1 && i.nrows() == 1 && i.npages() == 1 && i.nbooks() == 1 &&
227 i.nshelves() == 1 && i.nvitrines() == 1 && i.nlibraries() == 1)
228 o = i(0, 0, 0, 0, 0, 0, 0);
231 os <<
"The Tensor7 is not also a Numeric";
232 throw std::runtime_error(os.str());
250 Index num = dim_sizes.
nelem();
252 o.resize(dim_sizes[0]);
253 memcpy(o.data_handle(),
258 os <<
"The Matrix of size (" << dim_sizes <<
") \n"
259 <<
"does not fit a Vector";
260 throw std::runtime_error(os.str());
276 Index num = dim_sizes.
nelem();
278 o.resize(dim_sizes[0]);
279 memcpy(o.data_handle(),
284 os <<
"The Tensor3 of size (" << dim_sizes <<
") \n"
285 <<
"does not fit a Vector";
286 throw std::runtime_error(os.str());
302 Index num = dim_sizes.
nelem();
304 o.resize(dim_sizes[0]);
305 memcpy(o.data_handle(),
310 os <<
"The Tensor4 of size (" << dim_sizes <<
") \n"
311 <<
"does not fit a Vector";
312 throw std::runtime_error(os.str());
328 Index num = dim_sizes.
nelem();
330 o.resize(dim_sizes[0]);
331 memcpy(o.data_handle(),
336 os <<
"The Tensor5 of size (" << dim_sizes <<
") \n"
337 <<
"does not fit a Vector";
338 throw std::runtime_error(os.str());
354 Index num = dim_sizes.
nelem();
356 o.resize(dim_sizes[0]);
357 memcpy(o.data_handle(),
362 os <<
"The Tensor6 of size (" << dim_sizes <<
") \n"
363 <<
"does not fit a Vector";
364 throw std::runtime_error(os.str());
380 Index num = dim_sizes.
nelem();
382 o.resize(dim_sizes[0]);
383 memcpy(o.data_handle(),
388 os <<
"The Tensor7 of size (" << dim_sizes <<
") \n"
389 <<
"does not fit a Vector";
390 throw std::runtime_error(os.str());
408 Index num = dim_sizes.
nelem();
410 o.resize(dim_sizes[0], dim_sizes[1]);
411 memcpy(o.data_handle(),
416 os <<
"The Tensor3 of size (" << dim_sizes <<
") \n"
417 <<
"does not fit a Matrix";
418 throw std::runtime_error(os.str());
434 Index num = dim_sizes.
nelem();
436 o.resize(dim_sizes[0], dim_sizes[1]);
437 memcpy(o.data_handle(),
442 os <<
"The Tensor4 of size (" << dim_sizes <<
") \n"
443 <<
"does not fit a Matrix";
444 throw std::runtime_error(os.str());
460 Index num = dim_sizes.
nelem();
462 o.resize(dim_sizes[0], dim_sizes[1]);
463 memcpy(o.data_handle(),
468 os <<
"The Tensor5 of size (" << dim_sizes <<
") \n"
469 <<
"does not fit a Matrix";
470 throw std::runtime_error(os.str());
486 Index num = dim_sizes.
nelem();
488 o.resize(dim_sizes[0], dim_sizes[1]);
489 memcpy(o.data_handle(),
494 os <<
"The Tensor6 of size (" << dim_sizes <<
") \n"
495 <<
"does not fit a Matrix";
496 throw std::runtime_error(os.str());
512 Index num = dim_sizes.
nelem();
514 o.resize(dim_sizes[0], dim_sizes[1]);
515 memcpy(o.data_handle(),
520 os <<
"The Tensor7 of size (" << dim_sizes <<
") \n"
521 <<
"does not fit a Matrix";
522 throw std::runtime_error(os.str());
540 Index num = dim_sizes.
nelem();
542 o.resize(dim_sizes[0], dim_sizes[1], dim_sizes[2]);
543 memcpy(o.data_handle(),
548 os <<
"The Tensor4 of size (" << dim_sizes <<
") \n"
549 <<
"does not fit a Tensor3";
550 throw std::runtime_error(os.str());
566 Index num = dim_sizes.
nelem();
568 o.resize(dim_sizes[0], dim_sizes[1], dim_sizes[2]);
569 memcpy(o.data_handle(),
574 os <<
"The Tensor5 of size (" << dim_sizes <<
") \n"
575 <<
"does not fit a Tensor3";
576 throw std::runtime_error(os.str());
592 Index num = dim_sizes.
nelem();
594 o.resize(dim_sizes[0], dim_sizes[1], dim_sizes[2]);
595 memcpy(o.data_handle(),
600 os <<
"The Tensor6 of size (" << dim_sizes <<
") \n"
601 <<
"does not fit a Tensor3";
602 throw std::runtime_error(os.str());
618 Index num = dim_sizes.
nelem();
620 o.resize(dim_sizes[0], dim_sizes[1], dim_sizes[2]);
621 memcpy(o.data_handle(),
626 os <<
"The Tensor7 of size (" << dim_sizes <<
") \n"
627 <<
"does not fit a Tensor3";
628 throw std::runtime_error(os.str());
646 Index num = dim_sizes.
nelem();
648 o.resize(dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3]);
649 memcpy(o.data_handle(),
654 os <<
"The Tensor5 of size (" << dim_sizes <<
") \n"
655 <<
"does not fit a Tensor4";
656 throw std::runtime_error(os.str());
672 Index num = dim_sizes.
nelem();
674 o.resize(dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3]);
675 memcpy(o.data_handle(),
680 os <<
"The Tensor6 of size (" << dim_sizes <<
") \n"
681 <<
"does not fit a Tensor4";
682 throw std::runtime_error(os.str());
698 Index num = dim_sizes.
nelem();
700 o.resize(dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3]);
701 memcpy(o.data_handle(),
706 os <<
"The Tensor7 of size (" << dim_sizes <<
") \n"
707 <<
"does not fit a Tensor4";
708 throw std::runtime_error(os.str());
726 Index num = dim_sizes.
nelem();
729 dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3], dim_sizes[4]);
730 memcpy(o.data_handle(),
735 os <<
"The Tensor6 of size (" << dim_sizes <<
") \n"
736 <<
"does not fit a Tensor5";
737 throw std::runtime_error(os.str());
753 Index num = dim_sizes.
nelem();
756 dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3], dim_sizes[4]);
757 memcpy(o.data_handle(),
762 os <<
"The Tensor7 of size (" << dim_sizes <<
") \n"
763 <<
"does not fit a Tensor5";
764 throw std::runtime_error(os.str());
782 Index num = dim_sizes.
nelem();
784 o.resize(dim_sizes[0],
790 memcpy(o.data_handle(),
795 os <<
"The Tensor7 of size (" << dim_sizes <<
") \n"
796 <<
"does not fit a Tensor6";
797 throw std::runtime_error(os.str());
This file contains the definition of Array.
Index nelem() const ARTS_NOEXCEPT
The declarations of all the exception classes.
void Reduce(Numeric &o, const Vector &i, const Verbosity &)
WORKSPACE METHOD: Reduce.
Index num_elem_from_dim_sizes(const ArrayOfIndex &dim_sizes)
void select_dims_by_size(ArrayOfIndex &dim_sizes, const Index min_num_elem, const Vector &type)