107 template <
class base>
108 class Array :
public std::vector<base> {
119 : std::vector<base>(std::move(A)) {
122 :
std::vector<base>(init) {
124 template <
size_t N>
explicit Array(
const std::array<base, N>& input)
125 :
std::vector<base>(input.begin(), input.
end()) {
143 virtual ~Array() =
default;
149 template <
class base>
151 :
std::vector<base>(n) {
153 std::fill(this->begin(), this->
end(), fillvalue);
157 template <
class base>
159 std::fill(this->begin(), this->
end(), x);
179 template <
class base>
182 this->resize(A.size());
183 std::copy(A.begin(), A.end(), this->begin());
187 template <
class base>
189 std::vector<base>::operator=(std::move(A));
194 template <
class base>
196 size_t s = this->size();
197 assert(s < LONG_MAX);
198 return static_cast<long>(s);
203 template <
class base>
207 return std::vector<base>::operator[](n);
212 template <
class base>
216 return std::vector<base>::operator[](n);
220 template <
class base>
228 template <
class base>
229 inline std::ostream& operator<<(std::ostream& os, const Array<base>& v) {
234 os << std::setw(3) << *
i;
238 for (; i !=
end; ++
i) {
239 os <<
" " << std::setw(3) << *
i;
246 template <
class base>
254 for (; xi != xe; ++xi) {
255 if (*xi > max) max = *xi;
262 template <
class base>
270 for (; xi != xe; ++xi) {
271 if (*xi < min) min = *xi;
291 template <
class base>
294 if (w == x[
i])
return i;
313 template <
class base>
317 if (w == x[
i]) pos.push_back(i);
335 return values[a] < values[b];
342 template <
class base>
345 for (
Index i = 0;
i < aa.nelem();
i++) {
346 N_aa += aa[
i].nelem();
353 template <
class base>
357 assert(outer < aa.nelem());
358 assert(inner < aa[outer].
nelem());
373 template <
typename T,
typename ... Ts>
374 constexpr std::array<T, 1 +
sizeof...(Ts)>
stdarrayify(
const T& first,
const Ts&... the_rest)
376 return {first, T(the_rest)...};
INDEX Index
The type to use for all integer numbers and indices.
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
Index find_first(const Array< base > &x, const base &w)
Find first occurance.
Array(const Array< base > &A)
const ArrayOfNumeric & values
Array< ArrayOfMatrix > ArrayOfArrayOfMatrix
Array< Numeric > ArrayOfNumeric
An array of Numeric.
base min(const Array< base > &x)
Min function.
Index nelem() const
Number of elements.
void push_back_n(const base &elem, const Index n)
Append element n times.
Array(Array< base > &&A) noexcept
Array< ArrayOfTensor7 > ArrayOfArrayOfTensor7
cmplx FADDEEVA() w(cmplx z, double relerr)
wsv_data push_back(WsvRecord(NAME("mc_z_field_is_1D"), DESCRIPTION("Flag for MCGeneral and associated methods.\ "\" "If fields outside the cloud box are 1D, this flag can be set to 1\" "and the calculations will be more rapid.\" "\" "Usage:Set by the user.\"), GROUP("Index")))
Array(const std::array< base, N > &input)
Array< Vector > ArrayOfVector
An array of vectors.
Array< Index > ArrayOfIndex
An array of Index.
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
Array< ArrayOfTensor6 > ArrayOfArrayOfTensor6
Array< Sparse > ArrayOfSparse
An array of sparse matrices.
Array< Tensor4 > ArrayOfTensor4
An array of Tensor4.
const base & operator[](const Index n) const
Constant index operator.
Helper comparison class to sort an array or vector based on an ArrayOfNumeric.
Array< Matrix > ArrayOfMatrix
An array of matrices.
Array & operator=(base x)
Assignment from base type (fill entire Array with this value).
Array(std::initializer_list< base > init)
This can be used to make arrays out of anything.
Array< ArrayOfVector > ArrayOfArrayOfVector
bool operator()(const int &a, const int &b) const
Workspace & init(Workspace &ws)
Array< ArrayOfTensor5 > ArrayOfArrayOfTensor5
CmpArrayOfNumeric(const ArrayOfNumeric &vec)
Array< ArrayOfIndex > ArrayOfArrayOfIndex
base max(const Array< base > &x)
Max function.
Array< Tensor7 > ArrayOfTensor7
An array of Tensor7.
Array< Tensor3 > ArrayOfTensor3
An array of Tensor3.
Index FlattenedIndex(const Array< Array< base > > &aa, Index outer, Index inner=0)
Determine the index of an element in a flattened version of the array.
Array< Tensor6 > ArrayOfTensor6
An array of Tensor6.
constexpr std::array< T, 1+sizeof...(Ts)> stdarrayify(const T &first, const Ts &... the_rest)
Make a std::array of a list of variables (must be 1-long at least)
Array< ArrayOfTensor4 > ArrayOfArrayOfTensor4
void find_all(ArrayOfIndex &pos, const Array< base > &x, const base &w)
Find all occurances.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Array< Tensor5 > ArrayOfTensor5
An array of Tensor5.
Array< ArrayOfTensor3 > ArrayOfArrayOfTensor3