ARTS  2.4.0(git:4fb77825)
matpackIV.cc File Reference
#include "matpackIV.h"
#include "exceptions.h"

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const ConstTensor4View &v)
 Output operator. More...
 
void copy (ConstIterator4D origin, const ConstIterator4D &end, Iterator4D target)
 Copy data between begin and end to target. More...
 
void copy (Numeric x, Iterator4D target, const Iterator4D &end)
 Copy a scalar to all elements. More...
 
void swap (Tensor4 &t1, Tensor4 &t2)
 Swaps two objects. More...
 
void transform (Tensor4View y, double(&my_func)(double), ConstTensor4View x)
 A generic transform function for tensors, which can be used to implement mathematical functions operating on all elements. More...
 
Numeric max (const ConstTensor4View &x)
 Max function, tensor version. More...
 
Numeric min (const ConstTensor4View &x)
 Min function, tensor version. More...
 
Numeric debug_tensor4view_get_elem (Tensor4View &tv, Index b, Index p, Index r, Index c)
 Helper function to access tensor elements. More...
 

Detailed Description

Author
Oliver Lemke
Date
2002-11-21

Definition in file matpackIV.cc.

Function Documentation

◆ copy() [1/2]

void copy ( ConstIterator4D  origin,
const ConstIterator4D end,
Iterator4D  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 928 of file matpackIV.cc.

References Tensor3View::begin(), ConstTensor3View::begin(), copy(), ConstTensor3View::end(), and Zeeman::end().

Referenced by copy(), Tensor4View::operator=(), and Tensor4::Tensor4().

◆ copy() [2/2]

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

Copy a scalar to all elements.

Definition at line 939 of file matpackIV.cc.

References Tensor3View::begin(), copy(), Tensor3View::end(), Zeeman::end(), and ARTS::Var::x().

◆ debug_tensor4view_get_elem()

Numeric debug_tensor4view_get_elem ( Tensor4View tv,
Index  b,
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
bBook index
pPage index
rRow index
cColumn index
Author
Oliver Lemke
Date
2004-05-10

Definition at line 1199 of file matpackIV.cc.

◆ max()

Numeric max ( const ConstTensor4View x)

Max function, tensor version.

Definition at line 1143 of file matpackIV.cc.

References max(), and ARTS::Var::x().

Referenced by max().

◆ min()

Numeric min ( const ConstTensor4View x)

Min function, tensor version.

Definition at line 1162 of file matpackIV.cc.

References min(), and ARTS::Var::x().

Referenced by min().

◆ operator<<()

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

Output operator.

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

Definition at line 430 of file matpackIV.cc.

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

◆ swap()

void swap ( Tensor4 t1,
Tensor4 t2 
)

◆ transform()

void transform ( Tensor4View  y,
double(&)(double)  my_func,
ConstTensor4View  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 1125 of file matpackIV.cc.

References transform(), ARTS::Var::x(), and ARTS::Var::y().

Referenced by transform().