ivl 679
|
00001 /* This file is part of the ivl C++ library <http://image.ntua.gr/ivl>. 00002 A C++ template library extending syntax towards mathematical notation. 00003 00004 Copyright (C) 2012 Yannis Avrithis <iavr@image.ntua.gr> 00005 Copyright (C) 2012 Kimon Kontosis <kimonas@image.ntua.gr> 00006 00007 ivl is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License 00009 version 3 as published by the Free Software Foundation. 00010 00011 Alternatively, you can redistribute it and/or modify it under the terms 00012 of the GNU General Public License version 2 as published by the Free 00013 Software Foundation. 00014 00015 ivl is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 See the GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 and a copy of the GNU Lesser General Public License along 00022 with ivl. If not, see <http://www.gnu.org/licenses/>. */ 00023 00024 #ifndef IVL_CORE_DETAILS_LOOPS_ROW_FUNC_2D_HPP 00025 #define IVL_CORE_DETAILS_LOOPS_ROW_FUNC_2D_HPP 00026 00027 namespace ivl { 00028 00029 namespace loops { 00030 00031 template 00032 < 00033 class T, class D, class P, 00034 class L1, class M1, class N1, 00035 class L2, class M2, class N2> 00036 void row_func_2d_output(const array_2d<T, D, P>& in, size_t in_dim, 00037 array_2d<L1, M1, N1>& o1, array_2d<L2, M2, N2>& o2) 00038 { 00039 typename array_2d<L1, M1, N1>::iterator_nd it1 = o1._begin(1 - in_dim); 00040 typename array_2d<L2, M2, N2>::iterator_nd it2 = o2._begin(1 - in_dim); 00041 00042 typedef typename array_2d<T, D, P>::const_iterator_nd in_iter_nd; 00043 in_iter_nd cit = in->_begin(1 - in_dim); 00044 in_iter_nd cit_end = this->_next(1 - in_dim, cit); 00045 00046 for(; cit != cit_end; ++cit, ++it1, ++it2) { 00047 F::calculate( 00048 const_iter_array(in->_iter(in_dim, cit)), 00049 *it1, *it2); 00050 } 00051 } 00052 00053 template 00054 < 00055 class T, class D, class P, 00056 class L1, class M1, class N1, 00057 class L2, class M2, class N2, 00058 class L3, class M3, class N3> 00059 void row_func_2d_output(const array_2d<T, D, P>& in, size_t in_dim, 00060 array_2d<L1, M1, N1>& o1, 00061 array_2d<L2, M2, N2>& o2, 00062 array_2d<L3, M3, N3>& o3) 00063 { 00064 typename array_2d<L1, M1, N1>::iterator_nd it1 = o1._begin(1 - in_dim); 00065 typename array_2d<L2, M2, N2>::iterator_nd it2 = o2._begin(1 - in_dim); 00066 typename array_2d<L3, M3, N3>::iterator_nd it3 = o3._begin(1 - in_dim); 00067 00068 typedef typename array_2d<T, D, P>::const_iterator_nd in_iter_nd; 00069 in_iter_nd cit = in->_begin(1 - in_dim); 00070 in_iter_nd cit_end = this->_next(1 - in_dim, cit); 00071 00072 for(; cit != cit_end; ++cit, ++it1, ++it2, ++it3) { 00073 F::calculate(const_iter_array(in->_iter(in_dim, cit)), 00074 *it1, *it2, *it3); 00075 } 00076 } 00077 00078 00079 template 00080 < 00081 class T, class D, class P, 00082 class L1, class M1, class N1, 00083 class L2, class M2, class N2, 00084 class L3, class M3, class N3, 00085 class L4, class M4, class N4> 00086 void row_func_2d_output(const array_2d<T, D, P>& in, size_t, in_dim, 00087 array_2d<L1, M1, N1>& o1, 00088 array_2d<L2, M2, N2>& o2, 00089 array_2d<L3, M3, N3>& o3, 00090 array_2d<L4, M4, N4>& o4) 00091 { 00092 typename array_2d<L1, M1, N1>::iterator_nd it1 = o1._begin(1 - in_dim); 00093 typename array_2d<L2, M2, N2>::iterator_nd it2 = o2._begin(1 - in_dim); 00094 typename array_2d<L3, M3, N3>::iterator_nd it3 = o3._begin(1 - in_dim); 00095 typename array_2d<L4, M4, N4>::iterator_nd it4 = o4._begin(1 - in_dim); 00096 00097 typedef typename array_2d<T, D, P>::const_iterator_nd in_iter_nd; 00098 in_iter_nd cit = in->_begin(1 - in_dim); 00099 in_iter_nd cit_end = this->_next(1 - in_dim, cit); 00100 00101 for(; cit != cit_end; ++cit, ++it1, ++it2, ++it3, ++it4) { 00102 F::calculate(const_iter_array(in->_iter(in_dim, cit)), 00103 *it1, *it2, *it3, *it4); 00104 } 00105 } 00106 00107 00108 }; /*namespace loops*/ 00109 00110 }; /*namespace ivl*/ 00111 00112 #endif // IVL_CORE_DETAILS_LOOPS_ROW_FUNC_2D_HPP