Go to the documentation of this file.
107 template <
class base>
108 class Array :
public std::vector<base> {
119 : std::vector<base>(std::move(A)) {
124 template <
size_t N>
explicit Array(
const std::array<base, N>& input)
125 :
std::vector<base>(input.begin(), input.
end()) {
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>
222 for (
Index i = 0; i < n; i++) std::vector<base>::push_back(elem);
228 template <
class base>
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) {
262 template <
class base>
270 for (; xi != xe; ++xi) {
291 template <
class base>
293 for (
Index i = 0; i <
x.nelem(); ++i)
294 if (
w ==
x[i])
return i;
313 template <
class base>
316 for (
Index i = 0; i <
x.nelem(); ++i)
317 if (
w ==
x[i]) pos.push_back(i);
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());
361 for (
Index i = 0; i < outer; i++) {
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)...};
Array< ArrayOfTensor5 > ArrayOfArrayOfTensor5
Complex w(Complex z) noexcept
The Faddeeva function.
Array & operator=(Array< base > &&A) noexcept
Array< Numeric > ArrayOfNumeric
An array of Numeric.
Array< Tensor4 > ArrayOfTensor4
An array of Tensor4.
Array< Tensor3 > ArrayOfTensor3
An array of Tensor3.
void std(VectorView std, const Vector &y, const ArrayOfVector &ys, const Index start=0, const Index end=-1)
Compute the standard deviation of the ranged ys.
void push_back_n(const base &elem, const Index n)
Append element n times.
Array(const std::array< base, N > &input)
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
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< Vector > ArrayOfVector
An array of vectors.
Workspace & init(Workspace &ws)
This can be used to make arrays out of anything.
Index nelem(const Lines &l)
Number of lines.
Array(Index n, const base &fillvalue)
Constructor filling with constant value.
Array< ArrayOfTensor3 > ArrayOfArrayOfTensor3
Array< ArrayOfIndex > ArrayOfArrayOfIndex
Array< Index > ArrayOfIndex
An array of Index.
Array< Matrix > ArrayOfMatrix
An array of matrices.
base & operator[](const Index n)
Non-constant index operator.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Array< Tensor7 > ArrayOfTensor7
An array of Tensor7.
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< Sparse > ArrayOfSparse
An array of sparse matrices.
Array & operator=(base x)
Assignment from base type (fill entire Array with this value).
bool operator()(const int &a, const int &b) const
CmpArrayOfNumeric(const ArrayOfNumeric &vec)
Array< ArrayOfTensor4 > ArrayOfArrayOfTensor4
Array(std::initializer_list< base > init)
Array< Tensor5 > ArrayOfTensor5
An array of Tensor5.
void find_all(ArrayOfIndex &pos, const Array< base > &x, const base &w)
Find all occurances.
const base & operator[](const Index n) const
Constant index operator.
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
base max(const Array< base > &x)
Max function.
Array< ArrayOfVector > ArrayOfArrayOfVector
std::ostream & operator<<(std::ostream &os, const Array< base > &v)
Output operator.
Array< ArrayOfTensor7 > ArrayOfArrayOfTensor7
Helper comparison class to sort an array or vector based on an ArrayOfNumeric.
Array & operator=(const Array< base > &A)
Assignment from another Array.
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
Array(const Array< base > &A)
Index find_first(const Array< base > &x, const base &w)
Find first occurance.
const ArrayOfNumeric & values
Array< ArrayOfMatrix > ArrayOfArrayOfMatrix
Array< Tensor6 > ArrayOfTensor6
An array of Tensor6.
base min(const Array< base > &x)
Min function.
Index nelem() const
Number of elements.
Array(Array< base > &&A) noexcept
Array< ArrayOfTensor6 > ArrayOfArrayOfTensor6