62 for (; i != e; ++i) s += *i;
71 const Range& r)
const {
100 : mrange(0, 1), mdata(&const_cast<
Complex&>(
a)) {
108 : mrange(range), mdata(data) {
125 : mrange(p, n), mdata(data) {
137 os << std::setw(3) << *i;
140 for (; i !=
end; ++i) {
141 os <<
" " << std::setw(3) << *i;
154 "Creating a ComplexVectorView from a const ComplexVector is not allowed.\n"
155 "This is not really a runtime error, but I don't want to start\n"
156 "producing direct output from inside matpack. And just exiting is\n"
158 "If you see this error, there is a bug in the code, not in the\n"
312 for (; i != e; ++i, ++s) *i *= *s;
325 for (; i != e; ++i, ++s) *i *= *s;
339 for (; i != e; ++i, ++s) *i /= *s;
352 for (; i != e; ++i, ++s) *i /= *s;
366 for (; i != e; ++i, ++s) *i += *s;
379 for (; i != e; ++i, ++s) *i += *s;
393 for (; i != e; ++i, ++s) *i -= *s;
406 for (; i != e; ++i, ++s) *i -= *s;
428 "A ComplexVectorView can only be converted to a plain C-array if it's pointing to a continuous block of data");
440 "A ComplexVectorView can only be converted to a plain C-array if it's pointing to a continuous block of data");
483 memcpy((
void*)target.
mx,
487 for (; origin !=
end; ++origin, ++target) *target = *origin;
492 for (; target !=
end; ++target) *target = x;
536 for (; i != e; ++i) {
556 for (; i != e; ++i) {
576 for (; i != e; ++i) {
596 for (; i != e; ++i) {
626 auto vec_it_end =
v.end();
628 for (
auto vec_it =
v.begin();
629 vec_it != vec_it_end;
637 auto vec_it_end =
v.end();
639 for (
auto vec_it =
v.begin();
640 vec_it != vec_it_end;
671 const auto n =
v.nelem();
674 auto* in =
v.mdata +
v.mrange.mstart;
675 auto*
end =
v.mdata + n;
681 in +=
v.mrange.mstride;
844 : mrr(rr), mcr(cr), mdata(data) {
867 : mrr(pr, nr), mcr(pc, nc), mdata(data) {
888 os << std::setw(3) << *ic;
891 for (; ic != end_col; ++ic) {
892 os <<
" " << std::setw(3) << *ic;
896 for (; ir != end_row; ++ir) {
902 os << std::setw(3) << *ic;
905 for (; ic != end_col; ++ic) {
906 os <<
" " << std::setw(3) << *ic;
1127 "A MatrixView can only be converted to a plain C-array if it's pointing to a continuous block of data");
1140 "A MatrixView can only be converted to a plain C-array if it's pointing to a continuous block of data");
1152 for (; r != er; ++r, ++sr) {
1156 for (;
c != ec; ++
c, ++sc) *
c *= *sc;
1168 for (; r != er; ++r, ++sr) {
1172 for (;
c != ec; ++
c, ++sc) *
c *= *sc;
1185 for (; r != er; ++r, ++sr) {
1189 for (;
c != ec; ++
c, ++sc) *
c /= *sc;
1201 for (; r != er; ++r, ++sr) {
1205 for (;
c != ec; ++
c, ++sc) *
c /= *sc;
1218 for (; r != er; ++r, ++sr) {
1222 for (;
c != ec; ++
c, ++sc) *
c += *sc;
1234 for (; r != er; ++r, ++sr) {
1238 for (;
c != ec; ++
c, ++sc) *
c += *sc;
1251 for (; r != er; ++r, ++sr) {
1255 for (;
c != ec; ++
c, ++sc) *
c -= *sc;
1267 for (; r != er; ++r, ++sr) {
1271 for (;
c != ec; ++
c, ++sc) *
c -= *sc;
1327 for (; origin !=
end; ++origin, ++target) {
1331 for (; o != e; ++o, ++t) *t = *o;
1337 for (; target !=
end; ++target) {
1340 for (; t != e; ++t) *t = x;
1346 for (; target !=
end; ++target) {
1349 for (; t != e; ++t) *t = x;
1385 Range(0, m.nrows(), m.ncols()),
1386 Range(0, m.ncols())) {
1394 Range(0, m.nrows(), m.ncols()),
1395 Range(0, m.ncols())) {
1510 "Error inverting matrix: Matrix not of full rank.");
1549 const auto e =
v.end();
1553 for (; i != e; ++i, ++target) *target = *i;
1571 for (; ai != ae; ++ai, ++bi) res += (*ai) * (*bi);
Interface for BLAS library.
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
The iterator class for sub vectors.
Complex * mx
Current position.
The row iterator class for sub matrices.
The ComplexMatrixView class.
ComplexMatrixView & operator/=(Complex x)
Division by scalar.
ComplexVectorView diagonal()
ComplexMatrix diagonal as vector.
Complex & operator()(Index r, Index c)
Plain index operator.
ComplexMatrixView & operator+=(Complex x)
Addition of scalar.
ComplexIterator2D end()
Return iterator behind last row.
ComplexMatrixView & operator=(const ConstComplexMatrixView &v)
Assignment operator.
ComplexMatrixView & operator-=(Complex x)
Subtraction of scalar.
const Complex * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
ComplexMatrixView()
Default constructor.
ComplexMatrixView & operator*=(Complex x)
Multiplication by scalar.
friend class ComplexVectorView
ComplexIterator2D begin()
Return iterator to first row.
void resize(Index r, Index c)
Resize function.
ComplexMatrix & inv(const lapack_help::Inverse< Complex > &help=lapack_help::Inverse< Complex >{0})
~ComplexMatrix() override
Destructor for Matrix.
ComplexMatrix & operator=(ComplexMatrix x)
Assignment operator from another matrix.
friend void swap(ComplexMatrix &m1, ComplexMatrix &m2)
Swaps two objects.
The ComplexVectorView class.
ComplexVectorView operator-=(Complex x)
Subtraction of scalar.
ComplexVectorView operator+=(Complex x)
Addition of scalar.
ComplexVectorView operator*=(Complex x)
Multiplication by scalar.
ComplexVectorView & operator=(const ConstComplexVectorView &v)
Assignment operator.
ComplexVectorView()=default
ComplexIterator1D end()
Return iterator behind last element.
Complex & operator[](Index n)
Plain Index operator.
ComplexVectorView operator/=(Complex x)
Division by scalar.
const Complex * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
ComplexIterator1D begin()
Return iterator to first element.
void resize(Index n)
Resize function.
ComplexVector & operator=(const ComplexVector &v)
Assignment from another Vector.
~ComplexVector() override
Destructor for ComplexVector.
The constant iterator class for sub vectors.
const Complex * mx
Current position.
The const row iterator class for sub matrices.
A constant view of a ComplexMatrix.
friend class ConstComplexVectorView
ConstComplexIterator2D begin() const
Return const iterator to first row.
Range mcr
The column range of mdata that is actually used.
ConstComplexVectorView diagonal() const
ComplexMatrix diagonal as vector.
Complex operator()(Index r, Index c) const
Plain const index operator.
Complex * mdata
Pointer to the plain C array that holds the data.
Index ncols() const noexcept
ConstComplexMatrixView()=default
Range mrr
The row range of mdata that is actually used.
Index nrows() const noexcept
ConstComplexIterator2D end() const
Return const iterator behind last row.
A constant view of a ComplexVector.
Complex sum() const
Returns true if variable size is zero.
ConstComplexIterator1D end() const
Return const iterator behind last element.
Range mrange
The range of mdata that is actually used.
ConstComplexVectorView()=default
Complex * mdata
Pointer to the plain C array that holds the data.
ConstComplexIterator1D begin() const
Return const iterator to first element.
Index nelem() const noexcept
const Complex & operator[](Index n) const
Plain const index operator.
The constant iterator class for sub vectors.
The const row iterator class for sub matrices.
A constant view of a Matrix.
ConstIterator2D begin() const ARTS_NOEXCEPT
Return const iterator to first row.
Index nrows() const noexcept
Index ncols() const noexcept
A constant view of a Vector.
ConstIterator1D begin() const ARTS_NOEXCEPT
Return const iterator to first element.
Index nelem() const noexcept
Returns the number of elements.
Index mstart
The start index.
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.
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR_IF(condition,...)
The declarations of all the exception classes.
Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > StrideType
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
Complex debug_matrixview_get_elem(ComplexMatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
Complex operator*(const ConstComplexVectorView &a, const ConstComplexVectorView &b)
Scalar product.
std::ostream & operator<<(std::ostream &os, const ConstComplexVectorView &v)
Output operator.
ConstComplexMatrixViewMap MapToEigenRow(const ConstComplexVectorView &A)
ConstComplexMatrixViewMap MapToEigen(const ConstComplexMatrixView &A)
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
ConstComplexMatrixViewMap MapToEigenCol(const ConstComplexVectorView &A)
void mult(ComplexVectorView y, const ConstComplexMatrixView &M, const ConstComplexVectorView &x)
Matrix-Vector Multiplication.
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
std::complex< Numeric > Complex
Eigen::Map< const ComplexMatrixType, 0, StrideType > ConstComplexMatrixViewMap
Eigen::Map< ComplexMatrixType, 0, StrideType > ComplexMatrixViewMap
Index nelem(const Lines &l)
Number of lines.
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.
void zgetri_(int *n, std::complex< double > *A, int *lda, int *ipiv, std::complex< double > *work, int *lwork, int *info)
void zgetrf_(int *m, int *n, std::complex< double > *A, int *lda, int *ipiv, int *info)
Struct cannot be const, but can be passed as const to allow defaults.
T * workdata() const noexcept
bool resize_if_smaller(Index N) const
int * lsize() const noexcept
int * size() const noexcept
int * ipivdata() const noexcept