RTOpPack: Extra C/C++ Code for Vector Reduction/Transformation Operators
Version of the Day
|
#include <RTOp.h>
Struct for a non-mutable sub-vector.
For a sub-vector vec
, the corresponding entries in the global vector x(j)
(one based) are as follows:
x( vec.global_offset + k ) = vec.values[ vec.value_stride * (k-1) ] for k = 1,...,vec.sub_dim
The stride member vec.value_stride
may be positive (>0), negative (<0) or even zero (0). A negative stride vec.value_stride < 0
allows a reverse traversal of the elements in vec.values[]
. A zero stride vec.value_stride == 0
allows a vector with all the elements the same.
To avoid making mistakes in setting the members of this struct use one of the helper functions RTOp_sub_vector()
, or RTOp_sub_vector_null()
.