VF_rampVD_rampVE_ramp
VCF_rampVCD_rampVCE_ramp
VI_rampVBI_rampVSI_rampVLI_rampVQI_ramp 
VU_rampVUB_rampVUS_rampVUL_rampVUQ_rampVUI_ramp
FunctionInitialize a vector with an ascending or descending "ramp".
Syntax C/C++#include <VFstd.h>
void VF_ramp( fVector X, ui size, float Start, float Rise );

    (similarly VD_,   VE_,   VCF_,   VCD_,   VCE_,   VI_, etc.)
void VU_ramp( uVector X, ui size, unsigned Start, int Rise );
    (similarly VUB_,   VUS_,   VUL_)
C++ VecObj#include <OptiVec.h>
void vector<T>::ramp( T Start, T Rise );
void vector<unsigned>::ramp( unsigned Start, int Rise );
Pascal/Delphiuses VFstd;
procedure VF_ramp( X:fVector; size:UIntSize; Start, Rise:Single );

    (similarly VD_,   VE_,   VCF_,   VCD_,   VCE_,   VI_, etc.)
procedure VU_ramp( X:uVector; size:UIntSize; Start:UInt; Rise:Integer );
    (similarly VUB_,   VUS_,   VUL_,   VUQ_)
CUDA function C/C++#include <cudaVFstd.h>
int cudaVF_ramp( fVector d_X, ui size, float Start, float Rise );
int cusdVF_ramp( fVector d_X, ui size, float *d_Start, float *d_Rise );
void VFcu_ramp( fVector h_X, ui size, float Start, float Rise );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_ramp( d_X:fVector; size:UIntSize; Start, Rise:Single ): IntBool;
function cusdVF_ramp( d_X:fVector; size:UIntSize; d_Start, d_Rise:PSingle ): IntBool;
procedure VFcu_ramp( h_X:fVector; size:UIntSize; Start, Rise:Single );
DescriptionXi = Start + i * Rise
For the floating-point versions, remember the limited accuracy of floating-point numbers. For example, after calling
VF_ramp( F1, 101, −1.0, 0.01 );
the element F1100 will not be 0.0, as you might wish, but rather something like 2.2E-8. Ths is due to the fact that the number 0.01 (passed as a float to the function) is not exactly representable in the data type float. If that is a problem, consider building the ramp with moderately large integers and dividing by a scaling factor afterwards:
VF_ramp( F1, 101, −100.0, 1.0 );
VF_divC( F1, F1, 101, 100.0 );

Note that Rise is defined as int instead of unsigned in the VU_ version and as long instead of unsigned long in the VUL_ version; this exception from the general rules - that all parameters in one function be of the same data type - allows to create descending ramps of unsigned numbers, which would not be possible otherwise.

Error handlingfloating-point versions: none;
integer versions: see chapter 5.2.
Return valuenone
See alsoVF_Parzen,   VF_Welch,   VF_equ1,   VUI_indramp,   VF_random

VectorLib Table of Contents  OptiVec home