Go to the documentation of this file.
35 inline std::complex<float>
operator+(
const double& d,
36 const std::complex<float>& c) {
37 return (
float(d) + c);
39 inline std::complex<float>
operator*(
const double& d,
40 const std::complex<float>& c) {
41 return (
float(d) * c);
44 inline std::complex<float>
operator+(
const std::complex<float>& c,
46 return (c +
float(d));
48 inline std::complex<float>
operator*(
const std::complex<float>& c,
50 return (c *
float(d));
118 #define _complex_operations_(T) \
119 constexpr Complex operator+(Complex c, T x) { \
120 return operator+(c, static_cast<Numeric>(x)); \
122 constexpr Complex operator-(Complex c, T x) { \
123 return operator-(c, static_cast<Numeric>(x)); \
125 constexpr Complex operator*(Complex c, T x) { \
126 return operator*(c, static_cast<Numeric>(x)); \
128 constexpr Complex operator/(Complex c, T x) { \
129 return operator/(c, static_cast<Numeric>(x)); \
132 constexpr Complex operator+(T x, Complex c) { \
133 return operator+(static_cast<Numeric>(x), c); \
135 constexpr Complex operator-(T x, Complex c) { \
136 return operator-(static_cast<Numeric>(x), c); \
138 constexpr Complex operator*(T x, Complex c) { \
139 return operator*(static_cast<Numeric>(x), c); \
141 constexpr Complex operator/(T x, Complex c) { \
142 return operator/(static_cast<Numeric>(x), c); \
148 #undef _complex_operations_
166 typedef Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
169 typedef Eigen::Map<ComplexMatrixType, 0, ComplexStrideType>
171 typedef Eigen::Map<const ComplexMatrixType, 0, ComplexStrideType>
298 return reinterpret_cast<const Numeric(&)[2]
>(
get(n))[0];
303 return reinterpret_cast<const Numeric(&)[2]
>(
get(n))[1];
372 using ConstComplexVectorView::operator[];
400 return reinterpret_cast<Numeric(&)[2]
>(
get(n))[0];
405 return reinterpret_cast<Numeric(&)[2]
>(
get(n))[1];
736 using ConstComplexMatrixView::operator();
768 return reinterpret_cast<Numeric(&)[2]
>(
get(r, c))[0];
773 return reinterpret_cast<Numeric(&)[2]
>(
get(r, c))[1];
ComplexIterator1D & operator++()
Prefix increment operator.
constexpr ComplexVectorView(const ComplexVectorView &)=default
ComplexMatrixView & operator+=(const ConstComplexVectorView &x)
Numeric & get_real(Index n)
Get element implementation without assertions.
friend void swap(ComplexMatrix &m1, ComplexMatrix &m2)
Swaps two objects.
ComplexVectorView & operator=(const Vector &v)
MatrixView real()
Get a view of the real part of the matrix.
const Complex * get_c_array() const
Conversion to plain C-array.
ComplexVectorView & operator=(const VectorView &v)
Interface for the LAPACK library.
ComplexVectorView()=default
constexpr Complex conj(Complex c)
the conjugate of c
ConstComplexIterator2D begin() const
Return const iterator to first row.
Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > ComplexStrideType
Numeric & get_imag(Index n)
Get element implementation without assertions.
friend ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
Numeric get_imag(Index r, Index c) const
Get element implementation without assertions.
virtual ~ComplexMatrix()
Destructor for Matrix.
The const row iterator class for sub matrices.
ComplexVectorView & operator*()
Dereferencing.
ComplexIterator2D & operator++()
Prefix increment operator.
ConstComplexIterator1D(Complex *x, Index stride)
Explicit constructor.
ConstComplexVectorView & operator=(const ConstComplexVectorView &)=default
ConstComplexIterator2D const_iterator
constexpr ConstComplexVectorView(const ConstComplexVectorView &)=default
bool operator!=(const ConstComplexIterator1D &other) const
Not equal operator, needed for algorithms like copy.
ComplexVectorView & operator=(const ConstVectorView &v)
const ConstComplexVectorView * operator->() const
The -> operator is needed, so that we can write i->begin() to get t he 1D iterators.
ConstComplexIterator1D const_iterator
Vector y(Workspace &ws) noexcept
friend ComplexConstMatrixViewMap MapToEigen(const ConstComplexMatrixView &)
Complex & operator*() const
Dereferencing.
virtual ~ComplexVector()
Destructor for ComplexVector.
ConstComplexIterator2D & operator++()
Prefix increment operator.
const Numeric & get_imag(Index n) const
Get element implementation without assertions.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
ComplexIterator1D end()
Return iterator behind last element.
ComplexMatrixView()
Default constructor.
Complex & operator[](Index n)
Plain Index operator.
ComplexVector & operator=(ComplexVector v)
Assignment from another Vector.
bool operator!=(const ComplexIterator1D &other) const
Not equal operator, needed for algorithms like copy.
friend class ComplexMatrixView
Index mstart
The start index.
const Complex * get_c_array() const
Conversion to plain C-array.
ConstComplexMatrixView()=default
std::complex< Numeric > Complex
constexpr ConstComplexVectorView(ConstComplexVectorView &&)=default
ComplexVectorView msv
Current position.
const Complex & get(Index n) const
Get element implementation without assertions.
ComplexVectorView operator-=(Complex x)
Subtraction of scalar.
ComplexMatrixView & operator/=(const ConstComplexVectorView &x)
Array< ComplexMatrix > ArrayOfComplexMatrix
Numeric & get_real(Index r, Index c)
Get element implementation without assertions.
ComplexVectorView operator*=(Complex x)
Multiplication by scalar.
Implementation of Matrix, Vector, and such stuff.
const ConstComplexVectorView & operator*() const
Dereferencing.
ComplexMatrixView & operator=(const ConstComplexMatrixView &v)
Assignment operator.
This can be used to make arrays out of anything.
ComplexMatrixView & operator+=(Complex x)
Addition of scalar.
friend ComplexConstMatrixViewMap MapToEigen(const ConstComplexVectorView &)
virtual ~ComplexVectorView()=default
Destructor.
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
friend void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
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.
Index get_column_extent() const
Get the extent of the underlying data.
The row iterator class for sub matrices.
constexpr ComplexMatrixView(const ComplexMatrixView &)=default
ConstComplexIterator1D()=default
Default constructor.
ConstComplexIterator2D(const ConstComplexVectorView &x, Index stride)
Explicit constructor.
constexpr Numeric abs2(Complex c)
squared magnitude of c
Complex & operator()(Index r, Index c)
Plain index operator.
friend ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
ComplexIterator2D begin()
Return iterator to first row.
ComplexIterator1D(Complex *x, Index stride)
Explicit constructor.
ComplexMatrixView & operator-=(const ConstComplexVectorView &x)
ConstComplexVectorView()=default
ConstComplexIterator1D & operator++()
Prefix increment operator.
Eigen::Map< ComplexMatrixType, 0, ComplexStrideType > ComplexMatrixViewMap
friend void mult(ComplexVectorView, const ConstComplexMatrixView &, const ConstComplexVectorView &)
Matrix-Vector Multiplication.
NUMERIC Numeric
The type to use for all floating point numbers.
virtual ~ComplexMatrixView()=default
Destructor.
ComplexIterator2D()=default
Default constructor.
friend void mult(ComplexVectorView, const ConstComplexMatrixView &, const ConstComplexVectorView &)
Matrix-Vector Multiplication.
ComplexVector(const Vector &v)
const Numeric & get_real(Index n) const
Get element implementation without assertions.
VectorView imag()
Get a view of the imaginary part of the vector.
ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
ComplexVectorView & operator=(const ConstComplexVectorView &v)
Assignment operator.
const Complex & operator*() const
Dereferencing.
bool operator!=(const ComplexIterator2D &other) const
Not equal operator, needed for algorithms like copy.
Complex & get(Index n)
Get element implementation without assertions.
Eigen::Map< const ComplexMatrixType, 0, ComplexStrideType > ComplexConstMatrixViewMap
virtual ~ConstComplexMatrixView()=default
Destructor.
A constant view of a ComplexVector.
friend class ConstComplexMatrixView
std::ostream & operator<<(std::ostream &os, const ConstComplexVectorView &v)
Output operator.
MatrixView imag()
Get a view of the imaginary parts of the matrix.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
virtual ~ConstComplexVectorView()=default
Destructor.
void resize(Index n)
Resize function.
ComplexIterator2D(const ComplexVectorView &x, Index stride)
Explicit constructor.
std::complex< float > operator*(const double &d, const std::complex< float > &c)
A constant view of a Matrix.
constexpr Index get_extent() const
Returns the extent of the range.
const Complex & operator[](Index n) const
Plain const index operator.
Range mrr
The row range of mdata that is actually used.
ComplexVectorView & operator=(Numeric x)
Complex * mdata
Pointer to the plain C array that holds the data.
ComplexIterator1D begin()
Return iterator to first element.
The ComplexMatrixView class.
ConstComplexVectorView diagonal() const
ComplexMatrix diagonal as vector.
ComplexIterator1D()=default
Default constructor.
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.
ComplexMatrixView & operator*=(Complex x)
Multiplication by scalar.
ComplexVectorView & operator=(const Array< Numeric > &v)
ConstComplexIterator1D end() const
Return const iterator behind last element.
ConstVectorView real() const
Get a view of the real part of the vector.
ConstComplexMatrixView & operator=(ConstComplexMatrixView &&)=default
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.
ConstComplexIterator2D()=default
Default constructor.
constexpr ConstComplexMatrixView(ConstComplexMatrixView &&)=default
The constant iterator class for sub vectors.
friend Complex operator*(const ConstComplexVectorView &a, const ConstComplexVectorView &b)
Scalar product.
Complex get(Index r, Index c) const
Get element implementation without assertions.
ComplexVector()
Default constructor.
ConstComplexMatrixView & operator=(const ConstComplexMatrixView &)=default
std::complex< float > operator+(const double &d, const std::complex< float > &c)
ConstVectorView imag() const
Get a view of the imaginary part of the vector.
Complex get(Index r, Index c) const
Get element implementation without assertions.
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.
ComplexIterator2D iterator
Complex sum() const
Returns true if variable size is zero.
VectorView real()
Get a view of the real part of the vector.
friend void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
Complex & get(Index r, Index c)
Get element implementation without assertions.
ComplexMatrixView & operator*=(const ConstComplexVectorView &x)
Array< ComplexVector > ArrayOfComplexVector
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > ComplexMatrixType
friend ComplexConstMatrixViewMap MapToEigenCol(const ConstComplexVectorView &)
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
ConstMatrixView real() const
Get a view of the real part of the matrix.
bool operator!=(const ConstComplexIterator2D &other) const
Not equal operator, needed for algorithms like copy.
constexpr ConstComplexMatrixView(const ConstComplexMatrixView &)=default
constexpr Complex operator-(Complex c, Numeric n)
Complex * mx
Current position.
ConstComplexVectorView & operator=(ConstComplexVectorView &&)=default
ConstComplexVectorView msv
Current position.
ComplexConstMatrixViewMap MapToEigen(const ConstComplexMatrixView &A)
ComplexConstMatrixViewMap MapToEigenRow(const ConstComplexVectorView &A)
const Complex * mx
Current position.
A constant view of a Vector.
Numeric get_real(Index r, Index c) const
Get element implementation without assertions.
ComplexIterator1D iterator
ConstMatrixView imag() const
Get a view of the imaginary part of the matrix.
The ComplexVectorView class.
ComplexVectorView operator/=(Complex x)
Division by scalar.
const Complex & get(Index n) const
Get element implementation without assertions.
ComplexMatrixView & operator/=(Complex x)
Division by scalar.
Numeric & get_imag(Index r, Index c)
Get element implementation without assertions.
void resize(Index r, Index c)
Resize function.
ComplexConstMatrixViewMap MapToEigenCol(const ConstComplexVectorView &A)
ComplexMatrixView & operator-=(Complex x)
Subtraction of scalar.
#define _complex_operations_(T)
Complex operator()(Index r, Index c) const
Plain const index operator.
void mult(ComplexVectorView y, const ConstComplexMatrixView &M, const ConstComplexVectorView &x)
Matrix-Vector Multiplication.
Struct cannot be const, but can be passed as const to allow defaults.
constexpr Complex operator/(Complex c, Numeric n)
The iterator class for sub vectors.
ComplexVectorView * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
ComplexMatrix & inv(const lapack_help::Inverse< Complex > &help=lapack_help::Inverse< Complex >{0})