matpackI.cc File Reference

#include "matpackI.h"
#include "exceptions.h"

Include dependency graph for matpackI.cc:

Go to the source code of this file.

Functions

ostream & operator<< (ostream &os, const ConstVectorView &v)
 Output operator.
void copy (ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
 Copy data between begin and end to target.
void copy (Numeric x, Iterator1D target, const Iterator1D &end)
 Copy a scalar to all elements.
ostream & operator<< (ostream &os, const ConstMatrixView &v)
 Output operator.
void copy (ConstIterator2D origin, const ConstIterator2D &end, Iterator2D target)
 Copy data between begin and end to target.
void copy (Numeric x, Iterator2D target, const Iterator2D &end)
 Copy a scalar to all elements.
Numeric operator* (const ConstVectorView &a, const ConstVectorView &b)
 Scalar product.
void mult (VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
 Matrix Vector multiplication.
void mult (MatrixView A, const ConstMatrixView &B, const ConstMatrixView &C)
 Matrix multiplication.
ConstMatrixView transpose (ConstMatrixView m)
 Const version of transpose.
MatrixView transpose (MatrixView m)
 Returns the transpose.
void transform (VectorView y, double(&my_func)(double), ConstVectorView x)
 A generic transform function for vectors, which can be used to implement mathematical functions operating on all elements.
void transform (MatrixView y, double(&my_func)(double), ConstMatrixView x)
 A generic transform function for matrices, which can be used to implement mathematical functions operating on all elements.
Numeric max (const ConstVectorView &x)
 Max function, vector version.
Numeric max (const ConstMatrixView &x)
 Max function, matrix version.
Numeric min (const ConstVectorView &x)
 Min function, vector version.
Numeric min (const ConstMatrixView &x)
 Min function, matrix version.
Numeric mean (const ConstVectorView &x)
 Mean function, vector version.
Numeric mean (const ConstMatrixView &x)
 Mean function, matrix version.
Numeric debug_matrixview_get_elem (MatrixView &mv, Index r, Index c)
 Helper function to access matrix elements.


Detailed Description

Author:
Stefan Buehler
Date:
2001-09-15

Definition in file matpackI.cc.


Function Documentation

void copy ( Numeric  x,
Iterator2D  target,
const Iterator2D end 
)

Copy a scalar to all elements.

Definition at line 1398 of file matpackI.cc.

void copy ( ConstIterator2D  origin,
const ConstIterator2D end,
Iterator2D  target 
)

Copy data between begin and end to target.

Target must be a valid area of memory. Note that the strides in the iterators can be different, so that we can for example copy data between different kinds of subvectors.

Origin, end, and target are 2D iterators, marking rows in a matrix. For each row the 1D iterator is obtained and used to copy the elements.

Definition at line 1383 of file matpackI.cc.

void copy ( Numeric  x,
Iterator1D  target,
const Iterator1D end 
)

Copy a scalar to all elements.

Definition at line 601 of file matpackI.cc.

void copy ( ConstIterator1D  origin,
const ConstIterator1D end,
Iterator1D  target 
)

Numeric debug_matrixview_get_elem ( MatrixView mv,
Index  r,
Index  c 
)

Helper function to access matrix elements.

Because of function inlining the operator() is not accessible from the debuggger. This function helps to access Matrix elements from within the debugger.

Parameters:
mv MatrixView
r Row index
c Column index
Author:
Oliver Lemke
Date:
2004-05-10

Definition at line 1928 of file matpackI.cc.

Numeric max ( const ConstMatrixView x  ) 

Max function, matrix version.

Definition at line 1784 of file matpackI.cc.

References ConstMatrixView::begin(), ConstMatrixView::end(), and max.

Numeric max ( const ConstVectorView x  ) 

Max function, vector version.

Definition at line 1766 of file matpackI.cc.

References ConstVectorView::begin(), ConstVectorView::end(), and max.

Numeric mean ( const ConstMatrixView x  ) 

Mean function, matrix version.

Definition at line 1862 of file matpackI.cc.

References ConstMatrixView::begin(), ConstMatrixView::end(), mean(), ConstMatrixView::ncols(), and ConstMatrixView::nrows().

Numeric mean ( const ConstVectorView x  ) 

Mean function, vector version.

Definition at line 1846 of file matpackI.cc.

References ConstVectorView::begin(), ConstVectorView::end(), mean(), and ConstVectorView::nelem().

Referenced by abs_lookupSetup(), mean(), and polynomial_basis_func().

Numeric min ( const ConstMatrixView x  ) 

Min function, matrix version.

Definition at line 1824 of file matpackI.cc.

References ConstMatrixView::begin(), ConstMatrixView::end(), and min.

Numeric min ( const ConstVectorView x  ) 

Min function, vector version.

Definition at line 1806 of file matpackI.cc.

References ConstVectorView::begin(), ConstVectorView::end(), and min.

void mult ( MatrixView  A,
const ConstMatrixView B,
const ConstMatrixView C 
)

Matrix multiplication.

A = B*C. Note that the order is different from MTL, output comes first! Dimensions of A, B, and C must match. No memory reallocation takes place, only the data is copied. Using this function on overlapping MatrixViews belonging to the same Matrix will lead to unpredictable results. In particular, this means that A and B must not be the same matrix!

Definition at line 1643 of file matpackI.cc.

References ConstMatrixView::begin(), MatrixView::begin(), MatrixView::end(), ConstMatrixView::ncols(), ConstMatrixView::nrows(), and MatrixView::transpose.

void mult ( VectorView  y,
const ConstMatrixView M,
const ConstVectorView x 
)

Matrix Vector multiplication.

y = M*x. Note that the order is different from MTL, output comes first! Dimensions of y, M, and x must match. No memory reallocation takes place, only the data is copied. Using this function on overlapping MatrixViews belonging to the same Matrix will lead to unpredictable results. In particular, this means that A and B must not be the same matrix! The implementation here is different from the other multiplication routines. It does not use iterators but a more drastic approach to gain maximum performance.

Definition at line 1598 of file matpackI.cc.

References ConstMatrixView::mcr, ConstVectorView::mdata, ConstMatrixView::mdata, Range::mextent, ConstVectorView::mrange, ConstMatrixView::mrr, Range::mstart, and Range::mstride.

Referenced by cloud_RT_surface(), include_cumtrans_in_diy_dq(), include_trans_in_diy_dq(), interpTArray(), matrix_exp(), MatrixMatrixMultiply(), MCGeneral(), MCIPA(), mcPathTrace(), mcPathTraceGeneral(), mcPathTraceIPA(), rte_step_std(), RteCalc(), RteCalcMC(), ScatteringMonteCarlo(), sensor_responseAntenna(), sensor_responseBackend(), sensor_responseBeamSwitching(), sensor_responseMixer(), surface_calc(), TArrayCalc(), test32(), test4(), test40(), test42(), test45(), test5(), test_lusolve4D(), and VectorMatrixMultiply().

Numeric operator* ( const ConstVectorView a,
const ConstVectorView b 
)

Scalar product.

The two vectors may be identical.

Definition at line 1573 of file matpackI.cc.

References ConstVectorView::begin(), ConstVectorView::end(), and ConstVectorView::nelem().

ostream& operator<< ( ostream &  os,
const ConstMatrixView v 
)

Output operator.

This demonstrates how iterators can be used to traverse the matrix. The iterators know which part of the matrix is `active', and also the strides in both directions. This function is a bit more complicated than necessary to illustrate the concept, because the formating should look nice. This means that the first row, and the first element in each row, have to be treated individually.

Definition at line 905 of file matpackI.cc.

References ConstMatrixView::begin(), and ConstMatrixView::end().

ostream& operator<< ( ostream &  os,
const ConstVectorView v 
)

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 270 of file matpackI.cc.

References ConstVectorView::begin(), and ConstVectorView::end().

void transform ( MatrixView  y,
double(&)(double)  my_func,
ConstMatrixView  x 
)

A generic transform function for matrices, which can be used to implement mathematical functions operating on all elements.

Because we have this, we don't need explicit functions like sqrt for matrices! The type of the mathematical function is double (&my_func)(double). Numeric would not work here, since mathematical functions for float do not exist!

transform(y,sin,x) computes y = sin(x)

This function can also be used for Vectors, because there is a conversion to MatrixView.

The two Matrix views may be the same one, in which case the conversion happens in place.

Parameters:
y Output: The results of the function acting on each element of x.
my_func A function (e.g., sqrt).
x A matrix.

Definition at line 1744 of file matpackI.cc.

References MatrixView::begin(), ConstMatrixView::begin(), ConstMatrixView::end(), ConstMatrixView::ncols(), and ConstMatrixView::nrows().

void transform ( VectorView  y,
double(&)(double)  my_func,
ConstVectorView  x 
)

A generic transform function for vectors, which can be used to implement mathematical functions operating on all elements.

Because we have this, we don't need explicit functions like sqrt for matrices! The type of the mathematical function is double (&my_func)(double). Numeric would not work here, since mathematical functions for float do not exist!

transform(y,sin,x) computes y = sin(x)

Although the matrix version of this can also be used for vectors, thanks to the automatic interpretation of a vector as a one column matrix, this one is slightly more efficient. However, the difference is very small (only a few percent).

The two views may be the same one, in which case the conversion happens in place.

Parameters:
y Output: The results of the function acting on each element of x.
my_func A function (e.g., sqrt).
x A vector.

Definition at line 1712 of file matpackI.cc.

References VectorView::begin(), ConstVectorView::begin(), ConstVectorView::end(), and ConstVectorView::nelem().

Referenced by abs_lookupCreate(), abs_lookupSetup(), abs_lookupSetupBatch(), abs_lookupSetupWide(), GasAbsLookup::Adapt(), AtmFieldsRefinePgrid(), itw2p(), p2gridpos(), rte_std(), RteCalcMC(), test2(), test31(), test6(), test7(), transform(), and VectorLogSpace().

MatrixView transpose ( MatrixView  m  ) 

Returns the transpose.

This creates a special MatrixView for the transpose. The original is not changed!

Definition at line 1687 of file matpackI.cc.

References MatrixView::MatrixView(), ConstMatrixView::mcr, ConstMatrixView::mdata, and ConstMatrixView::mrr.

ConstMatrixView transpose ( ConstMatrixView  m  ) 


Generated on Mon Mar 23 14:06:43 2009 for ARTS by  doxygen 1.5.6