ARTS
2.0.49
|
#include "matpackIII.h"
Go to the source code of this file.
Classes | |
class | Iterator4D |
Implementation of Tensors of Rank 4. More... | |
class | ConstIterator4D |
Const version of Iterator4D. More... | |
class | ConstTensor4View |
A constant view of a Tensor4. More... | |
class | Tensor4View |
The Tensor4View class. More... | |
class | Tensor4 |
The Tensor4 class. More... | |
Functions | |
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 | 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... | |
ostream & | operator<< (ostream &os, const ConstTensor4View &v) |
Output operator. More... | |
Numeric | debug_tensor4view_get_elem (Tensor4View &tv, Index b, Index p, Index r, Index c) |
Helper function to access tensor elements. More... | |
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 1264 of file matpackIV.cc.
References ConstTensor3View::begin(), Tensor3View::begin(), copy(), and ConstTensor3View::end().
Referenced by copy(), Tensor4View::operator=(), Tensor4::operator=(), and Tensor4::Tensor4().
void copy | ( | Numeric | x, |
Iterator4D | target, | ||
const Iterator4D & | end | ||
) |
Copy a scalar to all elements.
Definition at line 1277 of file matpackIV.cc.
References Tensor3View::begin(), copy(), and Tensor3View::end().
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.
tv | TensorView |
b | Book index |
p | Page index |
r | Row index |
c | Column index |
Definition at line 1547 of file matpackIV.cc.
Numeric max | ( | const ConstTensor4View & | x | ) |
Max function, tensor version.
Definition at line 1484 of file matpackIV.cc.
References ConstTensor4View::begin(), ConstTensor4View::end(), and max().
Referenced by max().
Numeric min | ( | const ConstTensor4View & | x | ) |
Min function, tensor version.
Definition at line 1506 of file matpackIV.cc.
References ConstTensor4View::begin(), ConstTensor4View::end(), and min().
Referenced by min().
ostream& operator<< | ( | 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 496 of file matpackIV.cc.
References ConstTensor4View::begin(), and ConstTensor4View::end().
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.
y | Output: The results of the function acting on each element of x. |
my_func | A function (e.g., sqrt). |
x | A tensor. |
Definition at line 1462 of file matpackIV.cc.
References ConstTensor4View::begin(), Tensor4View::begin(), ConstTensor4View::end(), ConstTensor4View::nbooks(), ConstTensor4View::ncols(), ConstTensor4View::npages(), ConstTensor4View::nrows(), and transform().
Referenced by transform().