Go to the documentation of this file.
51 if (needleind.
nelem() == 1 && needleind[0] == -1) {
56 for (
Index i = 0; i < needleind.
nelem(); i++) {
57 if (haystack.
nelem() <= needleind[i]) {
59 os <<
"The input vector only has " << haystack.
nelem()
60 <<
" elements. But one of the needle indexes is " << needleind[i]
62 os <<
"The indexes must be between 0 and " << haystack.
nelem() - 1;
63 throw runtime_error(os.str());
64 }
else if (needleind[i] < 0) {
66 os <<
"One of the needle indexes is " << needleind[i] <<
"." << endl;
67 os <<
"The indexes must be between 0 and " << haystack.
nelem() - 1;
68 throw runtime_error(os.str());
70 dummy[i] = haystack[needleind[i]];
100 if (needleind.
nelem() == 1 && needleind[0] == -1) {
105 for (
Index i = 0; i < needleind.
nelem(); i++) {
106 if (haystack.
nelem() <= needleind[i]) {
108 os <<
"The input vector only has " << haystack.
nelem()
109 <<
" elements. But one of the needle indexes is " << needleind[i]
111 os <<
"The indexes must be between 0 and " << haystack.
nelem() - 1;
112 throw runtime_error(os.str());
113 }
else if (needleind[i] < 0) {
115 os <<
"One of the needle indexes is " << needleind[i] <<
"." << endl;
116 os <<
"The indexes must be between 0 and " << haystack.
nelem() - 1;
117 throw runtime_error(os.str());
119 dummy[i] = haystack[needleind[i]];
138 if (needleind.
nelem() == 1 && needleind[0] == -1) {
143 for (
Index i = 0; i < needleind.
nelem(); i++) {
144 if (haystack.
nrows() <= needleind[i]) {
146 os <<
"The input matrix only has " << haystack.
nrows()
147 <<
" rows. But one of the needle indexes is " << needleind[i] <<
"."
149 os <<
"The indexes must be between 0 and " << haystack.
nrows() - 1;
150 throw runtime_error(os.str());
151 }
else if (needleind[i] < 0) {
153 os <<
"One of the needle indexes is " << needleind[i] <<
"." << endl;
154 os <<
"The indexes must be between 0 and " << haystack.
nrows() - 1;
155 throw runtime_error(os.str());
157 dummy(i,
joker) = haystack(needleind[i],
joker);
178 if (needleind.
nelem() == 1 && needleind[0] == -1) {
183 for (
Index i = 0; i < needleind.
nelem(); i++) {
184 if (haystack.
nrows() <= needleind[i]) {
186 os <<
"The input matrix only has " << haystack.
nrows()
187 <<
" rows. But one of the needle indexes is " << needleind[i] <<
"."
189 os <<
"The indexes must be between 0 and " << haystack.
nrows() - 1;
190 throw runtime_error(os.str());
191 }
else if (needleind[i] < 0) {
193 os <<
"One of the needle indexes is " << needleind[i] <<
"." << endl;
194 os <<
"The indexes must be between 0 and " << haystack.
nrows() - 1;
195 throw runtime_error(os.str());
201 for (
Index j = 0; j < haystack.
ncols(); ++j) {
202 Numeric value = haystack(needleind[i], j);
203 if (0 != value) dummy.
rw(i, j) = value;
208 if (dummy.
nnz() == haystack.
nnz()) {
210 out3 <<
" Number of nonzero elements has stayed the same.\n";
212 out3 <<
" Number of nonzero elements reduced from " << haystack.
nnz()
213 <<
" to " << dummy.
nnz() <<
".\n";
Index ncols() const
Returns the number of columns.
Verbosity verbosity(Workspace &ws) noexcept
Index nrows() const
Returns the number of rows.
This can be used to make arrays out of anything.
Declarations for agendas.
Declarations having to do with the four output streams.
Index nnz() const
Returns the number of nonzero elements.
Index ncols() const
Returns the number of columns.
Index nelem() const
Returns the number of elements.
NUMERIC Numeric
The type to use for all floating point numbers.
This file contains the Workspace class.
Index nrows() const
Returns the number of rows.
Numeric & rw(Index r, Index c)
Read and write index operator.
Header file for sparse matrices.
INDEX Index
The type to use for all integer numbers and indices.
void Select(Array< T > &needles, const Array< T > &haystack, const ArrayOfIndex &needleind, const Verbosity &)
Index nelem() const
Number of elements.
This file contains the definition of String, the ARTS string class.