FunctionReturns the value of a vector element
Syntax C/C++#include <VFstd.h>
float VF_element( fVector X, ui pos );
#include <VCFstd.h>
fComplex VCF_element( cfVector X, ui pos );
float VCF_elementRe( cfVector X, ui pos );
float VCF_elementIm( cfVector X, ui pos );
C++ VecObj#include <OptiVec.h>
T vector<T>::element( ui pos );
complex<T> vector<complex<T>>::element( ui pos );
T vector<complex<T>>::elementRe( ui pos );
T vector<complex<T>>::elementIm( ui pos );
Pascal/Delphiuses VFstd;
function VF_element( X:fVector; pos:UIntSize ): Single;
uses VCFstd;
function VCF_element( X:cfVector; pos:UIntSize ): fComplex;
function VCF_elementRe( X:cfVector; pos:UIntSize ): Single;
function VCF_elementIm( X:cfVector; pos:UIntSize ): Single;
CUDA function C/C++#include <cudaVFstd.h>
float cudaVF_element( fVector d_X, ui pos );
#include <cudaVCFstd.h>
fComplex cudaVCF_element( cfVector d_X, ui pos );
float cudaVCF_elementRe( cfVector d_X, ui pos );
float cudaVCF_elementIm( cfVector d_X, ui pos );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_element( d_X:fVector; pos:UIntSize ): Single;
uses VCFstd;
function cudaVCF_element( d_X:cfVector; pos:UIntSize ): fComplex;
function cudaVCF_elementRe( d_X:cfVector; pos:UIntSize ): Single;
function cudaVCF_elementIm( d_X:cfVector; pos:UIntSize ): Single;
DescriptionThe element at the position pos, i.e. X[pos], is returned.

The complex versions come in three variants:
VCF_element returns the complex element X[pos],
VCF_elementRe returns X[pos].Re,
VCF_elementIm returns X[pos].Im.
These function is used to read elements of dynamically allocated vectors in Delphi and in CUDA. Note that the bracket notation, X[pos] does not work for dynamic OptiVec vectors in Pascal/Delphi; also, it does not work for vectors in CUDA device memory.
Additionally, they have to be used as a work-around for a bug in CLang, where extended-precision vector elements are not correctly accessed via the bracket notation X[pos].
VF_element is "read-only". This means, you c a n n o t write something like
VF_element( X, 4 ) := 5;
The correct function for write access is V?_setElement.

Error handlingnone
Return valueX[pos]
See alsoVF_Pelement,   VF_setElement,   VF_getElement,   VF_accElement,   VF_decElement

VectorLib Table of Contents  OptiVec home