ARTS 2.5.10 (git: 2f1c442c)
|
A constant view of a ComplexVector. More...
#include <matpack_complex.h>
Public Types | |
using | const_iterator = ConstComplexIterator1D |
Public Member Functions | |
constexpr | ConstComplexVectorView (const ConstComplexVectorView &)=default |
constexpr | ConstComplexVectorView (ConstComplexVectorView &&)=default |
ConstComplexVectorView & | operator= (const ConstComplexVectorView &)=default |
ConstComplexVectorView & | operator= (ConstComplexVectorView &&)=default |
bool | empty () const noexcept |
Index | nelem () const noexcept |
Index | size () const noexcept |
Complex | sum () const |
Returns true if variable size is zero. | |
const Complex & | operator[] (Index n) const |
Plain const index operator. | |
const Complex & | get (Index n) const |
Get element implementation without assertions. | |
const Numeric & | get_real (Index n) const |
Get element implementation without assertions. | |
const Numeric & | get_imag (Index n) const |
Get element implementation without assertions. | |
ConstVectorView | real () const |
Get a view of the real part of the vector. | |
ConstVectorView | imag () const |
Get a view of the imaginary part of the vector. | |
ConstComplexVectorView | operator[] (const Range &r) const |
Const index operator for subrange. | |
ConstComplexIterator1D | begin () const |
Return const iterator to first element. | |
ConstComplexIterator1D | end () const |
Return const iterator behind last element. | |
operator ConstComplexMatrixView () const | |
Conversion to const 1 column matrix. | |
virtual | ~ConstComplexVectorView ()=default |
Destructor. | |
ConstComplexVectorView (const Complex &a) | |
A special constructor, which allows to make a ConstComplexVectorView from a scalar. | |
Index | selem () const noexcept |
Start element in memory. | |
Index | delem () const noexcept |
Steps in memory between elements. | |
Complex * | get_c_array () const noexcept |
Static Public Attributes | |
static constexpr bool | matpack_type {true} |
Protected Member Functions | |
ConstComplexVectorView ()=default | |
ConstComplexVectorView (Complex *data, const Range &range) | |
Explicit constructor. | |
ConstComplexVectorView (Complex *data, const Range &p, const Range &n) | |
Recursive constructor. | |
Protected Attributes | |
Range | mrange {0, 0} |
The range of mdata that is actually used. | |
Complex * | mdata {nullptr} |
Pointer to the plain C array that holds the data. | |
Friends | |
class | ComplexVectorView |
class | ConstComplexIterator2D |
class | ConstComplexMatrixView |
Complex | operator* (const ConstComplexVectorView &a, const ConstComplexVectorView &b) |
Scalar product. | |
void | mult (ComplexVectorView, const ConstComplexMatrixView &, const ConstComplexVectorView &) |
Matrix-Vector Multiplication. | |
std::ostream & | operator<< (std::ostream &os, const ConstComplexVectorView &v) |
Output operator. | |
A constant view of a ComplexVector.
Together with the derived class ComplexVectorView this contains the main implementation of a ComplexVector. The class ComplexVector is just a special case of a ComplexVectorView which also allocates storage.
Definition at line 285 of file matpack_complex.h.
Definition at line 295 of file matpack_complex.h.
|
constexprdefault |
|
constexprdefault |
|
virtualdefault |
Destructor.
ConstComplexVectorView::ConstComplexVectorView | ( | const Complex & | a | ) |
A special constructor, which allows to make a ConstComplexVectorView from a scalar.
This one is a bit tricky: We have to cast away the arguments const qualifier, because mdata is not const. This should be safe, since there are no non-const methods for ConstComplexVectorView.
Definition at line 100 of file matpack_complex.cc.
|
protecteddefault |
Referenced by operator[]().
Explicit constructor.
This one is used by Vector to initialize its own VectorView part.
Definition at line 107 of file matpack_complex.cc.
|
protected |
Recursive constructor.
This is used to construct sub ranges from sub ranges. That means that the new range has to be interpreted relative to the original range. The new range may contain -1 for the extent which acts as a joker. However, the used Range constructor converts this to an explicit range, consistent with the original Range.
*data | The actual data. |
p | Previous range. |
n | New Range. |
Definition at line 123 of file matpack_complex.cc.
ConstComplexIterator1D ConstComplexVectorView::begin | ( | ) | const |
Return const iterator to first element.
Definition at line 77 of file matpack_complex.cc.
References mdata, mrange, Range::mstart, and Range::mstride.
Referenced by copy(), ComplexMatrixView::operator*=(), ComplexVectorView::operator*=(), ComplexMatrixView::operator+=(), ComplexVectorView::operator+=(), ComplexMatrixView::operator-=(), ComplexVectorView::operator-=(), ComplexMatrixView::operator/=(), and sum().
|
inlinenoexcept |
Steps in memory between elements.
Definition at line 363 of file matpack_complex.h.
References mrange, and Range::mstride.
|
inlinenoexcept |
Definition at line 298 of file matpack_complex.h.
References nelem().
ConstComplexIterator1D ConstComplexVectorView::end | ( | ) | const |
Return const iterator behind last element.
Definition at line 82 of file matpack_complex.cc.
References mdata, Range::mextent, mrange, Range::mstart, and Range::mstride.
Get element implementation without assertions.
Definition at line 312 of file matpack_complex.h.
References mdata, mrange, Range::mstart, and Range::mstride.
Referenced by get_imag(), get_real(), and operator[]().
|
inlinenoexcept |
Get element implementation without assertions.
Definition at line 322 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 317 of file matpack_complex.h.
ConstVectorView ConstComplexVectorView::imag | ( | ) | const |
Get a view of the imaginary part of the vector.
Definition at line 662 of file matpack_complex.cc.
References mdata, Range::mextent, mrange, Range::mstart, and Range::mstride.
Referenced by get_imag().
|
inlinenoexcept |
Definition at line 299 of file matpack_complex.h.
References Range::mextent, and mrange.
Referenced by ComplexVector::ComplexVector(), diagonalize(), empty(), ComplexVectorView::operator*=(), ComplexVectorView::operator+=(), ComplexVectorView::operator-=(), ComplexVectorView::operator/=(), ComplexVector::shape(), and Absorption::LineMixing::EquivalentLines::sort_by_frequency().
ConstComplexVectorView::operator ConstComplexMatrixView | ( | ) | const |
Conversion to const 1 column matrix.
Definition at line 89 of file matpack_complex.cc.
|
default |
|
default |
ConstComplexVectorView ConstComplexVectorView::operator[] | ( | const Range & | r | ) | const |
Const index operator for subrange.
We have to also account for the case, that *this is already a subrange of a Vector. This allows correct recursive behavior.
Definition at line 71 of file matpack_complex.cc.
References ConstComplexVectorView(), mdata, and mrange.
Plain const index operator.
Definition at line 305 of file matpack_complex.h.
References ARTS_ASSERT, get(), Range::mextent, and mrange.
ConstVectorView ConstComplexVectorView::real | ( | ) | const |
Get a view of the real part of the vector.
Definition at line 656 of file matpack_complex.cc.
References mdata, Range::mextent, mrange, Range::mstart, and Range::mstride.
Referenced by get_real().
|
inlinenoexcept |
Start element in memory.
Definition at line 360 of file matpack_complex.h.
References mrange, and Range::mstart.
|
inlinenoexcept |
Definition at line 300 of file matpack_complex.h.
References Range::mextent, and mrange.
Referenced by ComplexVector::operator=().
Complex ConstComplexVectorView::sum | ( | ) | const |
Returns true if variable size is zero.
Returns the number of elements. The names ‘size’ and ‘length’ are already used by STL functions returning size_t. To avoid confusion we choose the name ‘nelem’. This is also more consistent with ‘nrow’ and ‘ncol’ for matrices.
The value range of long, which is used to store the index is on a PC from -2147483648 to 2147483647. This means that a 15GB large array of float can be addressed with this index. So the extra bit that size_t has compared to long is not needed. The sum of all elements of a Vector.
Definition at line 58 of file matpack_complex.cc.
|
friend |
Definition at line 347 of file matpack_complex.h.
|
friend |
Definition at line 348 of file matpack_complex.h.
|
friend |
Definition at line 349 of file matpack_complex.h.
|
friend |
Matrix-Vector Multiplication.
Uses the Eigen library. Be carful to test the size of your input beforehand.
For left-hand multiplication, please use pure matrix-mult.
[out] | y | The length-m ComplexVectorView where the result is stored. |
[in] | M | Reference to the m-times-n Const{Complex,}MatrixView holding the matrix M. |
[in] | x | Reference to the length-n Const{Complex,}VectorView holding the vector x. |
Definition at line 1580 of file matpack_complex.cc.
|
friend |
Scalar product.
The two vectors may be identical.
Definition at line 1555 of file matpack_complex.cc.
|
friend |
Output operator.
This demonstrates how iterators can be used to traverse the vector. The iterators know which part of the vector is ‘active’, and also the stride.
Definition at line 133 of file matpack_complex.cc.
|
staticconstexpr |
Definition at line 287 of file matpack_complex.h.
Referenced by test_concepts().
|
protected |
Pointer to the plain C array that holds the data.
Definition at line 378 of file matpack_complex.h.
Referenced by ComplexVectorView::begin(), begin(), ComplexVector::ComplexVector(), ComplexVectorView::ComplexVectorView(), ComplexVectorView::end(), end(), ComplexVectorView::get(), get(), ConstComplexMatrixView::get(), get_c_array(), ConstComplexMatrixView::get_c_array(), ComplexVectorView::imag(), imag(), mult(), ComplexIterator2D::operator!=(), ConstComplexIterator2D::operator!=(), ComplexIterator2D::operator++(), ConstComplexIterator2D::operator++(), ComplexVector::operator=(), ComplexVectorView::operator[](), operator[](), ComplexVectorView::real(), real(), and ComplexVector::~ComplexVector().
|
protected |
The range of mdata that is actually used.
Definition at line 376 of file matpack_complex.h.
Referenced by ComplexVectorView::begin(), begin(), ComplexVectorView::ComplexVectorView(), delem(), ComplexVectorView::end(), end(), ComplexVectorView::get(), get(), ComplexVectorView::imag(), imag(), nelem(), ComplexIterator2D::operator!=(), ConstComplexIterator2D::operator!=(), ComplexVector::operator=(), ComplexVectorView::operator=(), ComplexVectorView::operator[](), operator[](), ComplexVectorView::real(), real(), selem(), and size().