Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

template<class ArrayT>
void Impala::Core::Vector::Avg ( typename VectorSet< ArrayT >::VectorT *  dst,
VectorSet< ArrayT > *  src,
int  startIdx,
int  stepSize,
int  nrSteps 
) [inline]

Definition at line 18 of file Avg.h.

References AddAssign(), DivAssign(), Impala::Core::Vector::VectorSet< ArrayT >::GetVector(), Impala::Core::Vector::VectorSet< ArrayT >::GetVectorLength(), and Impala::Core::Vector::VectorSet< ArrayT >::HasConstVectorSize().

00020 {
00021     typedef typename VectorSet<ArrayT>::VectorT VectorT;
00022 
00023     if (!src->HasConstVectorSize())
00024     {
00025         std::cout << "Vector::Avg: works for constant vector size only" << std::endl;
00026         return;
00027     }
00028     VectorT res(src->GetVectorLength(0));
00029     res = 0;
00030     int endIdx = startIdx + nrSteps * stepSize;
00031     for (int i=startIdx ; i<endIdx ; i+=stepSize)
00032         AddAssign(res, src->GetVector(i, true));
00033     typename VectorSet<ArrayT>::ElemT factor = nrSteps;
00034     DivAssign(res, factor);
00035     if (!dst)
00036         dst = new VectorT(res);
00037     else
00038         *dst = res;
00039 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:27:01 2010 for ImpalaSrc by  doxygen 1.5.1