Go to the documentation of this file.
32 using std::runtime_error;
64 for (; i != e; ++i) s += *i;
73 const Range& r)
const {
102 : mrange(0, 1), mdata(&const_cast<
Complex&>(a)) {
110 : mrange(range), mdata(
data) {
127 : mrange(p, n), mdata(
data) {
142 for (; i !=
end; ++i) {
143 os <<
" " << setw(3) << *i;
156 "Creating a ComplexVectorView from a const ComplexVector is not allowed.");
300 assert(
nelem() ==
x.nelem());
307 for (; i != e; ++i, ++s) *i *= *s;
320 for (; i != e; ++i, ++s) *i *= *s;
327 assert(
nelem() ==
x.nelem());
334 for (; i != e; ++i, ++s) *i /= *s;
340 assert(
nelem() ==
x.nelem());
347 for (; i != e; ++i, ++s) *i /= *s;
354 assert(
nelem() ==
x.nelem());
361 for (; i != e; ++i, ++s) *i += *s;
367 assert(
nelem() ==
x.nelem());
374 for (; i != e; ++i, ++s) *i += *s;
381 assert(
nelem() ==
x.nelem());
388 for (; i != e; ++i, ++s) *i -= *s;
394 assert(
nelem() ==
x.nelem());
401 for (; i != e; ++i, ++s) *i -= *s;
424 "A ComplexVectorView can only be converted to a plain C-array if it's pointing to a continuous block of data");
438 "A VectorView can only be converted to a plain C-array if it's pointing to a continuous block of data");
482 memcpy((
void*)target.
mx,
486 for (; origin !=
end; ++origin, ++target) *target = *origin;
491 for (; target !=
end; ++target) *target =
x;
540 for (; i != e; ++i) {
560 for (; i != e; ++i) {
580 for (; i != e; ++i) {
600 for (; i != e; ++i) {
626 std::vector<Complex>::const_iterator vec_it_end = v.
end();
628 for (std::vector<Complex>::const_iterator vec_it = v.begin();
629 vec_it != vec_it_end;
637 std::vector<Numeric>::const_iterator vec_it_end = v.
end();
639 for (std::vector<Numeric>::const_iterator vec_it = v.begin();
640 vec_it != vec_it_end;
832 : mrr(rr), mcr(cr), mdata(
data) {
855 : mrr(pr, nr), mcr(pc, nc), mdata(
data) {
876 os << setw(3) << *ic;
879 for (; ic != end_col; ++ic) {
880 os <<
" " << setw(3) << *ic;
884 for (; ir != end_row; ++ir) {
890 os << setw(3) << *ic;
893 for (; ic != end_col; ++ic) {
894 os <<
" " << setw(3) << *ic;
1115 throw std::runtime_error(
1116 "A MatrixView can only be converted to a plain C-array if it's pointing to a continuous block of data");
1130 throw std::runtime_error(
1131 "A MatrixView can only be converted to a plain C-array if it's pointing to a continuous block of data");
1139 assert(
nrows() ==
x.nrows());
1140 assert(
ncols() ==
x.ncols());
1144 for (; r != er; ++r, ++sr) {
1148 for (; c != ec; ++c, ++sc) *c *= *sc;
1155 assert(
nrows() ==
x.nrows());
1156 assert(
ncols() ==
x.ncols());
1160 for (; r != er; ++r, ++sr) {
1164 for (; c != ec; ++c, ++sc) *c *= *sc;
1172 assert(
nrows() ==
x.nrows());
1173 assert(
ncols() ==
x.ncols());
1177 for (; r != er; ++r, ++sr) {
1181 for (; c != ec; ++c, ++sc) *c /= *sc;
1188 assert(
nrows() ==
x.nrows());
1189 assert(
ncols() ==
x.ncols());
1193 for (; r != er; ++r, ++sr) {
1197 for (; c != ec; ++c, ++sc) *c /= *sc;
1205 assert(
nrows() ==
x.nrows());
1206 assert(
ncols() ==
x.ncols());
1210 for (; r != er; ++r, ++sr) {
1214 for (; c != ec; ++c, ++sc) *c += *sc;
1221 assert(
nrows() ==
x.nrows());
1222 assert(
ncols() ==
x.ncols());
1226 for (; r != er; ++r, ++sr) {
1230 for (; c != ec; ++c, ++sc) *c += *sc;
1238 assert(
nrows() ==
x.nrows());
1239 assert(
ncols() ==
x.ncols());
1243 for (; r != er; ++r, ++sr) {
1247 for (; c != ec; ++c, ++sc) *c -= *sc;
1254 assert(
nrows() ==
x.nrows());
1255 assert(
ncols() ==
x.ncols());
1259 for (; r != er; ++r, ++sr) {
1263 for (; c != ec; ++c, ++sc) *c -= *sc;
1319 for (; origin !=
end; ++origin, ++target) {
1323 for (; o != e; ++o, ++t) *t = *o;
1329 for (; target !=
end; ++target) {
1332 for (; t != e; ++t) *t =
x;
1338 for (; target !=
end; ++target) {
1341 for (; t != e; ++t) *t =
x;
1501 if (info not_eq 0) {
1502 throw runtime_error(
"Error inverting matrix: Matrix not of full rank.");
1546 for (; i != e; ++i, ++target) *target = *i;
1564 for (; ai != ae; ++ai, ++bi) res += (*ai) * (*bi);
1582 assert(
x.nelem() ==
M.nrows());
1583 assert(
y.nelem() ==
M.ncols());
1586 if (
y.mdata ==
x.mdata)
std::ostream & operator<<(std::ostream &os, const ConstComplexVectorView &v)
Output operator.
friend void swap(ComplexMatrix &m1, ComplexMatrix &m2)
Swaps two objects.
The declarations of all the exception classes.
friend class ConstComplexVectorView
const Complex * get_c_array() const
Conversion to plain C-array.
ComplexVectorView()=default
ConstComplexIterator2D begin() const
Return const iterator to first row.
Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > ComplexStrideType
The constant iterator class for sub vectors.
virtual ~ComplexMatrix()
Destructor for Matrix.
The const row iterator class for sub matrices.
void mult(ComplexVectorView y, const ConstComplexMatrixView &M, const ConstComplexVectorView &x)
Matrix-Vector Multiplication.
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
Vector y(Workspace &ws) noexcept
Complex operator*(const ConstComplexVectorView &a, const ConstComplexVectorView &b)
Scalar product.
virtual ~ComplexVector()
Destructor for ComplexVector.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
ComplexIterator1D end()
Return iterator behind last element.
ComplexMatrixView()
Default constructor.
Index nrows() const
Returns the number of rows.
Complex & operator[](Index n)
Plain Index operator.
ComplexVector & operator=(ComplexVector v)
Assignment from another Vector.
Index mstart
The start index.
const Complex * get_c_array() const
Conversion to plain C-array.
ConstComplexMatrixView()=default
std::complex< Numeric > Complex
ComplexVectorView operator-=(Complex x)
Subtraction of scalar.
constexpr Index get_start() const
Returns the start index of the range.
ComplexVectorView operator*=(Complex x)
Multiplication by scalar.
A class implementing complex numbers for ARTS.
ComplexMatrixView & operator=(const ConstComplexMatrixView &v)
Assignment operator.
This can be used to make arrays out of anything.
ComplexMatrixView & operator+=(Complex x)
Addition of scalar.
Index nelem(const Lines &l)
Number of lines.
ComplexConstMatrixViewMap MapToEigen(const ConstComplexMatrixView &A)
T * workdata() const noexcept
ConstComplexIterator2D end() const
Return const iterator behind last row.
Range mcr
The column range of mdata that is actually used.
ComplexVectorView operator+=(Complex x)
Addition of scalar.
The row iterator class for sub matrices.
Index ncols() const
Returns the number of columns.
Complex & operator()(Index r, Index c)
Plain index operator.
void zgetri_(int *n, std::complex< double > *A, int *lda, int *ipiv, std::complex< double > *work, int *lwork, int *info)
ComplexConstMatrixViewMap MapToEigenRow(const ConstComplexVectorView &A)
ComplexIterator2D begin()
Return iterator to first row.
int * size() const noexcept
ConstComplexVectorView()=default
ConstIterator1D begin() const
Return const iterator to first element.
Eigen::Map< ComplexMatrixType, 0, ComplexStrideType > ComplexMatrixViewMap
NUMERIC Numeric
The type to use for all floating point numbers.
friend class ComplexVectorView
ComplexVectorView & operator=(const ConstComplexVectorView &v)
Assignment operator.
Eigen::Map< const ComplexMatrixType, 0, ComplexStrideType > ComplexConstMatrixViewMap
A constant view of a ComplexVector.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
void resize(Index n)
Resize function.
The const row iterator class for sub matrices.
A constant view of a Matrix.
const Complex & operator[](Index n) const
Plain const index operator.
Interface for BLAS library.
Index nrows(Workspace &ws) noexcept
Range mrr
The row range of mdata that is actually used.
Complex * mdata
Pointer to the plain C array that holds the data.
constexpr Index get_stride() const
Returns the stride of the range.
ComplexIterator1D begin()
Return iterator to first element.
The ComplexMatrixView class.
ConstComplexVectorView diagonal() const
ComplexMatrix diagonal as vector.
friend void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
Range mrange
The range of mdata that is actually used.
Index mextent
The number of elements.
ComplexMatrix & operator=(ComplexMatrix x)
Assignment operator from another matrix.
bool resize_if_smaller(Index N) const
ComplexMatrixView & operator*=(Complex x)
Multiplication by scalar.
ConstComplexIterator1D end() const
Return const iterator behind last element.
constexpr Rational start(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the lowest M for a polarization type of this transition.
ComplexIterator2D end()
Return iterator behind last row.
ComplexVectorView diagonal()
ComplexMatrix diagonal as vector.
The constant iterator class for sub vectors.
void zgetrf_(int *m, int *n, std::complex< double > *A, int *lda, int *ipiv, int *info)
int * ipivdata() const noexcept
ComplexVector()
Default constructor.
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
Complex * mdata
Pointer to the plain C array that holds the data.
A constant view of a ComplexMatrix.
ConstComplexIterator1D begin() const
Return const iterator to first element.
Complex sum() const
Returns true if variable size is zero.
int * lsize() const noexcept
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
Complex * mx
Current position.
Index ncols(Workspace &ws) noexcept
ComplexConstMatrixViewMap MapToEigenCol(const ConstComplexVectorView &A)
const Complex * mx
Current position.
Complex debug_matrixview_get_elem(ComplexMatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
A constant view of a Vector.
Index nelem() const
Number of elements.
The ComplexVectorView class.
ComplexVectorView operator/=(Complex x)
Division by scalar.
ComplexMatrixView & operator/=(Complex x)
Division by scalar.
void resize(Index r, Index c)
Resize function.
ComplexMatrixView & operator-=(Complex x)
Subtraction of scalar.
Complex operator()(Index r, Index c) const
Plain const index operator.
Struct cannot be const, but can be passed as const to allow defaults.
The iterator class for sub vectors.
ComplexMatrix & inv(const lapack_help::Inverse< Complex > &help=lapack_help::Inverse< Complex >{0})