ARTS  2.2.66
matpackIII.cc File Reference
#include "matpackIII.h"
#include "exceptions.h"
Include dependency graph for matpackIII.cc:

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const ConstTensor3View &v)
 Output operator. More...
 
Numeric add (Numeric x, Numeric y)
 
void copy (ConstIterator3D origin, const ConstIterator3D &end, Iterator3D target)
 Copy data between begin and end to target. More...
 
void copy (Numeric x, Iterator3D target, const Iterator3D &end)
 Copy a scalar to all elements. More...
 
void swap (Tensor3 &t1, Tensor3 &t2)
 Swaps two objects. More...
 
void transform (Tensor3View y, double(&my_func)(double), ConstTensor3View x)
 A generic transform function for tensors, which can be used to implement mathematical functions operating on all elements. More...
 
Numeric max (const ConstTensor3View &x)
 Max function, tensor version. More...
 
Numeric min (const ConstTensor3View &x)
 Min function, tensor version. More...
 
Numeric debug_tensor3view_get_elem (Tensor3View &tv, Index p, Index r, Index c)
 Helper function to access tensor elements. More...
 
void mult (Tensor3View A, const ConstVectorView B, const ConstMatrixView C)
 mult Tensor3 More...
 

Detailed Description

Author
Oliver Lemke
Date
2002-11-21

Definition in file matpackIII.cc.

Function Documentation

◆ add()

Numeric add ( Numeric  x,
Numeric  y 
)

Definition at line 553 of file matpackIII.cc.

◆ copy() [1/2]

void copy ( ConstIterator3D  origin,
const ConstIterator3D end,
Iterator3D  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 copy data between different kinds of subtensors.

Definition at line 728 of file matpackIII.cc.

References ConstMatrixView::begin(), MatrixView::begin(), copy(), Tensor3View::end(), and ConstMatrixView::end().

Referenced by copy(), Tensor3View::operator=(), Tensor3::operator=(), and Tensor3::Tensor3().

◆ copy() [2/2]

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

Copy a scalar to all elements.

Definition at line 743 of file matpackIII.cc.

References MatrixView::begin(), copy(), Tensor3View::end(), and MatrixView::end().

◆ debug_tensor3view_get_elem()

Numeric debug_tensor3view_get_elem ( Tensor3View tv,
Index  p,
Index  r,
Index  c 
)

Helper function to access tensor elements.

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

Parameters
tvTensorView
pPage index
rRow index
cColumn index
Author
Oliver Lemke
Date
2004-05-10

Definition at line 1008 of file matpackIII.cc.

◆ max()

Numeric max ( const ConstTensor3View x)

Max function, tensor version.

Definition at line 946 of file matpackIII.cc.

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

Referenced by max().

◆ min()

Numeric min ( const ConstTensor3View x)

Min function, tensor version.

Definition at line 968 of file matpackIII.cc.

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

Referenced by min().

◆ mult()

void mult ( Tensor3View  A,
const ConstVectorView  B,
const ConstMatrixView  C 
)

mult Tensor3

Pointwise multiplication of a vector element and matrix.

mult(Tensor3& A, const ConstVectorView B, const ConstMatrixView C) for multiplying vector pointwise with matrix. Useful, e.g., for frequency gridded absorption vector multiplied by normalized Stokes extinction matrix to get extinction matrix as a function of frequency.

Parameters
AOut: Tensor3 with N pages, M rows and L columns
BIn: A Vector of length N.
CIn: A Matrix of size M x L.
Author
Richard Larsson
Date
2012-07-17

Definition at line 1033 of file matpackIII.cc.

References C, joker, ConstTensor3View::ncols(), ConstMatrixView::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), ConstTensor3View::nrows(), and ConstMatrixView::nrows().

◆ operator<<()

std::ostream& operator<< ( std::ostream &  os,
const ConstTensor3View v 
)

Output operator.

This demonstrates how iterators can be used to traverse the tensor. We use the standard output operator for Matrix to print each page in turn.

Definition at line 221 of file matpackIII.cc.

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

◆ swap()

void swap ( Tensor3 t1,
Tensor3 t2 
)

Swaps two objects.

Definition at line 891 of file matpackIII.cc.

References ConstTensor3View::mcr, ConstTensor3View::mdata, ConstTensor3View::mpr, and ConstTensor3View::mrr.

◆ transform()

void transform ( Tensor3View  y,
double(&)(double)  my_func,
ConstTensor3View  x 
)

A generic transform function for tensors, 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 tensors! 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)

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

Parameters
yOutput: The results of the function acting on each element of x.
my_funcA function (e.g., sqrt).
xA tensor.

Definition at line 925 of file matpackIII.cc.

References ConstTensor3View::begin(), Tensor3View::begin(), ConstTensor3View::end(), ConstTensor3View::ncols(), ConstTensor3View::npages(), ConstTensor3View::nrows(), and transform().

Referenced by transform().