00001 #ifndef Impala_Core_Matrix_SetColumn_h
00002 #define Impala_Core_Matrix_SetColumn_h
00003
00004 #include "Basis/ILog.h"
00005 #include "Core/Matrix/MatFunc.h"
00006 #include "Core/Vector/VectorTem.h"
00007
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Matrix
00013 {
00014
00015 template<class MatT>
00016 inline void
00017 SetColumn(MatT* m, int index, const Vector::VectorTem<Real64>& col)
00018 {
00019 ILOG_VAR(Impala.Core.Matrix.SetColumn);
00020 int length = MatNrRow(m);
00021 if (length != col.Size())
00022 ILOG_ERROR_NODE("nonconformant operands");
00023 if (index < 0 || index >= MatNrCol(m))
00024 ILOG_ERROR_NODE("faulty column index: " << index);
00025 for (int i=0 ; i<length ; i++)
00026 *MatE(m, i, index) = col[i];
00027 }
00028
00029 }
00030 }
00031 }
00032
00033 #endif