51 if (needleind.
nelem() == 1 && needleind[0] == -1) {
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]];
84 Select(needles, haystack, needleind, verbosity);
100 if (needleind.
nelem() == 1 && needleind[0] == -1) {
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) {
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());
178 if (needleind.
nelem() == 1 && needleind[0] == -1) {
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 Index
The type to use for all integer numbers and indices.
Index nnz() const
Returns the number of nonzero elements.
Index nelem() const
Number of elements.
Declarations having to do with the four output streams.
Index ncols() const
Returns the number of columns.
Index nelem() const
Returns the number of elements.
This file contains the Workspace class.
Index ncols() const
Returns the number of columns.
Header file for sparse matrices.
_CS_string_type str() const
Declarations for agendas.
Index nrows() const
Returns the number of rows.
NUMERIC Numeric
The type to use for all floating point numbers.
This can be used to make arrays out of anything.
Index nrows() const
Returns the number of rows.
This file contains the definition of String, the ARTS string class.
void Select(Array< T > &needles, const Array< T > &haystack, const ArrayOfIndex &needleind, const Verbosity &)