matpackI.h File Reference

#include <iostream>
#include <iomanip>
#include "arts.h"

Go to the source code of this file.

Classes

class  Joker
 Implementation of Matrix, Vector, and such stuff. More...
class  Range
 The range class. More...
class  Iterator1D
 The iterator class for sub vectors. More...
class  ConstIterator1D
 The constant iterator class for sub vectors. More...
class  ConstVectorView
 A constant view of a Vector. More...
class  VectorView
 The VectorView class. More...
class  Iterator2D
 The row iterator class for sub matrices. More...
class  ConstIterator2D
 The const row iterator class for sub matrices. More...
class  Vector
 The Vector class. More...
class  ConstMatrixView
 A constant view of a Matrix. More...
class  MatrixView
 The MatrixView class. More...
class  Matrix
 The Matrix class. More...

Typedefs

typedef Array< VectorArrayOfVector
 An array of vectors.
typedef Array< MatrixArrayOfMatrix
 An array of matrices.

Functions

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.
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.
std::ostream & operator<< (std::ostream &os, const ConstVectorView &v)
 Output operator.
std::ostream & operator<< (std::ostream &os, const ConstMatrixView &v)
 Output operator.
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.

Variables

Joker joker
 Define the global joker objekt.


Typedef Documentation

An array of matrices.

Definition at line 595 of file matpackI.h.

An array of vectors.

Definition at line 589 of file matpackI.h.


Function Documentation

void copy ( Numeric  x,
Iterator2D  target,
const Iterator2D end 
) [inline]

Copy a scalar to all elements.

Definition at line 2105 of file matpackI.h.

void copy ( ConstIterator2D  origin,
const ConstIterator2D end,
Iterator2D  target 
) [inline]

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 2090 of file matpackI.h.

void copy ( Numeric  x,
Iterator1D  target,
const Iterator1D end 
) [inline]

Copy a scalar to all elements.

Definition at line 1328 of file matpackI.h.

void copy ( ConstIterator1D  origin,
const ConstIterator1D end,
Iterator1D  target 
) [inline]

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.

Definition at line 1319 of file matpackI.h.

Numeric max ( const ConstMatrixView x  )  [inline]

Max function, matrix version.

Definition at line 2477 of file matpackI.h.

Numeric max ( const ConstVectorView x  )  [inline]

Max function, vector version.

Definition at line 2459 of file matpackI.h.

Numeric min ( const ConstMatrixView x  )  [inline]

Min function, matrix version.

Definition at line 2517 of file matpackI.h.

Numeric min ( const ConstVectorView x  )  [inline]

Min function, vector version.

Definition at line 2499 of file matpackI.h.

void mult ( MatrixView  A,
const ConstMatrixView B,
const ConstMatrixView C 
) [inline]

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.

Definition at line 2336 of file matpackI.h.

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

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.

Definition at line 2291 of file matpackI.h.

Numeric operator* ( const ConstVectorView a,
const ConstVectorView b 
) [inline]

Scalar product.

The two vectors may be identical.

Definition at line 2270 of file matpackI.h.

std::ostream& operator<< ( std::ostream &  os,
const ConstMatrixView v 
) [inline]

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 1622 of file matpackI.h.

std::ostream& operator<< ( std::ostream &  os,
const ConstVectorView v 
) [inline]

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 1035 of file matpackI.h.

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

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.

Return values:
y the results of the function acting on each element of x
Parameters:
my_func a function (e.g., sqrt)
x a matrix

Definition at line 2437 of file matpackI.h.

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

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.

Return values:
y the results of the function acting on each element of x
Parameters:
my_func a function (e.g., sqrt)
x a vector

Definition at line 2405 of file matpackI.h.

MatrixView transpose ( MatrixView  m  )  [inline]

Returns the transpose.

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

Definition at line 2380 of file matpackI.h.

ConstMatrixView transpose ( ConstMatrixView  m  )  [inline]

Const version of transpose.

Definition at line 2373 of file matpackI.h.


Variable Documentation

Define the global joker objekt.

This is used by Matpack to specify joker ranges.

Author:
Stefan Buehler
Date:
2001-09-10

Definition at line 233 of file constants.cc.


Generated on Wed Feb 4 08:17:25 2009 for ARTS by  doxygen 1.5.6