SourceForge Logo Tiny Vector Matrix library using Expression Templates Sourceforge Project Page

include/tvmet/loop/Matrix.h

Go to the documentation of this file.
00001 /*
00002  * Tiny Vector Matrix Library
00003  * Dense Vector Matrix Libary of Tiny size using Expression Templates
00004  *
00005  * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * $Id: Matrix.h,v 1.11 2007-06-23 15:58:59 opetzold Exp $
00022  */
00023 
00024 #ifndef TVMET_LOOP_MATRIX_H
00025 #define TVMET_LOOP_MATRIX_H
00026 
00027 namespace tvmet {
00028 
00029 namespace loop {
00030 
00031 
00036 template<std::size_t Rows, std::size_t Cols>
00037 class Matrix
00038 {
00039   Matrix(const Matrix&);
00040   Matrix& operator=(const Matrix&);
00041 
00042 public:
00043   Matrix() { }
00044 
00045 public:
00047   template<class E1, class E2, class Assign>
00048   static inline
00049   void assign(E1& lhs, const E2& rhs, const Assign& assign_fn) {
00050     for(std::size_t i = 0; i != Rows; ++i)
00051       for(std::size_t j = 0; j != Cols; ++j)
00052   assign_fn.apply_on(lhs(i, j), rhs(i, j));
00053   }
00054 };
00055 
00056 
00057 } // namespace loop
00058 
00059 } // namespace tvmet
00060 
00061 #endif /* TVMET_LOOP_MATRIX_H */
00062 
00063 // Local Variables:
00064 // mode:C++
00065 // tab-width:8
00066 // End:

Author: