53 for (; i != e; ++i) s += *i;
116 for (; i !=
end; ++i) {
117 os <<
" " << setw(3) << *i;
128 "Creating a VectorView from a const Vector is not allowed.\n"
129 "This is not really a runtime error, but I don't want to start\n"
130 "producing direct output from inside matpack. And just exiting is\n"
132 "If you see this error, there is a bug in the code, not in the\n"
193 for (
Iterator1D i = begin(); i != e; ++i) *i *= x;
199 for (
Iterator1D i = begin(); i != e; ++i) *i /= x;
205 for (
Iterator1D i = begin(); i != e; ++i) *i += x;
211 for (
Iterator1D i = begin(); i != e; ++i) *i -= x;
223 for (; i != e; ++i, ++s) *i *= *s;
235 for (; i != e; ++i, ++s) *i /= *s;
247 for (; i != e; ++i, ++s) *i += *s;
259 for (; i != e; ++i, ++s) *i -= *s;
308 memcpy((
void*)target.
mx,
312 for (; origin !=
end; ++origin, ++target) *target = *origin;
316 for (; target !=
end; ++target) *target = x;
340 std::fill_n(
mdata, n, fill);
349 for (; i != e; ++i) {
367 std::vector<Numeric>::const_iterator vec_it_end =
v.end();
369 for (std::vector<Numeric>::const_iterator vec_it =
v.begin();
370 vec_it != vec_it_end;
547 os << setw(3) << *ic;
550 for (; ic != end_col; ++ic) {
551 os <<
" " << setw(3) << *ic;
555 for (; ir != end_row; ++ir) {
561 os << setw(3) << *ic;
564 for (; ic != end_col; ++ic) {
565 os <<
" " << setw(3) << *ic;
592 return VectorView(mdata + mcr.mstart +
c * mcr.mstride, mrr, r);
604 return VectorView(mdata + mrr.mstart + r * mrr.mstride, mcr,
c);
771 for (; r != er; ++r, ++sr) {
775 for (;
c != ec; ++
c, ++sc) *
c *= *sc;
787 for (; r != er; ++r, ++sr) {
791 for (;
c != ec; ++
c, ++sc) *
c /= *sc;
803 for (; r != er; ++r, ++sr) {
807 for (;
c != ec; ++
c, ++sc) *
c += *sc;
819 for (; r != er; ++r, ++sr) {
823 for (;
c != ec; ++
c, ++sc) *
c -= *sc;
835 for (; r != er; ++r, ++sc) {
849 for (; r != er; ++r, ++sc) {
863 for (; r != er; ++r, ++sc) {
877 for (; r != er; ++r, ++sc) {
929 for (; origin !=
end; ++origin, ++target) {
933 for (; o != e; ++o, ++t) *t = *o;
939 for (; target !=
end; ++target) {
942 for (; t != e; ++t) *t = x;
961 std::fill_n(
mdata, r *
c, fill);
968 Range(0, m.nrows(), m.ncols()),
969 Range(0, m.ncols())) {
977 Range(0, m.nrows(), m.ncols()),
978 Range(0, m.ncols())) {
1026 m.mrr =
Range(0, 0);
1027 m.mcr =
Range(0, 0);
1109 for (; ai != ae; ++ai, ++bi) res += (*ai) * (*bi);
1136 if ((
M.mcr.get_stride() == 1) || (
M.mrr.get_stride() == 1)) {
1141 int LDA, incx, incy;
1143 if (
M.mcr.get_stride() != 1) {
1145 m = (int)
M.mrr.get_extent();
1146 n = (int)
M.mcr.get_extent();
1147 LDA = (int)
M.mcr.get_stride();
1150 m = (int)
M.mcr.get_extent();
1151 n = (int)
M.mrr.get_extent();
1152 LDA = (int)
M.mrr.get_stride();
1153 if (
M.mrr.get_stride() == 1) LDA = m;
1159 double* mstart =
M.mdata +
M.mcr.get_start() +
M.mrr.get_start();
1198 Numeric* mdata =
M.mdata +
M.mcr.mstart +
M.mrr.mstart;
1210 *yelem = *melem * *xelem;
1215 melem +=
M.mcr.mstride;
1217 *yelem += *melem * *xelem;
1220 mdata +=
M.mrr.mstride;
1282 char transa, transb;
1324 double alpha = 1.0,
beta = 0.0;
1371 for (; ai != ae; ++ai, ++bi) {
1379 for (; aci != ace; ++aci, ++cti) {
1382 *aci = (*bi) * (*cti);
1408 c[0] =
a[1] *
b[2] -
a[2] *
b[1];
1409 c[1] =
a[2] *
b[0] -
a[0] *
b[2];
1410 c[2] =
a[0] *
b[1] -
a[1] *
b[0];
1428 return fabs(arg) > 1. ? 0. : acos(arg) *
RAD2DEG;
1491 for (; xi != xe; ++xi, ++yi) *yi = my_func(*xi);
1520 for (; rx != rxe; ++rx, ++ry) {
1524 for (; cx != cxe; ++cx, ++cy) *cy = my_func(*cx);
1536 for (; xi != xe; ++xi) {
1537 if (*xi >
max)
max = *xi;
1551 for (; rx != rxe; ++rx) {
1555 for (; cx != cxe; ++cx)
1556 if (*cx >
max)
max = *cx;
1570 for (; xi != xe; ++xi) {
1571 if (*xi <
min)
min = *xi;
1585 for (; rx != rxe; ++rx) {
1589 for (; cx != cxe; ++cx)
1590 if (*cx <
min)
min = *cx;
1604 for (; xi != xe; ++xi)
mean += *xi;
1617 Index numnormal = 0;
1622 for (; xi != xe; ++xi)
1623 if (std::isnormal(*xi) or (*xi == 0)) {
1631 nanmean = std::numeric_limits<Numeric>::quiet_NaN();
1644 for (; rx != rxe; ++rx) {
1648 for (; cx != cxe; ++cx)
mean += *cx;
1677 for (; i != e; ++i, ++target) *target = *i;
Interface for BLAS library.
void dgemv_(char *trans, int *m, int *n, double *alpha, double *A, int *LDA, double *x, int *incx, double *beta, double *y, int *incy)
Matrix-Vector Multiplication.
void dgemm_(char *transa, char *transb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int *ldb, double *beta, double *C, int *ldc)
BLAS matrix multiplication.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
The constant iterator class for sub vectors.
const Numeric * mx
Current position.
The const row iterator class for sub matrices.
A constant view of a Matrix.
Range mrr
The row range of mdata that is actually used.
friend class ConstVectorView
ConstIterator2D begin() const ARTS_NOEXCEPT
Return const iterator to first row.
Index size() const noexcept
Index nrows() const noexcept
ConstIterator2D end() const ARTS_NOEXCEPT
Return const iterator behind last row.
Index ncols() const noexcept
Numeric operator()(Index r, Index c) const ARTS_NOEXCEPT
Plain const index operator.
Numeric * mdata
Pointer to the plain C array that holds the data.
Range mcr
The column range of mdata that is actually used.
ConstVectorView diagonal() const ARTS_NOEXCEPT
Matrix diagonal as vector.
ConstMatrixView()=default
A constant view of a Vector.
ConstIterator1D end() const ARTS_NOEXCEPT
Return const iterator behind last element.
ConstIterator1D begin() const ARTS_NOEXCEPT
Return const iterator to first element.
ConstVectorView()=default
Numeric * mdata
Pointer to the plain C array that holds the data.
Numeric sum() const ARTS_NOEXCEPT
The sum of all elements of a Vector.
Numeric operator[](Index n) const ARTS_NOEXCEPT
Plain const index operator.
Range mrange
The range of mdata that is actually used.
Index nelem() const noexcept
Returns the number of elements.
Index size() const noexcept
The iterator class for sub vectors.
Numeric * mx
Current position.
The row iterator class for sub matrices.
MatrixView & operator=(const ConstMatrixView &m)
Assignment operator.
MatrixView & operator/=(Numeric x) ARTS_NOEXCEPT
Division by scalar.
Numeric & operator()(Index r, Index c) ARTS_NOEXCEPT
Plain index operator.
Iterator2D end() ARTS_NOEXCEPT
Return iterator behind last row.
MatrixView & operator+=(Numeric x) ARTS_NOEXCEPT
Addition of scalar.
Iterator2D begin() ARTS_NOEXCEPT
** Return const iterator to first row. Has to be redefined here, since it is
MatrixView & operator*=(Numeric x) ARTS_NOEXCEPT
Multiplication by scalar.
MatrixView & operator-=(Numeric x) ARTS_NOEXCEPT
Subtraction of scalar.
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
void resize(Index r, Index c)
Resize function.
virtual ~Matrix()
Destructor for Matrix.
Matrix & operator=(const Matrix &m)
Assignment operator from another matrix.
Index mstart
The start index.
constexpr Index get_extent() const noexcept
Returns the extent of the range.
constexpr Index get_start() const noexcept
Returns the start index of the range.
Index mextent
The number of elements.
constexpr Index get_stride() const noexcept
Returns the stride of the range.
VectorView operator+=(Numeric x) ARTS_NOEXCEPT
Addition of scalar.
VectorView operator-=(Numeric x) ARTS_NOEXCEPT
Subtraction of scalar.
VectorView & operator=(const ConstVectorView &v)
Assignment operator.
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array, const-version.
Numeric & operator[](Index n) ARTS_NOEXCEPT
Plain Index operator.
Iterator1D begin() ARTS_NOEXCEPT
Return iterator to first element.
VectorView operator*=(Numeric x) ARTS_NOEXCEPT
Multiplication by scalar.
Iterator1D end() ARTS_NOEXCEPT
Return iterator behind last element.
VectorView operator/=(Numeric x) ARTS_NOEXCEPT
Division by scalar.
virtual ~Vector()
Destructor for Vector.
void resize(Index n)
Resize function.
Vector & operator=(const Vector &v)
Assignment from another Vector.
const Numeric RAD2DEG
Global constant, conversion from radians to degrees.
#define ARTS_ASSERT(condition,...)
The declarations of all the exception classes.
Numeric mean(const ConstVectorView &x) ARTS_NOEXCEPT
Mean function, vector version.
ConstMatrixViewMap MapToEigenRow(const ConstVectorView &A)
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix-Vector Multiplication.
Numeric vector_angle(ConstVectorView a, ConstVectorView b)
Numeric max(const ConstVectorView &x) ARTS_NOEXCEPT
Max function, vector version.
ConstMatrixViewMap MapToEigen(const ConstMatrixView &A)
Numeric nanmean(const ConstVectorView &x) ARTS_NOEXCEPT
Mean function, vector version ignoring nans and infs.
ConstMatrixViewMap MapToEigenCol(const ConstVectorView &A)
void proj(Vector &c, ConstVectorView a, ConstVectorView b) ARTS_NOEXCEPT
void mult_general(VectorView y, const ConstMatrixView &M, const ConstVectorView &x) ARTS_NOEXCEPT
Matrix Vector multiplication.
std::ostream & operator<<(std::ostream &os, const Range &r)
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...
Matrix4x4ViewMap MapToEigen4x4(MatrixView &A)
void swap(Vector &v1, Vector &v2)
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b) ARTS_NOEXCEPT
cross3
Numeric min(const ConstVectorView &x) ARTS_NOEXCEPT
Min function, vector version.
void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Numeric debug_matrixview_get_elem(MatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
Numeric operator*(const ConstVectorView &a, const ConstVectorView &b) ARTS_NOEXCEPT
Scalar product.
ConstMatrixView transpose(ConstMatrixView m) ARTS_NOEXCEPT
Const version of transpose.
Implementation of Matrix, Vector, and such stuff.
Eigen::Map< const Matrix4x4Type, 0, StrideType > ConstMatrix4x4ViewMap
Eigen::Map< const MatrixType, 0, StrideType > ConstMatrixViewMap
Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > StrideType
Eigen::Map< MatrixType, 0, StrideType > MatrixViewMap
Eigen::Map< Matrix4x4Type, 0, StrideType > Matrix4x4ViewMap
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Workspace & init(Workspace &ws)
Index nelem(const Lines &l)
Number of lines.
constexpr std::string_view Joker
constexpr Rational start(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the lowest M for a polarization type of this transition.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Numeric sqrt(const Rational r)
Square root.