ARTS 2.5.0 (git: 9ee3ac6c)
propagationmatrix.h File Reference

Stuff related to the propagation matrix. More...

#include "matpack_complex.h"
#include "matpackIV.h"

Go to the source code of this file.

Classes

class  LazyScale< base >
 Class to help with hidden temporary variables for operations of type Numeric times Class. More...
 
class  PropagationMatrix
 
class  StokesVector
 Stokes vector is as Propagation matrix but only has 4 possible values. More...
 

Macros

#define a   vec[0]
 
#define b   vec[1]
 
#define c   vec[2]
 
#define d   vec[3]
 
#define u   vec[N]
 
#define v   vec[5]
 
#define w   vec[6]
 
#define a   vec[0]
 
#define b   vec[1]
 
#define c   vec[2]
 
#define d   vec[3]
 
#define u   vec[N]
 
#define v   vec[5]
 
#define w   vec[6]
 

Typedefs

using ArrayOfPropagationMatrix = Array< PropagationMatrix >
 
using ArrayOfArrayOfPropagationMatrix = Array< ArrayOfPropagationMatrix >
 
using ArrayOfStokesVector = Array< StokesVector >
 
using ArrayOfArrayOfStokesVector = Array< ArrayOfStokesVector >
 
using ArrayOfArrayOfArrayOfStokesVector = Array< ArrayOfArrayOfStokesVector >
 

Functions

template<int N>
Eigen::Matrix< Numeric, N, Nprop_matrix (const ConstVectorView &vec)
 
template<int N>
Eigen::Matrix< Numeric, N, Nprop_matrix (const ConstMatrixView &m)
 
template<int N>
Eigen::Matrix< Numeric, N, Ninv_prop_matrix (const ConstVectorView &vec)
 
template<bool matrix>
constexpr Index need2stokes (Index nstokes_needed)
 
template<bool matrix>
constexpr Index stokes2need (Index nstokes)
 
void compute_transmission_matrix (Tensor3View T, const Numeric &r, const PropagationMatrix &upper_level, const PropagationMatrix &lower_level, const Index iz=0, const Index ia=0)
 Compute the matrix exponent as the transmission matrix of this propagation matrix. More...
 
void compute_transmission_matrix_from_averaged_matrix_at_frequency (MatrixView T, const Numeric &r, const PropagationMatrix &averaged_propagation_matrix, const Index iv, const Index iz=0, const Index ia=0)
 Compute the matrix exponent as the transmission matrix of this propagation matrix. More...
 
void compute_transmission_matrix_and_derivative (Tensor3View T, Tensor4View dT_upper_level, Tensor4View dT_lower_level, const Numeric &r, const PropagationMatrix &upper_level, const PropagationMatrix &lower_level, const Array< PropagationMatrix > &dprop_mat_upper_level, const Array< PropagationMatrix > &dprop_mat_lower_level, const Numeric &dr_dTu=0.0, const Numeric &dr_dTl=0.0, const Index it=-1, const Index iz=0, const Index ia=0)
 
std::ostream & operator<< (std::ostream &os, const PropagationMatrix &pm)
 output operator More...
 
std::ostream & operator<< (std::ostream &os, const ArrayOfPropagationMatrix &apm)
 output operator More...
 
std::ostream & operator<< (std::ostream &os, const ArrayOfArrayOfPropagationMatrix &aapm)
 output operator More...
 
std::ostream & operator<< (std::ostream &os, const StokesVector &pm)
 
std::ostream & operator<< (std::ostream &os, const ArrayOfStokesVector &apm)
 
std::ostream & operator<< (std::ostream &os, const ArrayOfArrayOfStokesVector &aapm)
 
LazyScale< PropagationMatrixoperator* (const PropagationMatrix &pm, const Numeric &x)
 Returns a lazy multiplier. More...
 
LazyScale< PropagationMatrixoperator* (const Numeric &x, const PropagationMatrix &pm)
 Returns a lazy multiplier. More...
 
template<class T >
bool bad_propmat (const Array< T > &main, const Vector &f_grid, const Index sd=1) noexcept
 Checks if a Propagation Matrix or something similar has good grids. More...
 

Detailed Description

Stuff related to the propagation matrix.

Author
Richard Larsson
Date
2017-06-23

This implementation takes advantage of symmetries to lower memory and computational costs

Some standard functions applied on the propagation matrix have been included but far from all.

Present support is for stokes dim 1-4 however please take note that circular polarization delay variable's position in the internal mdata structure moves depending on if stokes_dim is 3 or 4. It is not present elsewhere...

Definition in file propagationmatrix.h.

Macro Definition Documentation

◆ a [1/2]

#define a   vec[0]

◆ a [2/2]

#define a   vec[0]

◆ b [1/2]

