108class Array :
public std::vector<base> {
119 : std::vector<base>(std::move(A)) {
124 template <
class base2,
size_t N>
explicit Array(
const std::array<base2, N>& input)
125 :
std::vector<base>(input.begin(), input.
end()) {
126 static_assert(std::is_convertible<base, base2>::value,
"Must be convertible");
139 const base& operator[](const
Index n) const;
153 :
std::vector<base>(n) {
155 std::fill(this->begin(), this->
end(), fillvalue);
161 std::fill(this->begin(), this->
end(), x);
184 this->resize(A.size());
185 std::copy(A.begin(), A.end(), this->begin());
191 std::vector<base>::operator=(std::move(A));
198 size_t s = this->size();
200 return static_cast<Index>(s);
209 return std::vector<base>::operator[](n);
218 return std::vector<base>::operator[](n);
224 for (
Index i = 0; i < n; i++) std::vector<base>::push_back(elem);
236 os << std::setw(3) << *i;
240 for (; i !=
end; ++i) {
241 os <<
" " << std::setw(3) << *i;
256 for (; xi != xe; ++xi) {
272 for (; xi != xe; ++xi) {
296 if (
w == x[i])
return i;
319 if (
w == x[i]) pos.push_back(i);
337 return values[
a] < values[
b];
347 for (
Index i = 0; i < aa.nelem(); i++) {
348 N_aa += aa[i].nelem();
363 for (
Index i = 0; i < outer; i++) {
375template <
typename T,
typename ... Ts>
376constexpr std::array<T, 1 +
sizeof...(Ts)>
stdarrayify(
const T& first,
const Ts&... the_rest)
378 return {first, T(the_rest)...};
382std::string
stringify(
const Array<T>& list,
const char *
const sep=
" ",
const char *
const beg=
"") {
383 std::ostringstream os;
384 for (
auto& x: list) os << beg << x << sep;
std::ostream & operator<<(std::ostream &os, const Array< base > &v)
Output operator.
Array< ArrayOfTensor5 > ArrayOfArrayOfTensor5
Array< ArrayOfTensor6 > ArrayOfArrayOfTensor6
Array< ArrayOfIndex > ArrayOfArrayOfIndex
Array< ArrayOfMatrix > ArrayOfArrayOfMatrix
Array< Tensor7 > ArrayOfTensor7
An array of Tensor7.
Array< ArrayOfTensor7 > ArrayOfArrayOfTensor7
std::string stringify(const Array< T > &list, const char *const sep=" ", const char *const beg="")
Array< Matrix > ArrayOfMatrix
An array of matrices.
Array< Index > ArrayOfIndex
An array of Index.
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
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.
Index find_first(const Array< base > &x, const base &w)
Find first occurance.
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
Array< Vector > ArrayOfVector
An array of vectors.
Array< ArrayOfTensor3 > ArrayOfArrayOfTensor3
Array< Numeric > ArrayOfNumeric
An array of Numeric.
Array< Tensor4 > ArrayOfTensor4
An array of Tensor4.
Array< Tensor3 > ArrayOfTensor3
An array of Tensor3.
void find_all(ArrayOfIndex &pos, const Array< base > &x, const base &w)
Find all occurances.
Array< Tensor5 > ArrayOfTensor5
An array of Tensor5.
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< ArrayOfVector > ArrayOfArrayOfVector
Array< ArrayOfTensor4 > ArrayOfArrayOfTensor4
This can be used to make arrays out of anything.
Array & operator=(const Array< base > &A)
Assignment from another Array.
Array(Index n, const base &fillvalue)
Constructor filling with constant value.
Array(const std::array< base2, N > &input)
void push_back_n(const base &elem, const Index n)
Append element n times.
Array(std::vector< base > x)
Array(std::initializer_list< base > init)
const base & operator[](const Index n) const
Constant index operator.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Array(const Array< base > &A)
Array & operator=(Array< base > &&A) noexcept
Array & operator=(base x)
Assignment from base type (fill entire Array with this value).
Array(Array< base > &&A) noexcept
Helper comparison class to sort an array or vector based on an ArrayOfNumeric.
CmpArrayOfNumeric(const ArrayOfNumeric &vec)
const ArrayOfNumeric & values
bool operator()(const int &a, const int &b) const
#define ARTS_ASSERT(condition,...)
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.
Workspace & init(Workspace &ws)
VectorView std(VectorView std, const Vector &y, const ArrayOfVector &ys, const Index start, const Index end_tmp)
Compute the standard deviation of the ranged ys.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.