VF_subvector_...VD_subvector_...VE_subvector_...
VCF_subvector_...VCD_subvector_...VCE_subvector_...
VPF_subvector_...VPD_subvector_...VPE_subvector_...
 ..._addC..._addV
 ..._divC..._divV
 ..._divrC..._divrV
 ..._mulC..._mulV
 ..._subC..._subV
 ..._subrC..._subrV
FunctionArithmetic functions working on a sub-set of elements within a vector of one of the floating-point data types.
Syntax C/C++#include <VFmath.h>
void VF_subvector_addC( fVector Y, ui subsize, unsigned samp, float C );
void VF_subvector_addV( fVector Y, ui subsize, unsigned samp, fVector X );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
void vector<T>::subvector_addC( unsigned samp, const T& C );
void vector<T>::subvector_addV( unsigned samp, const vector<T>& X );
Pascal/Delphiuses VFmath;
procedure VF_subvector_addC( Y:fVector; subsiz:UIntSize; samp:UIntSize; C:Single );
procedure VF_subvector_addV( Y:fVector; subsiz:UIntSize; samp:UIntSize; X:fVector );

    (similarly all other functions of this family)
CUDA function C/C++#include <cudaVFmath.h>
int cudaVF_subvector_addC( fVector d_Y, ui subsize, unsigned samp, float C );
int cusdVF_subvector_addC( fVector d_Y, ui subsize, unsigned samp, float *d_C );
int cudaVF_subvector_addV( fVector d_Y, ui subsize, unsigned samp, fVector X );
void VFcu_subvector_addC( fVector h_Y, ui subsize, unsigned samp, float C );
void VFcu_subvector_addV( fVector h_Y, ui subsize, unsigned samp, fVector X );

    (similarly all other functions of this family)
CUDA function Pascal/Delphiuses VFmath;
function cudaVF_subvector_addC( d_Y:fVector; subsiz:UIntSize; samp:UIntSize; C:Single );
function cusdVF_subvector_addC( d_Y:fVector; subsiz:UIntSize; samp:UIntSize; d_C:PSingle );
function cudaVF_subvector_addV( d_Y:fVector; subsiz:UIntSize; samp:UIntSize; X:fVector );
procedure VFcu_subvector_addC( h_Y:fVector; subsiz:UIntSize; samp:UIntSize; C:Single );
procedure VFcu_subvector_addV( h_Y:fVector; subsiz:UIntSize; samp:UIntSize; X:fVector );

    (similarly all other functions of this family)
Description
..._addC:Yi*samp += C,i=0,...subsize−1
..._addV:Yi*samp += Xi,i=0,...subsize−1
..._subC:Yi*samp -= C,i=0,...subsize−1
..._subV:Yi*samp -= Xi,i=0,...subsize−1
..._subrC:Yi*samp = C - Yi*samp,i=0,...subsize−1
..._subrV:  Yi*samp = Xi- Yi*samp,  i=0,...subsize−1
..._mulC:Yi*samp *= C,i=0,...subsize−1
..._mulV:Yi*samp *= Xi,i=0,...subsize−1
..._divC:Yi*samp /= C,i=0,...subsize−1
..._divV:Yi*samp /= Xi,i=0,...subsize−1
..._divrC:Yi*samp = C / Yi*samp,i=0,...subsize−1
..._divrV:Yi*samp = Xi / Yi*samp,i=0,...subsize−1
 
Polar complex versions:
only multiplication and division are present: ...mulC,  ...mulV,  ...divC,  ...divV,  ...divrC, and ...divrV.

The operation indicated in the suffix of the function name is perfomed on a sub-set of the elements of a vector. The sampling interval is denoted by samp: every samp'th element is taken, up to a total of subsize, starting with the zero'th one (that means, subsize is not the total size of the vector, but rather the size of the sub-set, i.e. the number of elements for which the function is performed). Note that all operations are performed in place, i.e., the input vector itself is changed.
For similar functions not included in the above list, the necessary sequence of calls is similar to the following example (which shows how to calculate the sinc function of the zero'th and then every tenth element of X, assuming that size is an integer multiple of 10):
VF_subvector( Y, size/10, 10, X );
VF_sinc( Y, Y, size/10 );
VF_subvector_equV( X, size/10, 10, Y );

(However, in such cases, you would sometimes prefer the classic style of a loop with the loop-increment set to 10. Only if the desired function is not available in the math library of your compiler, the effort of copying back and forth into the dummy vector Y will pay off.)

Error handlingnone
Return valuenone
See alsoVF_subvector,   VF_subvector_equC,   VF_subvector_equV,   VF_addC

VectorLib Table of Contents  OptiVec home