#define b   vec[1]

◆ b [2/2]

#define b   vec[1]

◆ c [1/2]

#define c   vec[2]

◆ c [2/2]

#define c   vec[2]

◆ d [1/2]

#define d   vec[3]

◆ d [2/2]

#define d   vec[3]

◆ u [1/2]

#define u   vec[N]

◆ u [2/2]

#define u   vec[N]

◆ v [1/2]

#define v   vec[5]

◆ v [2/2]

#define v   vec[5]

◆ w [1/2]

#define w   vec[6]

◆ w [2/2]

#define w   vec[6]

Typedef Documentation

◆ ArrayOfArrayOfArrayOfStokesVector

◆ ArrayOfArrayOfPropagationMatrix

◆ ArrayOfArrayOfStokesVector

◆ ArrayOfPropagationMatrix

◆ ArrayOfStokesVector

Definition at line 1470 of file propagationmatrix.h.

Function Documentation

◆ bad_propmat()

template<class T >
bool bad_propmat ( const Array< T > &  main,
const Vector f_grid,
const Index  sd = 1 
)
noexcept

Checks if a Propagation Matrix or something similar has good grids.

Definition at line 1504 of file propagationmatrix.h.

References main(), ConstVectorView::nelem(), and Raw::Average::var().

Referenced by propmat_clearskyAddLines(), and zeeman_on_the_fly().

◆ compute_transmission_matrix()

void compute_transmission_matrix ( Tensor3View  T,
const Numeric r,
const PropagationMatrix upper_level,
const PropagationMatrix lower_level,
const Index  iz = 0,
const Index  ia = 0 
)

Compute the matrix exponent as the transmission matrix of this propagation matrix.

The propagation matrix is multiplied by -r and level-averaged before exponent is applied.

upper_level and lower_level propagation matrices should thus be the level matrices and r the distance between these levels. The same is true for the derivative matrices.

Stokes dim 1 and 4 have been tested more. Stokes dim 2 and 3 have been found to work but could still have hidden errors for uncommon cases

Parameters
[in,out]Ttransmission tensor with outmost dimension being frequency
[in]rthe distance over which the propagation matrix causes the transmission
[in]upper_levelThe upper level propagation matrix
[in]lower_levelThe lower level propagation matrix
[in]izZenith index
[in]iaAzimuth index

Definition at line 33 of file propagationmatrix.cc.

References a, a2, b, b2, c, joker, PropagationMatrix::K12(), PropagationMatrix::K13(), PropagationMatrix::K23(), PropagationMatrix::Kjj(), PropagationMatrix::NumberOfFrequencies(), sqrt(), PropagationMatrix::StokesDimensions(), and u.

Referenced by get_stepwise_transmission_matrix().

◆ compute_transmission_matrix_and_derivative()

void compute_transmission_matrix_and_derivative ( Tensor3View  T,
Tensor4View  dT_upper_level,
Tensor4View  dT_lower_level,
const Numeric r,
const PropagationMatrix upper_level,
const PropagationMatrix lower_level,
const Array< PropagationMatrix > &  dprop_mat_upper_level,
const Array< PropagationMatrix > &  dprop_mat_lower_level,
const Numeric dr_dTu = 0.0,
const Numeric dr_dTl = 0.0,
const Index  it = -1,
const Index  iz = 0,
const Index  ia = 0 
)

Compute the matrix exponent as the transmission matrix of this propagation matrix

The propagation matrix is multiplied by -r and level-averaged before exponent is applied.

upper_level and lower_level propagation matrices should thus be the level matrices and r the distance between these levels. The same is true for the derivative matrices.

Stokes dim 1 and 4 have been tested more. Stokes dim 2 and 3 have been found to work but could still have hidden errors for uncommon cases

Parameters
[in,out]Ttransmission tensor with outmost dimension being frequency
[in,out]dT_upptransmission tensors derivative with respect to derivatives of the propagation matrix for upper level
[in,out]dT_lowtransmission tensors derivative with respect to derivatives of the propagation matrix for lower level
[in]rthe distance over which the propagation matrix causes the transmission
[in]upper_levelThe upper level propagation matrix
[in]lower_levelThe lower level propagation matrix
[in]dprop_mat_uppderivatives of the upper propagation matrix with respect to some parameter (is multiplied by -0.5 r)
[in]dprop_mat_lowderivatives of the lower propagation matrix with respect to some parameter (is multiplied by -0.5 r)
[in]dr_dTuDistance temperature derivative for upper level
[in]dr_dTlDistance temperature derivative for lower level
[in]itPosition of temperature derivative (ignored at -1)
[in]izZenith index
[in]iaAzimuth index

Definition at line 478 of file propagationmatrix.cc.

