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

MatConcatenate.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Matrix_MatConcatenate_h
00002 #define Impala_Core_Matrix_MatConcatenate_h
00003 
00004 #include "Core/Matrix/MatFunc.h"
00005 #include "Core/Array/SetPart.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Matrix
00012 {
00013 
00014 // concatenate horizontally (e.g. aaa and bbb becomes aaabbb)
00015 template<class ArrayT>
00016 inline ArrayT*
00017 MatConcatenateHorizontal(std::vector<ArrayT*> matrices)
00018 {
00019     ILOG_VAR(Core.Matrix.MatConcatenateHorizontal);
00020     int rows = MatNrRow(matrices[0]);
00021     int cols = 0;
00022     for(int i = 0; i < matrices.size(); i++)
00023     {
00024         cols += MatNrCol(matrices[i]);
00025         if(rows != MatNrRow(matrices[i]))
00026             ILOG_ERROR("nonconformant MatConcatenateHorizontal operands.");
00027     }
00028 
00029     ArrayT* res = MatCreate<ArrayT>(rows, cols);
00030     int startCol = 0;
00031     for(int i = 0; i < matrices.size(); i++)
00032     {
00033         SetPart(res, matrices[i], 0, 0, MatNrCol(matrices[i]), MatNrRow(matrices[i]), startCol, 0);
00034         startCol += MatNrCol(matrices[i]);
00035     }
00036     return res;
00037 }
00038 
00039 } // namespace Matrix
00040 } // namespace Core
00041 } // namespace Impala
00042 
00043 #endif

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