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

Min.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Vector_Min_h
00002 #define Impala_Core_Vector_Min_h
00003 
00004 #include "Core/Vector/VectorSet.h"
00005 #include "Core/Vector/MinAssign.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Vector
00012 {
00013 
00014 
00015 template <class ArrayT>
00016 inline void
00017 Min(typename VectorSet<ArrayT>::VectorT* dst, VectorSet<ArrayT>* src,
00018     int startIdx, int stepSize, int nrSteps)
00019 {
00020     typedef typename VectorSet<ArrayT>::VectorT VectorT;
00021 
00022     if (!src->HasConstVectorSize())
00023     {
00024         std::cout << "Vector::Min: works for constant vector size only" << std::endl;
00025         return;
00026     }
00027     VectorT res(src->GetVectorLength(0));
00028     res = 0;
00029     int endIdx = startIdx + nrSteps * stepSize;
00030     for (int i=startIdx ; i<endIdx ; i+=stepSize)
00031         MinAssign(res, src->GetVector(i, true));
00032     if (!dst)
00033         dst = new VectorT(res);
00034     else
00035         *dst = res;
00036 }
00037 
00038 template <class ArrayT>
00039 inline void
00040 Min(typename VectorSet<ArrayT>::VectorT* dst, VectorSet<ArrayT>* src,
00041     int size, bool* filter)
00042 {
00043     typedef typename VectorSet<ArrayT>::VectorT VectorT;
00044 
00045     if (!src->HasConstVectorSize())
00046     {
00047         std::cout << "Vector::Min: works for constant vector size only" << std::endl;
00048         return;
00049     }
00050     VectorT res(src->GetVectorLength(0));
00051     res = 99999999999999.9;
00052     for (int i=0 ; i<size ; i++)
00053         if (!filter || filter[i])
00054             MinAssign(res, src->GetVector(i, true));
00055     if (!dst)
00056         dst = new VectorT(res);
00057     else
00058         *dst = res;
00059 }
00060 
00061 } // namespace Vector
00062 } // namespace Core
00063 } // namespace Impala
00064 
00065 #endif

Generated on Fri Mar 19 09:31:28 2010 for ImpalaSrc by  doxygen 1.5.1