References a, a2, b, b2, c, joker, PropagationMatrix::K12(), PropagationMatrix::K13(), PropagationMatrix::K23(), PropagationMatrix::Kjj(), Array< base >::nelem(), PropagationMatrix::NumberOfFrequencies(), sqrt(), PropagationMatrix::StokesDimensions(), and u.

Referenced by get_stepwise_transmission_matrix().

◆ compute_transmission_matrix_from_averaged_matrix_at_frequency()

void compute_transmission_matrix_from_averaged_matrix_at_frequency ( MatrixView  T,
const Numeric r,
const PropagationMatrix averaged_propagation_matrix,
const Index  iv,
const Index  iz = 0,
const Index  ia = 0 
)

Compute the matrix exponent as the transmission matrix of this propagation matrix.

The propagation matrix is multiplied by -r and level-averaged before exponent is applied.

Stokes dim 1 and 4 have been tested more. Stokes dim 2 and 3 have been found to work but could still have hidden errors for uncommon cases

Parameters
[in,out]Ttransmission matrix at the position
[in]rthe distance over which the propagation matrix causes the transmission
[in]averaged_propagation_matrixThe propagation matrix
[in]ivFrequency index
[in]izZenith index
[in]iaAzimuth index

Definition at line 272 of file propagationmatrix.cc.

References a, a2, b, b2, c, PropagationMatrix::K12(), PropagationMatrix::K13(), PropagationMatrix::K23(), PropagationMatrix::Kjj(), sqrt(), PropagationMatrix::StokesDimensions(), and u.

Referenced by rte_step_doit_replacement().

◆ inv_prop_matrix()

template<int N>
Eigen::Matrix< Numeric, N, N > inv_prop_matrix ( const ConstVectorView vec)

Definition at line 89 of file propagationmatrix.h.

References a, b, c, d, N, u, v, and w.

◆ need2stokes()

template<bool matrix>
constexpr Index need2stokes ( Index  nstokes_needed)
constexpr

Definition at line 179 of file propagationmatrix.h.

References ARTS_ASSERT, IGRF::matrix(), and max.

◆ operator*() [1/2]

LazyScale< PropagationMatrix > operator* ( const Numeric x,
const PropagationMatrix pm 
)
inline

Returns a lazy multiplier.

Parameters
[in]xScale
[in]pmPropagation matrix
Returns
LazyScale<PropagationMatrix> A lazy multiplier

Definition at line 1496 of file propagationmatrix.h.

◆ operator*() [2/2]

LazyScale< PropagationMatrix > operator* ( const PropagationMatrix pm,
const Numeric x 
)
inline

Returns a lazy multiplier.

Parameters
[in]pmPropagation matrix
[in]xScale
Returns
LazyScale<PropagationMatrix> A lazy multiplier

Definition at line 1485 of file propagationmatrix.h.

◆ operator<<() [1/6]

std::ostream & operator<< ( std::ostream &  os,
const ArrayOfArrayOfPropagationMatrix aapm 
)

output operator

Definition at line 2048 of file propagationmatrix.cc.

◆ operator<<() [2/6]

std::ostream & operator<< ( std::ostream &  os,
const ArrayOfArrayOfStokesVector aapm 
)

Definition at line 2065 of file propagationmatrix.cc.

◆ operator<<() [3/6]

std::ostream & operator<< ( std::ostream &  os,
const ArrayOfPropagationMatrix apm 
)

output operator

Definition at line 2042 of file propagationmatrix.cc.

◆ operator<<() [4/6]

std::ostream & operator<< ( std::ostream &  os,
const ArrayOfStokesVector apm 
)

Definition at line 2060 of file propagationmatrix.cc.

◆ operator<<() [5/6]

std::ostream & operator<< ( std::ostream &  os,
const PropagationMatrix pm 
)

output operator

Definition at line 2037 of file propagationmatrix.cc.

References PropagationMatrix::Data().

◆ operator<<() [6/6]

std::ostream & operator<< ( std::ostream &  os,
const StokesVector pm 
)

Definition at line 2055 of file propagationmatrix.cc.

References PropagationMatrix::Data().

◆ prop_matrix() [1/2]

template<int N>
Eigen::Matrix< Numeric, N, N > prop_matrix ( const ConstMatrixView m)

Definition at line 69 of file propagationmatrix.h.

References N.

◆ prop_matrix() [2/2]

template<int N>
Eigen::Matrix< Numeric, N, N > prop_matrix ( const ConstVectorView vec)

Definition at line 41 of file propagationmatrix.h.

References a, b, c, d, N, u, v, and w.

◆ stokes2need()

template<bool matrix>
constexpr Index stokes2need ( Index  nstokes)
constexpr

Definition at line 194 of file propagationmatrix.h.

References ARTS_ASSERT, IGRF::matrix(), and max.