cisst-saw
Loading...
Searching...
No Matches
VoViSi< _elementOperationType > Class Template Reference

Implement operation of the form \(vo = op(vi, si)\) for fixed size vectors. More...

#include <vctFixedSizeVectorRecursiveEngines.h>

Public Types

typedef vctFixedSizeVectorRecursiveEngines< _size-1 >::template VoViSi< _elementOperationType > RecursiveStep

Static Public Member Functions

template<class _outputVectorType, class _inputVectorType, class _inputScalarType>
static void Unfold (_outputVectorType &output, const _inputVectorType &inputVector, const _inputScalarType inputScalar)

Detailed Description

template<class _elementOperationType>
class VoViSi< _elementOperationType >

Implement operation of the form \(vo = op(vi, si)\) for fixed size vectors.

This class uses template specialization to perform binary vector operations of the form

\[v_o = \mathrm{op}(v_i, s_i) \]

where \(v_o\) is the output vector, and \(v_i, s_i\) are input vector and scalar, all vectors are of an equal fixed size, determined at compilation time, op stands for the a binary operation performed elementwise between \(v_i\) and \(s_i\), and whose result is stored elementwise into \(v_o\).

The operation type operationType must have a static method with the signature

static operationType Operation(const I1E & arg1, const I2E & arg2)

where OE, I1E, I2E are the types of vector elements in \(v_o, v_i s_i\) respectively. These types do not need to be defined explicitly for vctFixedSizeVectorRecursiveEngines class, as they are inferred from the signature of the corresponding operator[] for each of the vector types. However, they may need to be defined for the class operationType.

For examples of binary operations, see vctBinaryOperations.h .

Usage example for vctFixedSizeVectorRecursiveEngines::VoViSi:

enum {SIZE = 3};
int input1[SIZE];
float a;
double output[SIZE];

vctFixedSizeVectorRecursiveEngines<SIZE>::VoViSi<vctBinaryOperations<int,float,double>::Addition>::Unfold(output, input1, scalar);

stores the sum of elements of input1 and s into output.

Parameters
_elementOperationTypeThe type of the binary operation.
See also
vctFixedSizeVectorRecursiveEngines

Member Typedef Documentation

◆ RecursiveStep

template<class _elementOperationType>
typedef vctFixedSizeVectorRecursiveEngines<_size-1>::template VoViSi<_elementOperationType> VoViSi< _elementOperationType >::RecursiveStep

Member Function Documentation

◆ Unfold()

template<class _elementOperationType>
template<class _outputVectorType, class _inputVectorType, class _inputScalarType>
void VoViSi< _elementOperationType >::Unfold ( _outputVectorType & output,
const _inputVectorType & inputVector,
const _inputScalarType inputScalar )
inlinestatic

Unfold the recursion. Performs the operation _elementOperationType elementwise on the last elements of the input vector and scalar and call Unfold for the _size - 1 elements left (i.e. unfold the recursive calls).

Parameters
outputThe output vector.
inputVectorThe input vector (first operand).
inputScalarThe input scalar (second operand).

The documentation for this class was generated from the following file: