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

OutProduct.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Vector_OutProduct_h
00002 #define Impala_Core_Vector_OutProduct_h
00003 
00004 namespace Impala
00005 {
00006 namespace Core
00007 {
00008 namespace Vector
00009 {
00010 
00011 
00012 
00013 
00016 template <class ElemT>
00017 inline void
00018 OutProduct(VectorTem<ElemT>* &dst, VectorTem<ElemT>& v1, VectorTem<ElemT>& v2)
00019 {
00020     int len = v1.Size() * v2.Size();
00021     if (!dst->Valid() )
00022         dst = new Vector::VectorTem<ElemT>(len);
00023 
00024     ElemT* p1 = v1.GetData();
00025     ElemT* p2 = v2.GetData();
00026     for (int i=0 ; i<v1.Size() ; i++)
00027         for (int j=0 ; j<v2.Size() ; j++)
00028         {
00029             int idx = j+(i*v2.Size());
00030             (*dst)[idx] = p1[i] * p2[j];
00031         }
00032 }
00033 
00034 
00035 
00036 
00037 } // namespace Vector
00038 } // namespace Core
00039 } // namespace Impala
00040 
00041 #endif

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