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

Mat* Impala::Core::Matrix::VectorQuantizeX ( Mat *  a,
Mat *  codebook 
)

Definition at line 16 of file VectorQuantize.h.

References MatE(), MatNorm2DistTransposed(), and MatNrRow().

Referenced by VectorQuantize().

00017 {
00018     Mat* distances = 0;
00019 #ifdef CUDA
00020     if(Link::Cuda::CudaUsed())
00021     {
00022         //distances = Link::Cuda::MatNorm2DistTransposed(a, codebook);
00023         return Link::Cuda::MatCodebookAssignHard(a, codebook);
00024     }
00025     else
00026 #endif
00027     {
00028         distances = MatNorm2DistTransposed(a,codebook);
00029         Mat* res = MatCreate<Mat>(MatNrRow(a), 2);
00030         for(int vj = 0; vj < MatNrRow(a); vj++)
00031         {
00032             Real64 bestDistance = 999999999.0;
00033             int    bestIndex = 0;
00034             for(int i = 0; i < MatNrRow(codebook); i++)
00035             {
00036                 Real64 value = *MatE(distances, vj, i);
00037                 if(value < bestDistance)
00038                 {
00039                     bestDistance = value;
00040                     bestIndex = i;
00041                 }
00042             }
00043             *MatE(res, vj, 0) = bestIndex;
00044             *MatE(res, vj, 1) = bestDistance;
00045         }
00046         delete distances;
00047         return res;
00048     }
00049 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:20:17 2011 for ImpalaSrc by  doxygen 1.5.1