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

MatEye.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Matrix_MatEye_h
00002 #define Impala_Core_Matrix_MatEye_h
00003 
00004 #include "Core/Matrix/MatFunc.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Matrix
00011 {
00012 
00013 template<class ArrayT>
00014 inline ArrayT*
00015 MatEye(int n)
00016 {
00017     ArrayT* res = MatCreate<ArrayT>(n, n);
00018     for(int i = 0; i < n; i++)
00019     {
00020         for(int j = 0; j < n; j++)
00021         {
00022             if(i == j)
00023                 *MatE(res, i, j) = 1.0;
00024             else
00025                 *MatE(res, i, j) = 0.0;
00026         }
00027     }
00028     return res;
00029 }
00030 
00031 } // namespace Matrix
00032 } // namespace Core
00033 } // namespace Impala
00034 
00035 #endif

Generated on Thu Jan 13 09:04:33 2011 for ImpalaSrc by  doxygen 1.5.1