98 #include <Eigen/Dense> 107 typedef Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>
StrideType;
108 typedef Eigen::Matrix<Numeric, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
176 : mstart(start), mextent(extent), mstride(stride) {
182 assert(0 <= mextent);
191 : mstart(start), mextent(-1), mstride(stride) {
209 : mstart(r.mstart), mextent(r.mextent), mstride(r.mstride) {
213 assert(mstart < max_size);
216 assert(0 != mstride);
221 mextent = 1 + (max_size - 1 - mstart) / mstride;
223 mextent = 1 + (0 - mstart) / mstride;
227 Index fin = mstart + (mextent - 1) * mstride;
229 assert(fin < max_size);
240 : mstart(p.mstart + n.mstart * p.mstride),
242 mstride(p.mstride * n.mstride) {
253 assert(p.
mstart <= mstart);
255 assert(mstart <= prev_fin || mextent == -1);
258 assert(0 != mstride);
263 mextent = 1 + (prev_fin - mstart) / mstride;
265 mextent = 1 + (p.
mstart - mstart) / mstride;
269 Index fin = mstart + (mextent - 1) * mstride;
271 assert(fin <= prev_fin);
373 : mx(x), mstride(stride) {
399 return (
Index)(mx - other.
mx) / mstride;
433 : mx(x), mstride(stride) {
509 assert(n < mrange.mextent);
515 return *(mdata + mrange.mstart +
n * mrange.mstride);
615 using ConstVectorView::operator[];
633 assert(n < mrange.mextent);
639 return *(mdata + mrange.mstart +
n * mrange.mstride);
714 const Numeric* get_c_array()
const;
773 : msv(x), mstride(stride) {
779 msv.mdata += mstride;
785 if (msv.mdata + msv.mrange.mstart !=
817 : msv(x), mstride(stride) {
823 msv.mdata += mstride;
829 if (msv.mdata + msv.mrange.mstart !=
898 Vector(
const std::vector<Numeric>&);
932 Vector& operator=(std::initializer_list<Numeric> v);
959 void resize(
Index n);
1002 assert(r < mrr.mextent);
1003 assert(c < mcr.mextent);
1010 return *(mdata + mrr.mstart + r * mrr.mstride + mcr.mstart +
1098 using ConstMatrixView::operator();
1111 assert(r < mrr.mextent);
1112 assert(c < mcr.mextent);
1119 return *(mdata + mrr.mstart + r * mrr.mstride + mcr.mstart +
1155 const Numeric* get_c_array()
const;
1315 #endif // matpackI_h INDEX Index
The type to use for all integer numbers and indices.
Numeric & operator*() const
Dereferencing.
constexpr Range(Joker, Index stride=1)
Constructor with just a joker.
const Numeric * mx
Current position.
Iterator1D & operator++()
Prefix increment operator.
Complex * mdata
Pointer to the plain C array that holds the data.
Range mrange
The range of mdata that is actually used.
bool operator!=(const Iterator1D &other) const
Not equal operator, needed for algorithms like copy.
void transpose_mult(VectorView y, const Sparse &M, ConstVectorView x)
Sparse matrix - Vector multiplication.
The outermost iterator class for rank 6 tensors.
Vector(Vector &&v) noexcept
ConstIterator1D begin() const
Return const iterator to first element.
constexpr Range operator()(const Range r) const
Range of range.
void lubacksub(VectorView x, ConstMatrixView LU, ConstVectorView b, const ArrayOfIndex &indx)
LU backsubstitution.
Const version of Iterator4D.
A constant view of a Tensor7.
void mult_general(MatrixView A, const ConstMatrixView &B, const ConstMatrixView &C)
General matrix multiplication.
VectorView * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Index mstart
The start index.
Numeric * mdata
Pointer to the plain C array that holds the data.
Eigen::Map< MatrixType, 0, StrideType > MatrixViewMap
Implementation of Tensors of Rank 4.
A constant view of a Tensor6.
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
ConstMatrixViewMap MapToEigenCol(const ConstVectorView &A)
VectorView msv
Current position.
Numeric & operator[](Index n)
Plain Index operator.
Const version of Iterator6D.
Eigen::Matrix< Numeric, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixType
std::ostream & operator<<(std::ostream &os, const ConstVectorView &v)
constexpr Index operator()(const Index i) const
Eigen::Map< Matrix4x4Type, 0, StrideType > Matrix4x4ViewMap
Numeric get(Index r, Index c) const
Get element implementation without assertions.
ConstMatrix4x4ViewMap MapToEigen4x4(const ConstMatrixView &A)
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
ConstVectorView msv
Current position.
The ComplexVectorView class.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
bool operator==(const QuantumIdentifier &a, const QuantumIdentifier &b)
Is everything the same between the identifiers.
The row iterator class for sub matrices.
Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > StrideType
ConstIterator1D end() const
Return const iterator behind last element.
constexpr Index get_start() const
Returns the start index of the range.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
bool operator!=(const ConstIterator2D &other) const
Not equal operator, needed for algorithms like copy.
const ConstVectorView * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
A constant view of a Tensor4.
This file contains the definition of Array.
ConstIterator2D begin() const
Return const iterator to first row.
bool operator!=(const QuantumIdentifier &a, const QuantumIdentifier &b)
Is anything different between the identifiers.
constexpr Range(const Range &p, const Range &n)
Constructor of a new range relative to an old range.
Iterator1D(Numeric *x, Index stride)
Explicit constructor.
The const row iterator class for sub matrices.
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
const Numeric & operator*() const
Dereferencing.
Iterator2D(const VectorView &x, Index stride)
Explicit constructor.
Numeric debug_matrixview_get_elem(MatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
Numeric get(Index n) const
Get element implementation without assertions.
std::random_access_iterator_tag iterator_category
bool operator!=(const Iterator2D &other) const
Not equal operator, needed for algorithms like copy.
constexpr Index get_extent() const
Returns the extent of the range.
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b)
cross3
Eigen::Map< const Matrix4x4Type, 0, StrideType > ConstMatrix4x4ViewMap
Complex * mdata
Pointer to the plain C array that holds the data.
Numeric operator[](Index n) const
Plain const index operator.
ConstIterator2D end() const
Return const iterator behind last row.
The const row iterator class for sub matrices.
Matrix(Matrix &&v) noexcept
Numeric operator()(Index r, Index c) const
Plain const index operator.
Eigen::Map< const MatrixType, 0, StrideType > ConstMatrixViewMap
A constant view of a Tensor5.
NUMERIC Numeric
The type to use for all floating point numbers.
ConstMatrixViewMap MapToEigenRow(const ConstVectorView &A)
Implementation of Tensors of Rank 7.
constexpr Index get_stride() const
Returns the stride of the range.
Eigen::Matrix< Numeric, 4, 4, Eigen::RowMajor > Matrix4x4Type
ConstIterator2D(const ConstVectorView &x, Index stride)
Explicit constructor.
Index mextent
The number of elements.
ConstMatrixViewMap MapToEigen(const ConstMatrixView &A)
Const version of Iterator5D.
void diagonalize(MatrixView P, VectorView WR, VectorView WI, ConstMatrixView A)
Matrix Diagonalization.
This can be used to make arrays out of anything.
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
Iterator2D & operator++()
Prefix increment operator.
ConstIterator1D & operator++()
Prefix increment operator.
Implementation of Tensors of Rank 5.
VectorView & operator*()
Dereferencing.
Workspace & init(Workspace &ws)
Numeric operator*(const ConstVectorView &a, const ConstVectorView &b)
Scalar product.
ConstIterator2D const_iterator
void inv(MatrixView Ainv, ConstMatrixView A)
Matrix Inverse.
Const version of Iterator7D.
A constant view of a Tensor3.
constexpr Range(Index start, Index extent, Index stride=1)
Explicit constructor.
A constant view of a Vector.
const ConstVectorView & operator*() const
Dereferencing.
Index nelem(const Lines &l)
Number of lines.
Range mcr
The column range of mdata that is actually used.
Binary output file stream class.
constexpr Rational start(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the lowest M for a polarization type of this transition.
Numeric * mdata
Pointer to the plain C array that holds the data.
A constant view of a Matrix.
constexpr Range(Index max_size, const Range &r)
Constructor which converts a range with joker to an explicit range.
Implementation of Tensors of Rank 3.
std::random_access_iterator_tag iterator_category
A constant view of a ComplexMatrix.
Numeric max(const ConstVectorView &x)
Max function, vector version.
Numeric * mx
Current position.
Range mrange
The range of mdata that is actually used.
The constant iterator class for sub vectors.
const Numeric & reference
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix-Vector Multiplication.
A constant view of a ComplexVector.
Numeric min(const ConstVectorView &x)
Min function, vector version.
constexpr Range(Index start, Joker, Index stride=1)
Constructor with joker extent.
Numeric vector_angle(ConstVectorView a, ConstVectorView b)
bool operator!=(const ConstIterator1D &other) const
Not equal operator, needed for algorithms like copy.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
The iterator class for sub vectors.
int poly_root_solve(Matrix &roots, Vector &coeffs)
void ludcmp(Matrix &LU, ArrayOfIndex &indx, ConstMatrixView A)
LU decomposition.
constexpr Complex operator-(Complex c, Numeric n)
void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
invlib::Matrix< ArtsMatrix > Matrix
invlib wrapper type for ARTS matrices.
Numeric & operator()(Index r, Index c)
Plain index operator.
Range mrr
The row range of mdata that is actually used.
Const version of Iterator3D.
MatrixView & operator+=(MatrixView &A, const Block &B)
ConstIterator1D const_iterator
The row iterator class for sub matrices.
The ComplexMatrixView class.
ConstIterator1D(const Numeric *x, Index stride)
Explicit constructor.
void proj(Vector &c, ConstVectorView a, ConstVectorView b)
ConstIterator2D & operator++()
Prefix increment operator.