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

template<class FType>
void Impala::Core::Vector::DoSlabChi2DistanceStd ( FType *  C,
const FType *  A,
const FType *  B,
unsigned int  slabSizeA,
unsigned int  slabSizeB,
unsigned int  vectorSize 
)

Compute reference data set C = A * B.

Parameters:
C reference data, computed but preallocated
A matrix A as provided to device
B matrix B as provided to device
hA height of matrix A
wB width of matrix B

Definition at line 140 of file Chi2Distance.h.

Referenced by DoSlabChi2Distance().

00143 {
00144     #pragma omp parallel for
00145     for (unsigned int a = 0; a < slabSizeA; a++)
00146     {
00147         for (unsigned int b = 0; b < slabSizeB; b++)
00148         {
00149             const FType* baseA = A + (a * vectorSize);
00150             const FType* baseB = B + (b * vectorSize);
00151             FType sum = 0;
00152             for (unsigned int k = 0; k < vectorSize; k++)
00153             {
00154                 FType As = baseA[k];
00155                 FType Bs = baseB[k];
00156                 if(As == 0)
00157                 {
00158                     sum += Bs;
00159                 }
00160                 else
00161                 {
00162                     sum += (As - Bs) * (As - Bs) / (As + Bs);
00163                 }
00164             }
00165             C[b * slabSizeA + a] = (FType)(sum / 2);
00166         }
00167     }
00168 }


Generated on Thu Jan 13 09:21:35 2011 for ImpalaSrc by  doxygen 1.5.1