SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Matrix4d.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
76 #ifndef SLIP_MATRIX4D_HPP
77 #define SLIP_MATRIX4D_HPP
78 
79 #include <iostream>
80 #include <iterator>
81 #include <cassert>
82 #include <numeric>
83 #include <algorithm>
84 #include <cmath>
85 #include <string>
86 #include <cstddef>
87 
88 #include "Array4d.hpp"
89 #include "stride_iterator.hpp"
90 #include "apply.hpp"
91 #include "iterator4d_box.hpp"
92 #include "iterator4d_range.hpp"
93 
94 #include <boost/serialization/access.hpp>
95 #include <boost/serialization/split_member.hpp>
96 #include <boost/serialization/string.hpp>
97 #include <boost/serialization/complex.hpp>
98 #include <boost/serialization/version.hpp>
99 
100 
101 namespace slip
102 {
103 template<class T>
104 class stride_iterator;
105 }
106 
107 namespace slip
108 {
109 
110 template <typename T>
111 class Matrix4d;
112 
113 template <typename T>
114 class Array4d;
115 
116 template <typename T>
117 std::ostream& operator<<(std::ostream & out, const slip::Matrix4d<T>& a);
118 
119 template<typename T>
120 bool operator==(const slip::Matrix4d<T>& x,
121  const slip::Matrix4d<T>& y);
122 
123 template<typename T>
124 bool operator!=(const slip::Matrix4d<T>& x,
125  const slip::Matrix4d<T>& y);
126 
127 template<typename T>
128 bool operator<(const slip::Matrix4d<T>& x,
129  const slip::Matrix4d<T>& y);
130 
131 template<typename T>
132 bool operator>(const slip::Matrix4d<T>& x,
133  const slip::Matrix4d<T>& y);
134 
135 template<typename T>
136 bool operator<=(const slip::Matrix4d<T>& x,
137  const slip::Matrix4d<T>& y);
138 
139 template<typename T>
140 bool operator>=(const slip::Matrix4d<T>& x,
141  const slip::Matrix4d<T>& y);
142 
166 template <typename T>
167 class Matrix4d
168 {
169 public :
170 
171  typedef T value_type;
172  typedef Matrix4d<T> self;
173  typedef const Matrix4d<T> const_self;
174 
175  typedef value_type* pointer;
176  typedef value_type const* const_pointer;
178  typedef value_type const& const_reference;
179 
180  typedef ptrdiff_t difference_type;
181  typedef std::size_t size_type;
182 
183  typedef pointer iterator;
185 
186  typedef std::reverse_iterator<iterator> reverse_iterator;
187  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
188 
189  //slab, slice, row and col iterator
198 
207 
208  typedef std::reverse_iterator<slab_iterator> reverse_slab_iterator;
209  typedef std::reverse_iterator<const_slab_iterator> const_reverse_slab_iterator;
210  typedef std::reverse_iterator<slice_iterator> reverse_slice_iterator;
211  typedef std::reverse_iterator<const_slice_iterator> const_reverse_slice_iterator;
212  typedef std::reverse_iterator<iterator> reverse_row_iterator;
213  typedef std::reverse_iterator<const_iterator> const_reverse_row_iterator;
214  typedef std::reverse_iterator<col_iterator> reverse_col_iterator;
215  typedef std::reverse_iterator<const_col_iterator> const_reverse_col_iterator;
216 
217  typedef std::reverse_iterator<slab_range_iterator> reverse_slab_range_iterator;
218  typedef std::reverse_iterator<const_slab_range_iterator> const_reverse_slab_range_iterator;
219  typedef std::reverse_iterator<slice_range_iterator> reverse_slice_range_iterator;
220  typedef std::reverse_iterator<const_slice_range_iterator> const_reverse_slice_range_iterator;
221  typedef std::reverse_iterator<row_range_iterator> reverse_row_range_iterator;
222  typedef std::reverse_iterator<const_row_range_iterator> const_reverse_row_range_iterator;
223  typedef std::reverse_iterator<col_range_iterator> reverse_col_range_iterator;
224  typedef std::reverse_iterator<const_col_range_iterator> const_reverse_col_range_iterator;
225 
226  //iterator 4d
231 
232  typedef std::reverse_iterator<iterator4d> reverse_iterator4d;
233  typedef std::reverse_iterator<const_iterator4d> const_reverse_iterator4d;
234  typedef std::reverse_iterator<iterator4d_range> reverse_iterator4d_range;
235  typedef std::reverse_iterator<const_iterator4d_range> const_reverse_iterator4d_range;
236 
237  //default iterator of the container
240 
241  //Range
243 
244 
245  static const std::size_t DIM = 4;
246 
247 public:
248 
254 
258  Matrix4d();
259 
269  Matrix4d(const std::size_t d1,
270  const std::size_t d2,
271  const std::size_t d3,
272  const std::size_t d4);
273 
282  Matrix4d(const std::size_t d1,
283  const std::size_t d2,
284  const std::size_t d3,
285  const std::size_t d4,
286  const T& val);
295  Matrix4d(const std::size_t d1,
296  const std::size_t d2,
297  const std::size_t d3,
298  const std::size_t d4,
299  const T* val);
300 
313  template<typename InputIterator>
314  Matrix4d(const size_type d1,
315  const size_type d2,
316  const size_type d3,
317  const std::size_t d4,
318  InputIterator first,
319  InputIterator last):
320  array_(new Array4d<T>(d1,d2,d3,d4,first,last))
321  {}
322 
326  Matrix4d(const Matrix4d<T>& rhs);
327 
328 
332  ~Matrix4d();
333 
334 
346  void resize(std::size_t d1,
347  std::size_t d2,
348  std::size_t d3,
349  std::size_t d4,
350  const T& val = T());
351 
356 
357  //****************************************************************************
358  // One dimensional iterators
359  //****************************************************************************
360 
361 
362 
363  //----------------------Global iterators------------------------------
364 
384  const_iterator begin() const;
385 
405  iterator begin();
406 
426  iterator end();
427 
447  const_iterator end() const;
448 
469 
490 
511 
532 
535  //****************************************************************************
536  // One dimensional stride iterators
537  //****************************************************************************
538 
543  //--------------------One dimensional slab iterators----------------------
544 
568  slab_iterator slab_begin(const size_type slice, const size_type row, const size_type col);
569 
593  const_slab_iterator slab_begin(const size_type slice, const size_type row, const size_type col) const;
594 
618  slab_iterator slab_end(const size_type slice, const size_type row, const size_type col);
619 
643  const_slab_iterator slab_end(const size_type slice, const size_type row, const size_type col) const;
644 
645 
670  reverse_slab_iterator slab_rbegin(const size_type slice, const size_type row, const size_type col);
671 
696  const_reverse_slab_iterator slab_rbegin(const size_type slice, const size_type row, const size_type col) const;
697 
722  reverse_slab_iterator slab_rend(const size_type slice, const size_type row, const size_type col);
723 
724 
749  const_reverse_slab_iterator slab_rend(const size_type slice, const size_type row, const size_type col) const;
750 
757  //--------------------One dimensional slice iterators----------------------
758 
759 
783  slice_iterator slice_begin(const size_type slab, const size_type row, const size_type col);
784 
808  const_slice_iterator slice_begin(const size_type slab, const size_type row, const size_type col) const;
809 
833  slice_iterator slice_end(const size_type slab, const size_type row, const size_type col);
834 
858  const_slice_iterator slice_end(const size_type slab, const size_type row, const size_type col) const;
859 
860 
885  reverse_slice_iterator slice_rbegin(const size_type slab, const size_type row, const size_type col);
886 
911  const_reverse_slice_iterator slice_rbegin(const size_type slab, const size_type row, const size_type col) const;
912 
937  reverse_slice_iterator slice_rend(const size_type slab, const size_type row, const size_type col);
938 
939 
964  const_reverse_slice_iterator slice_rend(const size_type slab, const size_type row, const size_type col) const;
965 
972  //-------------------row iterators----------
973 
987  row_iterator row_begin(const size_type slab, const size_type slice,
988  const size_type row);
989 
1003  const_row_iterator row_begin(const size_type slab, const size_type slice,
1004  const size_type row) const;
1005 
1006 
1020  row_iterator row_end(const size_type slab, const size_type slice,
1021  const size_type row);
1022 
1023 
1037  const_row_iterator row_end(const size_type slab, const size_type slice,
1038  const size_type row) const;
1039 
1040 
1054  reverse_row_iterator row_rbegin(const size_type slab, const size_type slice,
1055  const size_type row);
1056 
1070  const_reverse_row_iterator row_rbegin(const size_type slab, const size_type slice,
1071  const size_type row) const;
1072 
1073 
1087  reverse_row_iterator row_rend(const size_type slab, const size_type slice,
1088  const size_type row);
1089 
1090 
1104  const_reverse_row_iterator row_rend(const size_type slab, const size_type slice,
1105  const size_type row) const;
1106 
1112  //-------------------col iterators----------
1113 
1127  col_iterator col_begin(const size_type slab, const size_type slice,
1128  const size_type col);
1129 
1130 
1144  const_col_iterator col_begin(const size_type slab, const size_type slice,
1145  const size_type col) const;
1146 
1160  col_iterator col_end(const size_type slab, const size_type slice,
1161  const size_type col);
1162 
1163 
1177  const_col_iterator col_end(const size_type slab, const size_type slice,
1178  const size_type col) const;
1179 
1180 
1194  reverse_col_iterator col_rbegin(const size_type slab, const size_type slice,
1195  const size_type col);
1196 
1197 
1211  const_reverse_col_iterator col_rbegin(const size_type slab, const size_type slice,
1212  const size_type col) const;
1213 
1227  reverse_col_iterator col_rend(const size_type slab, const size_type slice,
1228  const size_type col);
1229 
1230 
1244  const_reverse_col_iterator col_rend(const size_type slab, const size_type slice,
1245  const size_type col) const;
1246 
1249  //****************************************************************************
1250  // One dimensional range iterators
1251  //****************************************************************************
1252 
1257  //------------------------slab range iterators -----------------------
1258 
1286  slab_range_iterator slab_begin(const size_type slice,const size_type row,const size_type col,
1287  const slip::Range<int>& range);
1288 
1289 
1317  slab_range_iterator slab_end(const size_type slice,const size_type row,const size_type col,
1318  const slip::Range<int>& range);
1319 
1320 
1347  const_slab_range_iterator slab_begin(const size_type slice,const size_type row,const size_type col,
1348  const slip::Range<int>& range) const;
1349 
1376  const_slab_range_iterator slab_end(const size_type slice,const size_type row,const size_type col,
1377  const slip::Range<int>& range) const;
1378 
1379 
1408  reverse_slab_range_iterator slab_rbegin(const size_type slice,const size_type row,const size_type col,
1409  const slip::Range<int>& range);
1410 
1411 
1440  reverse_slab_range_iterator slab_rend(const size_type slice,const size_type row,const size_type col,
1441  const slip::Range<int>& range);
1442 
1443 
1473  const slip::Range<int>& range) const;
1474 
1504  const slip::Range<int>& range) const;
1505 
1506 
1514  //------------------------slice range iterators -----------------------
1515 
1543  slice_range_iterator slice_begin(const size_type slab,const size_type row,const size_type col,
1544  const slip::Range<int>& range);
1545 
1546 
1574  slice_range_iterator slice_end(const size_type slab,const size_type row,const size_type col,
1575  const slip::Range<int>& range);
1576 
1577 
1604  const_slice_range_iterator slice_begin(const size_type slab,const size_type row,const size_type col,
1605  const slip::Range<int>& range) const;
1606 
1633  const_slice_range_iterator slice_end(const size_type slab,const size_type row,const size_type col,
1634  const slip::Range<int>& range) const;
1635 
1636 
1666  const slip::Range<int>& range);
1667 
1668 
1697  reverse_slice_range_iterator slice_rend(const size_type slab,const size_type row,const size_type col,
1698  const slip::Range<int>& range);
1699 
1700 
1730  const slip::Range<int>& range) const;
1731 
1761  const slip::Range<int>& range) const;
1762 
1763 
1770  //------------------------row range iterators -----------------------
1771 
1799  row_range_iterator row_begin(const size_type slab,const size_type slice,const size_type row,
1800  const slip::Range<int>& range);
1801 
1829  row_range_iterator row_end(const size_type slab,const size_type slice,const size_type row,
1830  const slip::Range<int>& range);
1831 
1832 
1860  const_row_range_iterator row_begin(const size_type slab,const size_type slice,const size_type row,
1861  const slip::Range<int>& range) const;
1862 
1863 
1890  const_row_range_iterator row_end(const size_type slab,const size_type slice,const size_type row,
1891  const slip::Range<int>& range) const;
1892 
1919  reverse_row_range_iterator row_rbegin(const size_type slab,const size_type slice,const size_type row,
1920  const slip::Range<int>& range);
1921 
1922 
1950  reverse_row_range_iterator row_rend(const size_type slab,const size_type slice,const size_type row,
1951  const slip::Range<int>& range);
1952 
1953 
1954 
1980  const_reverse_row_range_iterator row_rbegin(const size_type slab,const size_type slice,const size_type row,
1981  const slip::Range<int>& range) const;
1982 
1983 
2011  const_reverse_row_range_iterator row_rend(const size_type slab,const size_type slice,const size_type row,
2012  const slip::Range<int>& range) const;
2013 
2019  //------------------------col range iterators -----------------------
2020 
2048  col_range_iterator col_begin(const size_type slab,const size_type slice,const size_type col,
2049  const slip::Range<int>& range);
2050 
2079  col_range_iterator col_end(const size_type slab,const size_type slice,const size_type col,
2080  const slip::Range<int>& range);
2081 
2082 
2110  const_col_range_iterator col_begin(const size_type slab,const size_type slice,const size_type col,
2111  const slip::Range<int>& range) const;
2112 
2141  const_col_range_iterator col_end(const size_type slab,const size_type slice,const size_type col,
2142  const slip::Range<int>& range) const;
2143 
2170  reverse_col_range_iterator col_rbegin(const size_type slab,const size_type slice,const size_type col,
2171  const slip::Range<int>& range);
2172 
2200  reverse_col_range_iterator col_rend(const size_type slab,const size_type slice,const size_type col,
2201  const slip::Range<int>& range);
2202 
2229  const_reverse_col_range_iterator col_rbegin(const size_type slab,const size_type slice,const size_type col,
2230  const slip::Range<int>& range) const;
2231 
2258  const_reverse_col_range_iterator col_rend(const size_type slab,const size_type slice,const size_type col,
2259  const slip::Range<int>& range) const;
2260 
2263  //****************************************************************************
2264  // Four dimensional iterators
2265  //****************************************************************************
2266 
2271 
2272  //------------------------ Global iterators------------------------------------
2273 
2291 
2292 
2310 
2311 
2329 
2330 
2348 
2366 
2384 
2402 
2403 
2421 
2428 
2429  //------------------------ Box iterators------------------------------------
2430 
2452 
2453 
2476 
2477 
2500 
2501 
2524 
2525 
2526 
2550 
2574 
2598 
2599 
2623 
2624 
2632 
2633  //------------------------ Range iterators------------------------------------
2634 
2662  iterator4d_range first_front_upper_left(const range & slab_range, const range & slice_range,
2663  const range & row_range, const range & col_range);
2664 
2692  iterator4d_range last_back_bottom_right(const range & slab_range, const range & slice_range,
2693  const range & row_range, const range & col_range);
2694 
2695 
2723  const_iterator4d_range first_front_upper_left(const range & slab_range, const range & slice_range,
2724  const range & row_range, const range & col_range) const;
2725 
2726 
2754  const_iterator4d_range last_back_bottom_right(const range & slab_range, const range & slice_range,
2755  const range & row_range, const range & col_range) const;
2756 
2785  reverse_iterator4d_range rfirst_front_upper_left(const range & slab_range, const range & slice_range,
2786  const range & row_range, const range & col_range);
2787 
2816  reverse_iterator4d_range rlast_back_bottom_right(const range & slab_range, const range & slice_range,
2817  const range & row_range, const range & col_range);
2818 
2847  const_reverse_iterator4d_range rfirst_front_upper_left(const range & slab_range, const range & slice_range,
2848  const range & row_range, const range & col_range) const;
2849 
2878  const_reverse_iterator4d_range rlast_back_bottom_right(const range & slab_range, const range & slice_range,
2879  const range & row_range, const range & col_range) const;
2880 
2881 
2884  //********************************************************************
2885 
2895  friend std::ostream& operator<< <>(std::ostream & out,
2896  const self& a);
2897 
2912  self& operator=(const Matrix4d<T> & rhs);
2913 
2914 
2915 
2923  self& operator=(const T& value);
2924 
2925 
2931  void fill(const T& value)
2932  {
2933  std::fill_n(this->begin(),this->size(),value);
2934  }
2935 
2942  void fill(const T* value)
2943  {
2944  std::copy(value,value + this->size(), this->begin());
2945  }
2946 
2955  template<typename InputIterator>
2956  void fill(InputIterator first,
2957  InputIterator last)
2958  {
2959  std::copy(first,last, this->begin());
2960  }
2975  friend bool operator== <>(const Matrix4d<T>& x,
2976  const Matrix4d<T>& y);
2977 
2984  friend bool operator!= <>(const Matrix4d<T>& x,
2985  const Matrix4d<T>& y);
2986 
2993  friend bool operator< <>(const Matrix4d<T>& x,
2994  const Matrix4d<T>& y);
2995 
3002  friend bool operator> <>(const Matrix4d<T>& x,
3003  const Matrix4d<T>& y);
3004 
3011  friend bool operator<= <>(const Matrix4d<T>& x,
3012  const Matrix4d<T>& y);
3013 
3020  friend bool operator>= <>(const Matrix4d<T>& x,
3021  const Matrix4d<T>& y);
3022 
3023 
3033 
3034  T*** operator[](const size_type l);
3035 
3036  const T** const* operator[](const size_type l) const;
3037 
3038 
3039 
3055  reference operator()(const size_type l, const size_type k,
3056  const size_type i,
3057  const size_type j);
3058 
3074  const_reference operator()(const size_type l, const size_type k,
3075  const size_type i,
3076  const size_type j) const;
3077 
3085  std::string name() const;
3086 
3091  size_type dim1() const;
3092 
3097  size_type slabs() const;
3098 
3103  size_type dim2() const;
3104 
3109  size_type slices() const;
3110 
3115  size_type dim3() const;
3116 
3121  size_type rows() const;
3122 
3127  size_type dim4() const;
3128 
3133  size_type cols() const;
3134 
3139  size_type columns() const;
3140 
3141 
3142 
3146  size_type size() const;
3147 
3148 
3152  size_type max_size() const;
3153 
3157  bool empty()const;
3158 
3167  void swap(Matrix4d& M);
3168 
3178  self& operator+=(const T& val);
3179  self& operator-=(const T& val);
3180  self& operator*=(const T& val);
3181  self& operator/=(const T& val);
3182 
3183 
3184  self operator-() const;
3185 
3186 
3187 
3188  self& operator+=(const self& rhs);
3189  self& operator-=(const self& rhs);
3190  self& operator*=(const self& rhs);
3191  self& operator/=(const self& rhs);
3192 
3193 
3205  T& min() const;
3206 
3207 
3213  T& max() const;
3214 
3219  T sum() const;
3220 
3221 
3228  Matrix4d<T>& apply(T (*fun)(T));
3229 
3236  Matrix4d<T>& apply(T (*fun)(const T&));
3237 
3240 private:
3241  Array4d<T>* array_;
3242 
3243 
3244  private:
3245  friend class boost::serialization::access;
3246  template<class Archive>
3247  void save(Archive & ar, const unsigned int version) const
3248  {
3249  ar & this->array_;
3250  }
3251  template<class Archive>
3252  void load(Archive & ar, const unsigned int version)
3253  {
3254  ar & this->array_;
3255  }
3256  BOOST_SERIALIZATION_SPLIT_MEMBER();
3257 };
3258 
3279 
3280 
3281 }//slip::
3282 
3283 
3284 namespace slip{
3295 template<typename T>
3296 Matrix4d<T> operator+(const Matrix4d<T>& M1,
3297  const Matrix4d<T>& M2);
3298 
3305 template<typename T>
3306 Matrix4d<T> operator+(const Matrix4d<T>& M1,
3307  const T& val);
3308 
3315 template<typename T>
3316 Matrix4d<T> operator+(const T& val,
3317  const Matrix4d<T>& M1);
3318 
3329 template<typename T>
3330 Matrix4d<T> operator-(const Matrix4d<T>& M1,
3331  const Matrix4d<T>& M2);
3332 
3339 template<typename T>
3340 Matrix4d<T> operator-(const Matrix4d<T>& M1,
3341  const T& val);
3342 
3349 template<typename T>
3350 Matrix4d<T> operator-(const T& val,
3351  const Matrix4d<T>& M1);
3352 
3363 template<typename T>
3364 Matrix4d<T> operator*(const Matrix4d<T>& M1,
3365  const Matrix4d<T>& M2);
3366 
3373 template<typename T>
3374 Matrix4d<T> operator*(const Matrix4d<T>& M1,
3375  const T& val);
3376 
3383 template<typename T>
3384 Matrix4d<T> operator*(const T& val,
3385  const Matrix4d<T>& M1);
3386 
3397 template<typename T>
3398 Matrix4d<T> operator/(const Matrix4d<T>& M1,
3399  const Matrix4d<T>& M2);
3400 
3407 template<typename T>
3408 Matrix4d<T> operator/(const Matrix4d<T>& M1,
3409  const T& val);
3410 
3411 
3412 
3419 template<typename T>
3420 T& min(const Matrix4d<T>& M1);
3421 
3428 template<typename T>
3429 T& max(const Matrix4d<T>& M1);
3430 
3437 template<typename T>
3438 Matrix4d<T> abs(const Matrix4d<T>& V);
3439 
3446 template<typename T>
3447 Matrix4d<T> sqrt(const Matrix4d<T>& V);
3448 
3455 template<typename T>
3456 Matrix4d<T> cos(const Matrix4d<T>& V);
3457 
3464 template<typename T>
3465 Matrix4d<T> acos(const Matrix4d<T>& V);
3466 
3473 template<typename T>
3474 Matrix4d<T> sin(const Matrix4d<T>& V);
3475 
3482 template<typename T>
3483 Matrix4d<T> asin(const Matrix4d<T>& V);
3484 
3485 
3492 template<typename T>
3493 Matrix4d<T> tan(const Matrix4d<T>& V);
3494 
3501 template<typename T>
3502 Matrix4d<T> atan(const Matrix4d<T>& V);
3503 
3510 template<typename T>
3511 Matrix4d<T> exp(const Matrix4d<T>& V);
3512 
3519 template<typename T>
3520 Matrix4d<T> log(const Matrix4d<T>& V);
3521 
3528 template<typename T>
3529 Matrix4d<T> cosh(const Matrix4d<T>& V);
3530 
3537 template<typename T>
3538 Matrix4d<T> sinh(const Matrix4d<T>& V);
3539 
3546 template<typename T>
3547 Matrix4d<T> tanh(const Matrix4d<T>& V);
3548 
3555 template<typename T>
3556 Matrix4d<T> log10(const Matrix4d<T>& V);
3557 
3558 }//slip::
3559 
3560 
3561 
3562 namespace slip
3563 {
3565 // Constructors
3567 template<typename T>
3568 inline
3570 array_(new slip::Array4d<T>())
3571 {}
3572 
3573 template<typename T>
3574 inline
3576  const typename Matrix4d<T>::size_type d2,
3577  const typename Matrix4d<T>::size_type d3,
3578  const typename Matrix4d<T>::size_type d4):
3579  array_(new slip::Array4d<T>(d1,d2,d3,d4))
3580  {}
3581 
3582 template<typename T>
3583 inline
3585  const typename Matrix4d<T>::size_type d2,
3586  const typename Matrix4d<T>::size_type d3,
3587  const typename Matrix4d<T>::size_type d4,
3588  const T& val):
3589  array_(new slip::Array4d<T>(d1,d2,d3,d4,val))
3590  {}
3591 
3592 template<typename T>
3593 inline
3595  const typename Matrix4d<T>::size_type d2,
3596  const typename Matrix4d<T>::size_type d3,
3597  const typename Matrix4d<T>::size_type d4,
3598  const T* val):
3599  array_(new slip::Array4d<T>(d1,d2,d3,d4,val))
3600  {}
3601 
3602 
3603 template<typename T>
3604 inline
3606 array_(new slip::Array4d<T>((*rhs.array_)))
3607 {}
3608 
3609 template<typename T>
3610 inline
3612 {
3613  delete array_;
3614 }
3615 
3617 
3618 
3620 // Assignment operators
3622 template<typename T>
3623 inline
3625 {
3626  if(this != &rhs)
3627  {
3628  *array_ = *(rhs.array_);
3629  }
3630  return *this;
3631 }
3632 
3633 template<typename T>
3634 inline
3636 {
3637  std::fill_n((*array_)[0][0][0],array_->size(),value);
3638  return *this;
3639 }
3640 
3641 template<typename T>
3642 inline
3644  const typename Matrix4d<T>::size_type d2,
3645  const typename Matrix4d<T>::size_type d3,
3646  const typename Matrix4d<T>::size_type d4,
3647  const T& val)
3648  {
3649  array_->resize(d1,d2,d3,d4,val);
3650  }
3652 
3653 
3655 // Iterators
3657 
3658 //****************************************************************************
3659 // One dimensional iterators
3660 //****************************************************************************
3661 
3662 
3663 
3664 //----------------------Global iterators------------------------------
3665 
3666 template<typename T>
3667 inline
3669 {
3670  Array4d<T> const * tp(array_);
3671  return tp->begin();
3672 }
3673 
3674 template<typename T>
3675 inline
3677 {
3678  Array4d<T> const * tp(array_);
3679  return tp->end();
3680 }
3681 
3682 template<typename T>
3683 inline
3685 {
3686  return array_->begin();
3687 }
3688 
3689 template<typename T>
3690 inline
3692 {
3693  return array_->end();
3694 }
3695 
3696 template<typename T>
3697 inline
3699 {
3700  return typename Matrix4d<T>::reverse_iterator(this->end());
3701 }
3702 
3703 template<typename T>
3704 inline
3706 {
3707  return typename Matrix4d<T>::const_reverse_iterator(this->end());
3708 }
3709 
3710 template<typename T>
3711 inline
3713 {
3714  return typename Matrix4d<T>::reverse_iterator(this->begin());
3715 }
3716 
3717 
3718 template<typename T>
3719 inline
3721 {
3722  return typename Matrix4d<T>::const_reverse_iterator(this->begin());
3723 }
3724 
3725 //--------------------One dimensional slab iterators----------------------
3726 
3727 
3728 template<typename T>
3729 inline
3731  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col){
3732  return array_->slab_begin(slice,row,col);
3733 }
3734 
3735 
3736 template<typename T>
3737 inline
3739  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col) const{
3740  Array4d<T> const * tp(array_);
3741  return tp->slab_begin(slice,row,col);
3742 }
3743 
3744 template<typename T>
3745 inline
3747  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col){
3748  return array_->slab_end(slice,row,col);
3749 }
3750 
3751 
3752 template<typename T>
3753 inline
3755  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col) const{
3756  Array4d<T> const * tp(array_);
3757  return tp->slab_end(slice,row,col);
3758 }
3759 
3760 
3761 template<typename T>
3762 inline
3764  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col){
3765  return array_->slab_rbegin(slice,row,col);
3766 }
3767 
3768 template<typename T>
3769 inline
3771  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col) const{
3772  Array4d<T> const * tp(array_);
3773  return tp->slab_rbegin(slice,row,col);
3774 }
3775 
3776 
3777 template<typename T>
3778 inline
3780  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col){
3781  return array_->slab_rend(slice,row,col);
3782 }
3783 
3784 template<typename T>
3785 inline
3787  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col) const{
3788  Array4d<T> const * tp(array_);
3789  return tp->slab_rend(slice,row,col);
3790 }
3791 
3792 
3793 //-------------------- One dimensional slice iterators----------------------
3794 
3795 template<typename T>
3796 inline
3798 Matrix4d<T>::slice_begin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3799  const typename Matrix4d<T>::size_type col)
3800  {
3801  return array_->slice_begin(slab,row,col);
3802  }
3803 
3804 template<typename T>
3805 inline
3807 Matrix4d<T>::slice_begin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3808  const typename Matrix4d<T>::size_type col) const
3809  {
3810  Array4d<T> const * tp(array_);
3811  return tp->slice_begin(slab,row,col);
3812  }
3813 
3814 template<typename T>
3815 inline
3817 Matrix4d<T>::slice_end(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3818  const typename Matrix4d<T>::size_type col)
3819  {
3820  return array_->slice_end(slab,row,col);
3821  }
3822 
3823 template<typename T>
3824 inline
3826 Matrix4d<T>::slice_end(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3827  const typename Matrix4d<T>::size_type col) const
3828  {
3829  Array4d<T> const * tp(array_);
3830  return tp->slice_end(slab,row,col);
3831  }
3832 
3833 template<typename T>
3834 inline
3836 Matrix4d<T>::slice_rbegin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3837  const typename Matrix4d<T>::size_type col)
3838  {
3839  return array_->slice_rbegin(slab,row,col);
3840  }
3841 
3842 template<typename T>
3843 inline
3845 Matrix4d<T>::slice_rbegin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3846  const typename Matrix4d<T>::size_type col) const
3847  {
3848  Array4d<T> const * tp(array_);
3849  return tp->slice_rbegin(slab,row,col);
3850  }
3851 
3852 template<typename T>
3853 inline
3855 Matrix4d<T>::slice_rend(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3856  const typename Matrix4d<T>::size_type col)
3857  {
3858  return array_->slice_rend(slab,row,col);
3859  }
3860 
3861 template<typename T>
3862 inline
3864 Matrix4d<T>::slice_rend(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type row,
3865  const typename Matrix4d<T>::size_type col) const
3866  {
3867  Array4d<T> const * tp(array_);
3868  return tp->slice_rend(slab,row,col);
3869  }
3870 
3871 //--------------------One dimensional row iterators----------------------
3872 
3873 template<typename T>
3874 inline
3876 Matrix4d<T>::row_begin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3877  const typename Matrix4d<T>::size_type row)
3878  {
3879  return array_->row_begin(slab,slice,row);
3880  }
3881 
3882 template<typename T>
3883 inline
3885 Matrix4d<T>::row_begin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3886  const typename Matrix4d<T>::size_type row) const
3887  {
3888  Array4d<T> const * tp(array_);
3889  return tp->row_begin(slab,slice,row);
3890  }
3891 
3892 template<typename T>
3893 inline
3895 Matrix4d<T>::row_end(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3896  const typename Matrix4d<T>::size_type row)
3897  {
3898  return array_->row_end(slab,slice,row);
3899  }
3900 
3901 template<typename T>
3902 inline
3904 Matrix4d<T>::row_end(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3905  const typename Matrix4d<T>::size_type row) const
3906  {
3907  Array4d<T> const * tp(array_);
3908  return tp->row_end(slab,slice,row);
3909  }
3910 
3911 
3912 template<typename T>
3913 inline
3915 Matrix4d<T>::row_rbegin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3916  const typename Matrix4d<T>::size_type row)
3917  {
3918  return array_->row_rbegin(slab,slice,row);
3919  }
3920 
3921 template<typename T>
3922 inline
3924 Matrix4d<T>::row_rbegin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3925  const typename Matrix4d<T>::size_type row) const
3926  {
3927  Array4d<T> const * tp(array_);
3928  return tp->row_rbegin(slab,slice,row);
3929  }
3930 
3931 
3932 template<typename T>
3933 inline
3935 Matrix4d<T>::row_rend(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3936  const typename Matrix4d<T>::size_type row)
3937  {
3938  return array_->row_rend(slab,slice,row);
3939  }
3940 
3941 template<typename T>
3942 inline
3944 Matrix4d<T>::row_rend(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3945  const typename Matrix4d<T>::size_type row) const
3946  {
3947  Array4d<T> const * tp(array_);
3948  return tp->row_rend(slab,slice,row);
3949  }
3950 
3951 //--------------------One dimensional col iterators----------------------
3952 
3953 template<typename T>
3954 inline
3956 Matrix4d<T>::col_begin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3957  const typename Matrix4d<T>::size_type col)
3958  {
3959  return array_->col_begin(slab,slice,col);
3960  }
3961 
3962 template<typename T>
3963 inline
3965 Matrix4d<T>::col_begin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3966  const typename Matrix4d<T>::size_type col) const
3967  {
3968  Array4d<T> const * tp(array_);
3969  return tp->col_begin(slab,slice,col);
3970  }
3971 
3972 
3973 template<typename T>
3974 inline
3976 Matrix4d<T>::col_end(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3977  const typename Matrix4d<T>::size_type col)
3978  {
3979  return array_->col_end(slab,slice,col);
3980  }
3981 
3982 template<typename T>
3983 inline
3985 Matrix4d<T>::col_end(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3986  const typename Matrix4d<T>::size_type col) const
3987  {
3988  Array4d<T> const * tp(array_);
3989  return tp->col_end(slab,slice,col);
3990  }
3991 
3992 template<typename T>
3993 inline
3995 Matrix4d<T>::col_rbegin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
3996  const typename Matrix4d<T>::size_type col)
3997  {
3998  return array_->col_rbegin(slab,slice,col);
3999  }
4000 
4001 template<typename T>
4002 inline
4004 Matrix4d<T>::col_rbegin(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
4005  const typename Matrix4d<T>::size_type col) const
4006  {
4007  Array4d<T> const * tp(array_);
4008  return tp->col_rbegin(slab,slice,col);
4009  }
4010 
4011 
4012 template<typename T>
4013 inline
4015 Matrix4d<T>::col_rend(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
4016  const typename Matrix4d<T>::size_type col)
4017  {
4018  return array_->col_rend(slab,slice,col);
4019  }
4020 
4021 template<typename T>
4022 inline
4024 Matrix4d<T>::col_rend(const typename Matrix4d<T>::size_type slab, const typename Matrix4d<T>::size_type slice,
4025  const typename Matrix4d<T>::size_type col) const
4026  {
4027  Array4d<T> const * tp(array_);
4028  return tp->col_rend(slab,slice,col);
4029  }
4030 
4031 //--------------------slab range iterators----------------------
4032 
4033 template<typename T>
4034 inline
4036  const typename Matrix4d<T>::size_type row,const typename Matrix4d<T>::size_type col,
4037  const slip::Range<int>& range){
4038  return array_->slab_begin(slice,row,col,range);
4039 }
4040 
4041 
4042 template<typename T>
4043 inline
4045  const typename Matrix4d<T>::size_type row,const typename Matrix4d<T>::size_type col,
4046  const slip::Range<int>& range){
4047  return array_->slab_end(slice,row,col,range);
4048 }
4049 
4050 
4051 template<typename T>
4052 inline
4054  const typename Matrix4d<T>::size_type row,const typename Matrix4d<T>::size_type col,
4055  const slip::Range<int>& range) const{
4056  Array4d<T> const * tp(array_);
4057  return tp->slab_begin(slice,row,col,range);
4058 }
4059 
4060 template<typename T>
4061 inline
4063  const typename Matrix4d<T>::size_type row,const typename Matrix4d<T>::size_type col,
4064  const slip::Range<int>& range) const{
4065  Array4d<T> const * tp(array_);
4066  return tp->slab_end(slice,row,col,range);
4067 }
4068 
4069 template<typename T>
4070 inline
4072  const typename Matrix4d<T>::size_type row,const typename Matrix4d<T>::size_type col,
4073  const slip::Range<int>& range){
4074  return array_->slab_rbegin(slice,row,col,range);
4075 }
4076 
4077 
4078 template<typename T>
4079 inline
4081  const Matrix4d<T>::size_type row, const Matrix4d<T>::size_type col,
4082  const slip::Range<int>& range){
4083  return array_->slab_rend(slice,row,col,range);
4084 }
4085 
4086 
4087 template<typename T>
4088 inline
4090  const typename Matrix4d<T>::size_type row,const typename Matrix4d<T>::size_type col,
4091  const slip::Range<int>& range) const{
4092  Array4d<T> const * tp(array_);
4093  return tp->slab_rbegin(slice,row,col,range);
4094 }
4095 
4096 template<typename T>
4097 inline
4099  const typename Matrix4d<T>::size_type row,const typename Matrix4d<T>::size_type col,
4100  const slip::Range<int>& range) const{
4101  Array4d<T> const * tp(array_);
4102  return tp->slab_rend(slice,row,col,range);
4103 }
4104 
4105 
4106 //--------------------Constant slice range iterators----------------------
4107 
4108 template<typename T>
4109 inline
4112  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4113  const slip::Range<int>& range)
4114  {
4115  return array_->slice_begin(slab,row,col,range);
4116  }
4117 
4118 template<typename T>
4119 inline
4122  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4123  const slip::Range<int>& range) const
4124  {
4125  Array4d<T> const * tp(array_);
4126  return tp->slice_begin(slab,row,col,range);
4127  }
4128 
4129 template<typename T>
4130 inline
4133  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4134  const slip::Range<int>& range)
4135  {
4136  return array_->slice_end(slab,row,col,range);
4137  }
4138 
4139 template<typename T>
4140 inline
4143  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4144  const slip::Range<int>& range) const
4145  {
4146  Array4d<T> const * tp(array_);
4147  return tp->slice_end(slab,row,col,range);
4148  }
4149 
4150 template<typename T>
4151 inline
4154  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4155  const slip::Range<int>& range)
4156  {
4157  return array_->slice_rbegin(slab,row,col,range);
4158  }
4159 
4160 template<typename T>
4161 inline
4164  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4165  const slip::Range<int>& range) const
4166  {
4167  Array4d<T> const * tp(array_);
4168  return tp->slice_rbegin(slab,row,col,range);
4169  }
4170 
4171 template<typename T>
4172 inline
4175  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4176  const slip::Range<int>& range)
4177  {
4178  return array_->slice_rend(slab,row,col,range);
4179  }
4180 
4181 template<typename T>
4182 inline
4185  const typename Matrix4d<T>::size_type row, const typename Matrix4d<T>::size_type col,
4186  const slip::Range<int>& range) const
4187  {
4188  Array4d<T> const * tp(array_);
4189  return tp->slice_rend(slab,row,col,range);
4190  }
4191 
4192 //--------------------Constant row range iterators----------------------
4193 
4194 template<typename T>
4195 inline
4198  const typename Matrix4d<T>::size_type slice, const typename Matrix4d<T>::size_type row,const slip::Range<int>& range)
4199  {
4200  return array_->row_begin(slab,slice,row,range);
4201  }
4202 
4203 template<typename T>
4204 inline
4207  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type row,
4208  const slip::Range<int>& range) const
4209  {
4210  Array4d<T> const * tp(array_);
4211  return tp->row_begin(slab,slice,row,range);
4212  }
4213 
4214 template<typename T>
4215 inline
4217 Matrix4d<T>::row_end(const typename Matrix4d<T>::size_type slab,
4218  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type row,
4219  const slip::Range<int>& range)
4220  {
4221  return array_->row_end(slab,slice,row,range);
4222  }
4223 
4224 template<typename T>
4225 inline
4227 Matrix4d<T>::row_end(const typename Matrix4d<T>::size_type slab,
4228  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type row,
4229  const slip::Range<int>& range) const
4230  {
4231  Array4d<T> const * tp(array_);
4232  return tp->row_end(slab,slice,row,range);
4233  }
4234 
4235 template<typename T>
4236 inline
4239  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type row,
4240  const slip::Range<int>& range)
4241  {
4242  return array_->row_rbegin(slab,slice,row,range);
4243  }
4244 
4245 template<typename T>
4246 inline
4249  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type row,
4250  const slip::Range<int>& range) const
4251  {
4252  Array4d<T> const * tp(array_);
4253  return tp->row_rbegin(slab,slice,row,range);
4254  }
4255 
4256 template<typename T>
4257 inline
4259 Matrix4d<T>::row_rend(const typename Matrix4d<T>::size_type slab,
4260  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type row,
4261  const slip::Range<int>& range)
4262  {
4263  return array_->row_rend(slab,slice,row,range);
4264  }
4265 
4266 template<typename T>
4267 inline
4269 Matrix4d<T>::row_rend(const typename Matrix4d<T>::size_type slab,
4270  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type row,
4271  const slip::Range<int>& range) const
4272  {
4273  Array4d<T> const * tp(array_);
4274  return tp->row_rend(slab,slice,row,range);
4275  }
4276 
4277 //--------------------Constant col range iterators----------------------
4278 
4279 template<typename T>
4280 inline
4283  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4284  const slip::Range<int>& range)
4285  {
4286  return array_->col_begin(slab,slice,col,range);
4287  }
4288 
4289 template<typename T>
4290 inline
4293  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4294  const slip::Range<int>& range) const
4295  {
4296  Array4d<T> const * tp(array_);
4297  return tp->col_begin(slab,slice,col,range);
4298  }
4299 
4300 template<typename T>
4301 inline
4303 Matrix4d<T>::col_end(const typename Matrix4d<T>::size_type slab,
4304  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4305  const slip::Range<int>& range)
4306  {
4307  return array_->col_end(slab,slice,col,range);
4308  }
4309 
4310 template<typename T>
4311 inline
4313 Matrix4d<T>::col_end(const typename Matrix4d<T>::size_type slab,
4314  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4315  const slip::Range<int>& range) const
4316  {
4317  Array4d<T> const * tp(array_);
4318  return tp->col_end(slab,slice,col,range);
4319  }
4320 
4321 template<typename T>
4322 inline
4325  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4326  const slip::Range<int>& range)
4327  {
4328  return array_->col_rbegin(slab,slice,col,range);
4329  }
4330 
4331 template<typename T>
4332 inline
4335  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4336  const slip::Range<int>& range) const
4337  {
4338  Array4d<T> const * tp(array_);
4339  return tp->col_rbegin(slab,slice,col,range);
4340  }
4341 
4342 template<typename T>
4343 inline
4345 Matrix4d<T>::col_rend(const typename Matrix4d<T>::size_type slab,
4346  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4347  const slip::Range<int>& range)
4348  {
4349  return array_->col_rend(slab,slice,col,range);
4350  }
4351 
4352 template<typename T>
4353 inline
4355 Matrix4d<T>::col_rend(const typename Matrix4d<T>::size_type slab,
4356  const typename Matrix4d<T>::size_type slice,const typename Matrix4d<T>::size_type col,
4357  const slip::Range<int>& range) const
4358  {
4359  Array4d<T> const * tp(array_);
4360  return tp->col_rend(slab,slice,col,range);
4361  }
4362 
4363 
4364 //****************************************************************************
4365 // Four dimensional iterators
4366 //****************************************************************************
4367 
4368 //------------------------ Global iterators------------------------------------
4369 
4370 template<typename T>
4371 inline
4373 {
4374  return array_->first_front_upper_left();
4375 }
4376 
4377 template<typename T>
4378 inline
4380 {
4381  Array4d<T> const * tp(array_);
4382  return tp->first_front_upper_left();
4383 }
4384 
4385 
4386 template<typename T>
4387 inline
4389 {
4390  return array_->last_back_bottom_right();
4391 }
4392 
4393 template<typename T>
4394 inline
4396 {
4397  Array4d<T> const * tp(array_);
4398  return tp->last_back_bottom_right();
4399 }
4400 
4401 template<typename T>
4402 inline
4405 {
4406  return array_->rlast_back_bottom_right();
4407 }
4408 
4409 template<typename T>
4410 inline
4413 {
4414  Array4d<T> const * tp(array_);
4415  return tp->rlast_back_bottom_right();
4416 }
4417 
4418 template<typename T>
4419 inline
4422 {
4423  return array_->rfirst_front_upper_left();
4424 }
4425 
4426 template<typename T>
4427 inline
4430 {
4431  Array4d<T> const * tp(array_);
4432  return tp->rfirst_front_upper_left();
4433 }
4434 
4435 //------------------------ Box iterators------------------------------------
4436 
4437 template<typename T>
4438 inline
4440 {
4441  return array_->first_front_upper_left(box);
4442 }
4443 
4444 template<typename T>
4445 inline
4447 {
4448  Array4d<T> const * tp(array_);
4449  return tp->first_front_upper_left(box);
4450 }
4451 
4452 
4453 template<typename T>
4454 inline
4455 typename Matrix4d<T>::iterator4d
4457 {
4458  return array_->last_back_bottom_right(box);
4459 }
4460 
4461 template<typename T>
4462 inline
4465 {
4466  Array4d<T> const * tp(array_);
4467  return tp->last_back_bottom_right(box);
4468 }
4469 
4470 template<typename T>
4471 inline
4474 {
4475  return array_->rlast_back_bottom_right(box);
4476 }
4477 
4478 template<typename T>
4479 inline
4482 {
4483  Array4d<T> const * tp(array_);
4484  return tp->rlast_back_bottom_right(box);
4485 }
4486 
4487 template<typename T>
4488 inline
4491 {
4492  return array_->rfirst_front_upper_left(box);
4493 }
4494 
4495 template<typename T>
4496 inline
4499 {
4500  Array4d<T> const * tp(array_);
4501  return tp->rfirst_front_upper_left(box);
4502 }
4503 
4504 //------------------------ Range iterators------------------------------------
4505 
4506 template<typename T>
4507 inline
4509 Matrix4d<T>::first_front_upper_left(const typename Matrix4d<T>::range& slab_range,
4510  const typename Matrix4d<T>::range& slice_range,
4511  const typename Matrix4d<T>::range& row_range,
4512  const typename Matrix4d<T>::range& col_range)
4513  {
4514  return array_->first_front_upper_left(slab_range,slice_range,row_range,col_range);
4515  }
4516 
4517 template<typename T>
4518 inline
4520 Matrix4d<T>::last_back_bottom_right(const typename Matrix4d<T>::range& slab_range,
4521  const typename Matrix4d<T>::range& slice_range,
4522  const typename Matrix4d<T>::range& row_range,
4523  const typename Matrix4d<T>::range& col_range)
4524  {
4525  return array_->last_back_bottom_right(slab_range,slice_range,row_range,col_range);
4526  }
4527 
4528 
4529 template<typename T>
4530 inline
4532 Matrix4d<T>::first_front_upper_left(const typename Matrix4d<T>::range& slab_range,
4533  const typename Matrix4d<T>::range& slice_range,
4534  const typename Matrix4d<T>::range& row_range,
4535  const typename Matrix4d<T>::range& col_range) const
4536  {
4537  Array4d<T> const * tp(array_);
4538  return tp->first_front_upper_left(slab_range,slice_range,row_range,col_range);
4539  }
4540 
4541 
4542 template<typename T>
4543 inline
4545 Matrix4d<T>::last_back_bottom_right(const typename Matrix4d<T>::range& slab_range,
4546  const typename Matrix4d<T>::range& slice_range,
4547  const typename Matrix4d<T>::range& row_range,
4548  const typename Matrix4d<T>::range& col_range) const
4549  {
4550  Array4d<T> const * tp(array_);
4551  return tp->last_back_bottom_right(slab_range,slice_range,row_range,col_range);
4552  }
4553 
4554 template<typename T>
4555 inline
4557 Matrix4d<T>::rfirst_front_upper_left(const typename Matrix4d<T>::range& slab_range,
4558  const typename Matrix4d<T>::range& slice_range,
4559  const typename Matrix4d<T>::range& row_range,
4560  const typename Matrix4d<T>::range& col_range)
4561  {
4562  return array_->rfirst_front_upper_left(slab_range,slice_range,row_range,col_range);
4563  }
4564 
4565 template<typename T>
4566 inline
4568 Matrix4d<T>::rfirst_front_upper_left(const typename Matrix4d<T>::range& slab_range,
4569  const typename Matrix4d<T>::range& slice_range,
4570  const typename Matrix4d<T>::range& row_range,
4571  const typename Matrix4d<T>::range& col_range) const
4572  {
4573  Array4d<T> const * tp(array_);
4574  return tp->rfirst_front_upper_left(slab_range,slice_range,row_range,col_range);
4575  }
4576 
4577 template<typename T>
4578 inline
4580 Matrix4d<T>::rlast_back_bottom_right(const typename Matrix4d<T>::range& slab_range,
4581  const typename Matrix4d<T>::range& slice_range,
4582  const typename Matrix4d<T>::range& row_range,
4583  const typename Matrix4d<T>::range& col_range)
4584  {
4585  return array_->rlast_back_bottom_right(slab_range,slice_range,row_range,col_range);
4586  }
4587 
4588 template<typename T>
4589 inline
4591 Matrix4d<T>::rlast_back_bottom_right(const typename Matrix4d<T>::range& slab_range,
4592  const typename Matrix4d<T>::range& slice_range,
4593  const typename Matrix4d<T>::range& row_range,
4594  const typename Matrix4d<T>::range& col_range) const
4595  {
4596  Array4d<T> const * tp(array_);
4597  return tp->rlast_back_bottom_right(slab_range,slice_range,row_range,col_range);
4598  }
4599 
4600 
4602 
4604 /* @{ */
4605  template <typename T>
4606 inline
4607 std::ostream& operator<<(std::ostream & out, const Matrix4d<T>& a)
4608 {
4609  out<<*(a.array_);
4610  return out;
4611 }
4612 /* @} */
4613 
4615  // Elements access operators
4617  template<typename T>
4618  inline
4619  T***
4621  {
4622  return (*array_)[l];
4623  }
4624 
4625  template<typename T>
4626  inline
4627  const T** const*
4628  Matrix4d<T>::operator[](const typename Matrix4d<T>::size_type l) const
4629  {
4630  Array4d<T> const * tp(array_);
4631  return tp->operator[](l);
4632  }
4633 
4634  template<typename T>
4635  inline
4636  typename Matrix4d<T>::reference
4638  const typename Matrix4d<T>::size_type k,
4639  const typename Matrix4d<T>::size_type i,
4640  const typename Matrix4d<T>::size_type j)
4641  {
4642  return (*array_)[l][k][i][j];
4643  }
4644 
4645  template<typename T>
4646  inline
4649  const typename Matrix4d<T>::size_type k,
4650  const typename Matrix4d<T>::size_type i,
4651  const typename Matrix4d<T>::size_type j) const
4652  {
4653  return (*array_)[l][k][i][j];
4654  }
4655 
4657 
4658  template<typename T>
4659  inline
4660  std::string
4661  Matrix4d<T>::name() const {return "Matrix4d";}
4662 
4663  template<typename T>
4664  inline
4665  typename Matrix4d<T>::size_type
4666  Matrix4d<T>::dim1() const {return array_->dim1();}
4667 
4668  template<typename T>
4669  inline
4670  typename Matrix4d<T>::size_type
4671  Matrix4d<T>::slabs() const {return array_->dim1();}
4672 
4673  template<typename T>
4674  inline
4675  typename Matrix4d<T>::size_type
4676  Matrix4d<T>::dim2() const {return array_->dim2();}
4677 
4678  template<typename T>
4679  inline
4680  typename Matrix4d<T>::size_type
4681  Matrix4d<T>::slices() const {return array_->dim2();}
4682 
4683  template<typename T>
4684  inline
4685  typename Matrix4d<T>::size_type
4686  Matrix4d<T>::dim3() const {return array_->dim3();}
4687 
4688  template<typename T>
4689  inline
4690  typename Matrix4d<T>::size_type
4691  Matrix4d<T>::rows() const {return array_->dim3();}
4692 
4693  template<typename T>
4694  inline
4695  typename Matrix4d<T>::size_type
4696  Matrix4d<T>::dim4() const {return array_->dim4();;}
4697 
4698  template<typename T>
4699  inline
4700  typename Matrix4d<T>::size_type
4701  Matrix4d<T>::cols() const {return array_->dim4();}
4702 
4703  template<typename T>
4704  inline
4705  typename Matrix4d<T>::size_type
4706  Matrix4d<T>::columns() const {return array_->dim4();;}
4707 
4708 
4709  template<typename T>
4710  inline
4711  typename Matrix4d<T>::size_type
4712  Matrix4d<T>::size() const {return array_->size();}
4713 
4714  template<typename T>
4715  inline
4716  typename Matrix4d<T>::size_type
4717  Matrix4d<T>::max_size() const {return array_->max_size();}
4718 
4719  template<typename T>
4720  inline
4721  bool Matrix4d<T>::empty()const {return array_->empty();}
4722 
4723  template<typename T>
4724  inline
4726  {
4727  array_->swap(*(M.array_));
4728  }
4729 
4730 
4732  // comparison operators
4734 
4735  /* @{ */
4736  template<typename T>
4737  inline
4738  bool operator==(const Matrix4d<T>& x,
4739  const Matrix4d<T>& y)
4740  {
4741  return ( x.size() == y.size()
4742  && std::equal(x.begin(),x.end(),y.begin()));
4743  }
4744 
4745  template<typename T>
4746  inline
4747  bool operator!=(const Matrix4d<T>& x,
4748  const Matrix4d<T>& y)
4749  {
4750  return !(x == y);
4751  }
4752  /* @} */
4753 
4755  /* @{ */
4756 
4757  template<typename T>
4758  inline
4759  bool operator<(const Matrix4d<T>& x,
4760  const Matrix4d<T>& y)
4761  {
4762  return std::lexicographical_compare(x.begin(), x.end(),
4763  y.begin(), y.end());
4764  }
4765 
4766 
4767  template<typename T>
4768  inline
4769  bool operator>(const Matrix4d<T>& x,
4770  const Matrix4d<T>& y)
4771  {
4772  return (y < x);
4773  }
4774 
4775  template<typename T>
4776  inline
4777  bool operator<=(const Matrix4d<T>& x,
4778  const Matrix4d<T>& y)
4779  {
4780  return !(y < x);
4781  }
4782 
4783  template<typename T>
4784  inline
4785  bool operator>=(const Matrix4d<T>& x,
4786  const Matrix4d<T>& y)
4787  {
4788  return !(x < y);
4789  }
4790  /* @} */
4791 
4793 
4794 
4796  // arithmetic and mathematic operators
4798  template<typename T>
4799  inline
4801  {
4802  std::transform(array_->begin(),array_->end(),array_->begin(),std::bind2nd(std::plus<T>(),val));
4803  return *this;
4804  }
4805 
4806  template<typename T>
4807  inline
4809  {
4810  std::transform(array_->begin(),array_->end(),array_->begin(),std::bind2nd(std::minus<T>(),val));
4811  return *this;
4812  }
4813 
4814  template<typename T>
4815  inline
4817  {
4818  std::transform(array_->begin(),array_->end(),array_->begin(),std::bind2nd(std::multiplies<T>(),val));
4819  return *this;
4820  }
4821 
4822  template<typename T>
4823  inline
4825  {
4826  std::transform(array_->begin(),array_->end(),array_->begin(),std::bind2nd(std::divides<T>(),val));
4827  return *this;
4828  }
4829 
4830  template<typename T>
4831  inline
4833  {
4834  Matrix4d<T> tmp(*this);
4835  std::transform(array_->begin(),array_->end(),tmp.begin(),std::negate<T>());
4836  return tmp;
4837  }
4838 
4839  template<typename T>
4840  inline
4842  {
4843  assert(this->dim1() == rhs.dim1());
4844  assert(this->dim2() == rhs.dim2());
4845  assert(this->dim3() == rhs.dim3());
4846  assert(this->dim4() == rhs.dim4());
4847  std::transform(array_->begin(),array_->end(),(*(rhs.array_)).begin(),array_->begin(),std::plus<T>());
4848  return *this;
4849  }
4850 
4851  template<typename T>
4852  inline
4854  {
4855  assert(this->dim1() == rhs.dim1());
4856  assert(this->dim2() == rhs.dim2());
4857  assert(this->dim3() == rhs.dim3());
4858  assert(this->dim4() == rhs.dim4());
4859  std::transform(array_->begin(),array_->end(),(*(rhs.array_)).begin(),array_->begin(),std::minus<T>());
4860  return *this;
4861  }
4862 
4863  template<typename T>
4864  inline
4866  {
4867  assert(this->dim1() == rhs.dim1());
4868  assert(this->dim2() == rhs.dim2());
4869  assert(this->dim3() == rhs.dim3());
4870  assert(this->dim4() == rhs.dim4());
4871  std::transform(array_->begin(),array_->end(),(*(rhs.array_)).begin(),array_->begin(),std::multiplies<T>());
4872  return *this;
4873  }
4874 
4875  template<typename T>
4876  inline
4878  {
4879  assert(this->size() == rhs.size());
4880  std::transform(array_->begin(),array_->end(),(*(rhs.array_)).begin(),array_->begin(),std::divides<T>());
4881  return *this;
4882  }
4883 
4884 
4885 
4886  template<typename T>
4887  inline
4888  T& Matrix4d<T>::min() const
4889  {
4890  assert(array_->size() != 0);
4891  return *std::min_element(array_->begin(),array_->end());
4892  }
4893 
4894  template<typename T>
4895  inline
4896  T& Matrix4d<T>::max() const
4897  {
4898  assert(array_->size() != 0);
4899  return *std::max_element(array_->begin(),array_->end());
4900  }
4901 
4902  template<typename T>
4903  inline
4905  {
4906  assert(array_->size() != 0);
4907  return std::accumulate(array_->begin(),array_->end(),T());
4908  }
4909 
4910 
4911  template<typename T>
4912  inline
4914  {
4915  slip::apply(this->begin(),this->end(),this->begin(),fun);
4916  return *this;
4917  }
4918 
4919  template<typename T>
4920  inline
4921  Matrix4d<T>& Matrix4d<T>::apply(T (*fun)(const T&))
4922  {
4923  slip::apply(this->begin(),this->end(),this->begin(),fun);
4924  return *this;
4925  }
4926 
4927 
4929  /* @{ */
4930  template<typename T>
4931  inline
4933  const Matrix4d<T>& M2)
4934  {
4935  assert(M1.dim1() == M2.dim1());
4936  assert(M1.dim2() == M2.dim2());
4937  assert(M1.dim3() == M2.dim3());
4938  assert(M1.dim4() == M2.dim4());
4939 
4940  Matrix4d<T> tmp(M1.dim1(),M1.dim2(),M1.dim3(),M1.dim4());
4941  std::transform(M1.begin(),M1.end(),M2.begin(),tmp.begin(),std::plus<T>());
4942  return tmp;
4943  }
4944 
4945  template<typename T>
4946  inline
4948  const T& val)
4949  {
4950  Matrix4d<T> tmp(M1);
4951  tmp+=val;
4952  return tmp;
4953  }
4954 
4955  template<typename T>
4956  inline
4957  Matrix4d<T> operator+(const T& val,
4958  const Matrix4d<T>& M1)
4959  {
4960  return M1 + val;
4961  }
4962 
4963 
4964  template<typename T>
4965  inline
4967  const Matrix4d<T>& M2)
4968  {
4969  assert(M1.dim1() == M2.dim1());
4970  assert(M1.dim2() == M2.dim2());
4971  assert(M1.dim3() == M2.dim3());
4972  assert(M1.dim4() == M2.dim4());
4973 
4974  Matrix4d<T> tmp(M1.dim1(),M1.dim2(),M1.dim3(),M1.dim4());
4975  std::transform(M1.begin(),M1.end(),M2.begin(),tmp.begin(),std::minus<T>());
4976  return tmp;
4977  }
4978 
4979  template<typename T>
4980  inline
4982  const T& val)
4983  {
4984  Matrix4d<T> tmp(M1);
4985  tmp-=val;
4986  return tmp;
4987  }
4988 
4989  template<typename T>
4990  inline
4991  Matrix4d<T> operator-(const T& val,
4992  const Matrix4d<T>& M1)
4993  {
4994  return -(M1 - val);
4995  }
4996 
4997  template<typename T>
4998  inline
5000  const Matrix4d<T>& M2)
5001  {
5002  assert(M1.dim1() == M2.dim1());
5003  assert(M1.dim2() == M2.dim2());
5004  assert(M1.dim3() == M2.dim3());
5005  assert(M1.dim4() == M2.dim4());
5006 
5007  Matrix4d<T> tmp(M1.dim1(),M1.dim2(),M1.dim3(),M1.dim4());
5008  std::transform(M1.begin(),M1.end(),M2.begin(),tmp.begin(),std::multiplies<T>());
5009  return tmp;
5010  }
5011 
5012  template<typename T>
5013  inline
5015  const T& val)
5016  {
5017  Matrix4d<T> tmp(M1);
5018  tmp*=val;
5019  return tmp;
5020  }
5021 
5022  template<typename T>
5023  inline
5024  Matrix4d<T> operator*(const T& val,
5025  const Matrix4d<T>& M1)
5026  {
5027  return M1 * val;
5028  }
5029 
5030  template<typename T>
5031  inline
5033  const Matrix4d<T>& M2)
5034  {
5035  assert(M1.dim1() == M2.dim1());
5036  assert(M1.dim2() == M2.dim2());
5037  assert(M1.dim3() == M2.dim3());
5038  assert(M1.dim4() == M2.dim4());
5039 
5040  Matrix4d<T> tmp(M1.dim1(),M1.dim2(),M1.dim3(),M1.dim4());
5041  std::transform(M1.begin(),M1.end(),M2.begin(),tmp.begin(),std::divides<T>());
5042  return tmp;
5043  }
5044 
5045  template<typename T>
5046  inline
5048  const T& val)
5049  {
5050  Matrix4d<T> tmp(M1);
5051  tmp/=val;
5052  return tmp;
5053  }
5054 
5055  /* @} */
5056 
5057  template<typename T>
5058  inline
5059  T& min(const Matrix4d<T>& M1)
5060  {
5061  return M1.min();
5062  }
5063 
5064  template<typename T>
5065  inline
5066  T& max(const Matrix4d<T>& M1)
5067  {
5068  return M1.max();
5069  }
5070 
5071  template<typename T>
5072  inline
5074  {
5075 
5076  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5077  slip::apply(M.begin(),M.end(),tmp.begin(),std::abs);
5078  return tmp;
5079  }
5080 
5081  template<typename T>
5082  inline
5084  {
5085  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5086  slip::apply(M.begin(),M.end(),tmp.begin(),std::sqrt);
5087  return tmp;
5088  }
5089 
5090  template<typename T>
5091  inline
5093  {
5094  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5095  slip::apply(M.begin(),M.end(),tmp.begin(),std::cos);
5096  return tmp;
5097  }
5098 
5099  template<typename T>
5100  inline
5102  {
5103  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5104  slip::apply(M.begin(),M.end(),tmp.begin(),std::acos);
5105  return tmp;
5106  }
5107 
5108  template<typename T>
5109  inline
5111  {
5112  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5113  slip::apply(M.begin(),M.end(),tmp.begin(),std::sin);
5114  return tmp;
5115  }
5116 
5117  template<typename T>
5118  inline
5120  {
5121  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5122  slip::apply(M.begin(),M.end(),tmp.begin(),std::asin);
5123  return tmp;
5124  }
5125 
5126  template<typename T>
5127  inline
5129  {
5130  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5131  slip::apply(M.begin(),M.end(),tmp.begin(),std::tan);
5132  return tmp;
5133  }
5134 
5135  template<typename T>
5136  inline
5138  {
5139  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5140  slip::apply(M.begin(),M.end(),tmp.begin(),std::atan);
5141  return tmp;
5142  }
5143 
5144  template<typename T>
5145  inline
5147  {
5148  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5149  slip::apply(M.begin(),M.end(),tmp.begin(),std::exp);
5150  return tmp;
5151  }
5152 
5153  template<typename T>
5154  inline
5156  {
5157  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5158  slip::apply(M.begin(),M.end(),tmp.begin(),std::log);
5159  return tmp;
5160  }
5161 
5162  template<typename T>
5163  inline
5165  {
5166  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5167  slip::apply(M.begin(),M.end(),tmp.begin(),std::cosh);
5168  return tmp;
5169  }
5170 
5171  template<typename T>
5172  inline
5174  {
5175  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5176  slip::apply(M.begin(),M.end(),tmp.begin(),std::sinh);
5177  return tmp;
5178  }
5179 
5180  template<typename T>
5181  inline
5183  {
5184  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5185  slip::apply(M.begin(),M.end(),tmp.begin(),std::tanh);
5186  return tmp;
5187  }
5188 
5189  template<typename T>
5190  inline
5192  {
5193  Matrix4d<T> tmp(M.dim1(),M.dim2(),M.dim3(),M.dim4());
5194  slip::apply(M.begin(),M.end(),tmp.begin(),std::log10);
5195  return tmp;
5196  }
5197 
5198 
5199 }//slip::
5200 
5201 #endif //SLIP_MATRIX4D_HPP
slab_iterator slab_end(const size_type slice, const size_type row, const size_type col)
Returns a read/write iterator that points to the one past the end element of the line (slice...
Matrix4d< T > log10(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5191
reverse_iterator4d rfirst_front_upper_left()
Returns a read/write reverse iterator4d. It points to the last back bottom right element of the Array...
Definition: Array4d.hpp:4391
HyperVolume< T > tanh(const HyperVolume< T > &M)
bool operator!=(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1448
This is some iterator to iterate a 4d container into a Box area defined by the subscripts of the 4d c...
iterator4d first_front_upper_left()
Returns a read/write iterator4d that points to the first element of the Matrix4d. It points to the fi...
Definition: Matrix4d.hpp:4372
std::reverse_iterator< const_slice_range_iterator > const_reverse_slice_range_iterator
Definition: Matrix4d.hpp:220
Matrix4d< T > cos(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5092
size_type dim1() const
Returns the number of slabs (first dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4666
Matrix4d< T > tan(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5128
reverse_iterator4d rfirst_front_upper_left()
Returns a read/write reverse iterator4d. It points to the last back bottom right element of the Matri...
Definition: Matrix4d.hpp:4421
T & max(const GrayscaleImage< T > &M1)
Returns the max element of a GrayscaleImage.
reverse_iterator4d rlast_back_bottom_right()
Returns a read/write reverse iterator4d. It points to past the first front upper left element of the ...
Definition: Array4d.hpp:4375
slip::stride_iterator< const_pointer > const_slab_iterator
Definition: Matrix4d.hpp:191
iterator4d last_back_bottom_right()
Returns a read/write iterator4d that points to the past the end element of the Matrix4d. It points to past the end element of the last back bottom right element of the Matrix4d.
Definition: Matrix4d.hpp:4388
row_iterator row_begin(const size_type slab, const size_type slice, const size_type row)
Returns a read/write iterator that points to the first element of the row row of a given slab slab an...
std::reverse_iterator< const_iterator > const_reverse_row_iterator
Definition: Matrix4d.hpp:213
iterator4d last_back_bottom_right()
Returns a read/write iterator4d that points to the past the end element of the Array4d. It points to past the end element of the last back bottom right element of the Array4d.
Definition: Array4d.hpp:4356
row_iterator row_end(const size_type slab, const size_type slice, const size_type row)
Returns a read/write iterator that points to the past-the-end element of the row row of a given slab ...
std::reverse_iterator< const_col_iterator > const_reverse_col_iterator
Definition: Matrix4d.hpp:215
value_type const & const_reference
Definition: Matrix4d.hpp:178
std::reverse_iterator< iterator4d > reverse_iterator4d
Definition: Matrix4d.hpp:232
reverse_row_iterator row_rbegin(const size_type slab, const size_type slice, const size_type row)
Returns a read/write reverse iterator that points to the last element of the row row of a given slab ...
slip::Matrix4d< unsigned char > Matrix4d_uc
unsigned char alias
Definition: Matrix4d.hpp:3278
HyperVolume< T > abs(const HyperVolume< T > &V)
Returns the abs value of each element of the HyperVolume.
std::reverse_iterator< const_iterator4d > const_reverse_iterator4d
Definition: Matrix4d.hpp:233
slice_iterator slice_end(const size_type slab, const size_type row, const size_type col)
Returns a read/write iterator that points to the one past the end element of the line (slab...
size_type slabs() const
Returns the number of slabs (first dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4671
self & operator+=(const T &val)
Add val to each element of the Matrix.
Definition: Matrix4d.hpp:4800
This is some iterator to iterate a 4d container into two Range defined by the indices and strides of ...
iterator end()
Returns a read/write iterator that points one past the last element in the Array4d. Iteration is done in ordinary element order.
Definition: Array4d.hpp:3411
std::reverse_iterator< slab_iterator > reverse_slab_iterator
Definition: Matrix4d.hpp:208
Matrix4d< T > operator-(const T &val, const Matrix4d< T > &M1)
substraction of a scalar to each element of a Matrix4d
Definition: Matrix4d.hpp:4991
std::reverse_iterator< col_range_iterator > reverse_col_range_iterator
Definition: Matrix4d.hpp:223
HyperVolume< T > cosh(const HyperVolume< T > &M)
slip::stride_iterator< const_pointer > const_col_iterator
Definition: Matrix4d.hpp:197
T & min(const GrayscaleImage< T > &M1)
Returns the min element of a GrayscaleImage.
std::reverse_iterator< const_slice_iterator > const_reverse_slice_iterator
Definition: Matrix4d.hpp:211
slip::stride_iterator< slab_iterator > slab_range_iterator
Definition: Matrix4d.hpp:199
This is some iterator to iterate a 4d container into a Box area defined by the subscripts of the 4d c...
bool operator!=(const slip::Matrix4d< T > &x, const slip::Matrix4d< T > &y)
Definition: Matrix4d.hpp:4747
Color< T > operator+(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:602
value_type * pointer
Definition: Matrix4d.hpp:175
slip::Matrix4d< long > Matrix4d_l
long alias
Definition: Matrix4d.hpp:3264
std::reverse_iterator< const_row_range_iterator > const_reverse_row_range_iterator
Definition: Matrix4d.hpp:222
HyperVolume< T > atan(const HyperVolume< T > &M)
HyperVolume< T > sin(const HyperVolume< T > &V)
Returns the sin value of each element of the HyperVolume.
self & operator*=(const T &val)
Definition: Matrix4d.hpp:4816
size_type columns() const
Returns the number of columns (fourth dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4706
slip::Array4d< T >::const_iterator4d_range const_iterator4d_range
Definition: Matrix4d.hpp:230
bool operator>=(const slip::Matrix4d< T > &x, const slip::Matrix4d< T > &y)
Definition: Matrix4d.hpp:4785
slip::Matrix4d< unsigned long > Matrix4d_ul
unsigned long alias
Definition: Matrix4d.hpp:3266
Matrix4d(const size_type d1, const size_type d2, const size_type d3, const std::size_t d4, InputIterator first, InputIterator last)
Contructs a Matrix4d from a range.
Definition: Matrix4d.hpp:314
std::reverse_iterator< const_iterator4d_range > const_reverse_iterator4d_range
Definition: Matrix4d.hpp:235
std::reverse_iterator< col_iterator > reverse_col_iterator
Definition: Matrix4d.hpp:214
HyperVolume< T > exp(const HyperVolume< T > &M)
size_type size() const
Returns the number of elements in the Matrix4d.
Definition: Matrix4d.hpp:4712
self & operator-=(const T &val)
Definition: Matrix4d.hpp:4808
HyperVolume< T > sinh(const HyperVolume< T > &V)
Returns the sinh value of each element of the HyperVolume.
reverse_col_iterator col_rend(const size_type slab, const size_type slice, const size_type col)
Returns a read/write reverse iterator that points to the first element of the column column of a give...
T & max() const
Returns the max element of the Matrix according to the operator <.
Definition: Matrix4d.hpp:4896
std::reverse_iterator< const_slab_range_iterator > const_reverse_slab_range_iterator
Definition: Matrix4d.hpp:218
HyperVolume< T > abs(const HyperVolume< T > &M)
bool operator>(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1469
iterator4d first_front_upper_left()
Returns a read/write iterator4d that points to the first element of the Array4d. It points to the fir...
Definition: Array4d.hpp:4341
HyperVolume< T > sin(const HyperVolume< T > &M)
slip::stride_iterator< pointer > row_range_iterator
Definition: Matrix4d.hpp:203
col_iterator col_begin(const size_type slab, const size_type slice, const size_type col)
Returns a read/write iterator that points to the first element of the column column of a given slab s...
slip::Range< int > range
Definition: Matrix4d.hpp:242
HyperVolume< T > tan(const HyperVolume< T > &V)
Returns the tan value of each element of the HyperVolume.
Matrix4d< T > asin(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5119
value_type & reference
Definition: Matrix4d.hpp:177
HyperVolume< T > cos(const HyperVolume< T > &M)
slip::Array4d< T >::const_iterator4d const_iterator4d
Definition: Matrix4d.hpp:228
std::string name() const
Returns the name of the class.
Definition: Matrix4d.hpp:4661
Matrix4d< T > tanh(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5182
HyperVolume< T > log10(const HyperVolume< T > &V)
Returns the log10 value of each element of the HyperVolume.
slab_iterator slab_begin(const size_type slice, const size_type row, const size_type col)
Returns a read/write iterator that points to the first element of the line (slice,row,col) through the slabs in the Matrix4d. Iteration is done in ordinary element order (increasing slab number).
slip::stride_iterator< pointer > slab_iterator
Definition: Matrix4d.hpp:190
slip::Matrix4d< short > Matrix4d_s
short alias
Definition: Matrix4d.hpp:3268
std::reverse_iterator< iterator > reverse_row_iterator
Definition: Matrix4d.hpp:212
slip::Matrix4d< unsigned short > Matrix4d_us
unsigned long alias
Definition: Matrix4d.hpp:3270
MultivariatePolynomial< T, DIM > operator*(const MultivariatePolynomial< T, DIM > &P1, const MultivariatePolynomial< T, DIM > &P2)
pointwise multiplication of two MultivariatePolynomial
slip::Matrix4d< unsigned int > Matrix4d_ui
unsigned int alias
Definition: Matrix4d.hpp:3274
slip::stride_iterator< slice_iterator > slice_range_iterator
Definition: Matrix4d.hpp:201
std::reverse_iterator< slice_iterator > reverse_slice_iterator
Definition: Matrix4d.hpp:210
std::reverse_iterator< slice_range_iterator > reverse_slice_range_iterator
Definition: Matrix4d.hpp:219
HyperVolume< T > asin(const HyperVolume< T > &V)
Returns the sin value of each element of the HyperVolume.
T & max(const Matrix4d< T > &M1)
Definition: Matrix4d.hpp:5066
slip::stride_iterator< col_iterator > col_range_iterator
Definition: Matrix4d.hpp:205
self & operator=(const Matrix4d< T > &rhs)
Assign a Matrix4d.
Definition: Matrix4d.hpp:3624
slip::stride_iterator< const_pointer > const_row_range_iterator
Definition: Matrix4d.hpp:204
void fill(const T *value)
Fills the container range [begin(),begin()+size()) with a copy of the value array.
Definition: Matrix4d.hpp:2942
Matrix4d< T > log(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5155
std::reverse_iterator< iterator > reverse_iterator
Definition: Matrix4d.hpp:186
Matrix4d< T > sin(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5110
bool empty() const
Returns true if the Matrix4d is empty. (Thus size() == 0)
Definition: Matrix4d.hpp:4721
const_iterator begin() const
Returns a read-only (constant) iterator that points to the first element in the Matrix4d. Iteration is done in ordinary element order.
Definition: Matrix4d.hpp:3668
void copy(_II first, _II last, _OI output_first)
Copy algorithm optimized for slip iterators.
Definition: copy_ext.hpp:177
std::reverse_iterator< const_slab_iterator > const_reverse_slab_iterator
Definition: Matrix4d.hpp:209
Provides a class to manipulate 4d dynamic and generic arrays.
reverse_slice_iterator slice_rend(const size_type slab, const size_type row, const size_type col)
Returns a read/write iterator that points to the one before the first element of the line (slab...
MultivariatePolynomial< T, DIM > operator-(const MultivariatePolynomial< T, DIM > &P1, const MultivariatePolynomial< T, DIM > &P2)
pointwise substraction of two MultivariatePolynomial
Matrix4d()
Constructs a Matrix4d.
Definition: Matrix4d.hpp:3569
pointer iterator
Definition: Matrix4d.hpp:183
Matrix4d< T > exp(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5146
std::reverse_iterator< row_range_iterator > reverse_row_range_iterator
Definition: Matrix4d.hpp:221
std::reverse_iterator< iterator4d_range > reverse_iterator4d_range
Definition: Matrix4d.hpp:234
std::reverse_iterator< slab_range_iterator > reverse_slab_range_iterator
Definition: Matrix4d.hpp:217
iterator end()
Returns a read/write iterator that points one past the last element in the Matrix4d. Iteration is done in ordinary element order.
Definition: Matrix4d.hpp:3691
reverse_col_iterator col_rbegin(const size_type slab, const size_type slice, const size_type col)
Returns a read/write reverse iterator that points to the last element of the column column of a given...
Matrix4d< T > & apply(T(*fun)(T))
Applys the one-parameter C-function fun to each element of the Matrix4d.
Definition: Matrix4d.hpp:4913
T & min(const GrayscaleImage< T > &M1)
Returns the min element of a GrayscaleImage.
HyperVolume< T > sqrt(const HyperVolume< T > &M)
slip::Matrix4d< double > Matrix4d_d
double alias
Definition: Matrix4d.hpp:3260
HyperVolume< T > cos(const HyperVolume< T > &V)
Returns the cos value of each element of the HyperVolume.
slip::stride_iterator< const_slice_iterator > const_slice_range_iterator
Definition: Matrix4d.hpp:202
This is a four-dimensional dynamic and generic container. This container statisfies the Bidirectionna...
Definition: Array4d.hpp:105
HyperVolume< T > sinh(const HyperVolume< T > &M)
const_iterator4d const_default_iterator
Definition: Matrix4d.hpp:239
bool operator>(const slip::Matrix4d< T > &x, const slip::Matrix4d< T > &y)
Definition: Matrix4d.hpp:4769
MultivariatePolynomial< T, DIM > operator/(const MultivariatePolynomial< T, DIM > &P, const T &val)
division of a scalar to each element of a MultivariatePolynomial
void fill(const T &value)
Fills the container range [begin(),begin()+size()) with copies of value.
Definition: Matrix4d.hpp:2931
pointer row_iterator
Definition: Matrix4d.hpp:194
slip::stride_iterator< const_col_iterator > const_col_range_iterator
Definition: Matrix4d.hpp:206
void resize(std::size_t d1, std::size_t d2, std::size_t d3, std::size_t d4, const T &val=T())
Resizes a Matrix4d.
Definition: Matrix4d.hpp:3643
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: Matrix4d.hpp:187
slip::stride_iterator< pointer > slice_iterator
Definition: Matrix4d.hpp:192
slip::Array4d< T >::iterator4d_range iterator4d_range
Definition: Matrix4d.hpp:229
self operator-() const
Definition: Matrix4d.hpp:4832
T *** operator[](const size_type l)
static const std::size_t DIM
Definition: Matrix4d.hpp:245
reference operator()(const size_type l, const size_type k, const size_type i, const size_type j)
Subscript access to the data contained in the Matrix4d.
reverse_slab_iterator slab_rend(const size_type slice, const size_type row, const size_type col)
Returns a read/write iterator that points to the one before the first element of the line (slice...
HyperVolume< T > tanh(const HyperVolume< T > &V)
Returns the tanh value of each element of the HyperVolume.
HyperVolume< T > atan(const HyperVolume< T > &V)
Returns the atan value of each element of the HyperVolume.
self & operator/=(const T &val)
Definition: Matrix4d.hpp:4824
HyperVolume< T > log(const HyperVolume< T > &M)
size_type cols() const
Returns the number of columns (fourth dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4701
std::reverse_iterator< const_col_range_iterator > const_reverse_col_range_iterator
Definition: Matrix4d.hpp:224
size_type dim4() const
Returns the number of columns (fourth dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4696
HyperVolume< T > acos(const HyperVolume< T > &V)
Returns the acos value of each element of the HyperVolume.
size_type dim3() const
Returns the number of rows (third dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4686
std::size_t size_type
Definition: Matrix4d.hpp:181
HyperVolume< T > cosh(const HyperVolume< T > &V)
Returns the cosh value of each element of the HyperVolume.
void swap(Matrix4d &M)
Swaps data with another Matrix4d.
Definition: Matrix4d.hpp:4725
size_type rows() const
Returns the number of rows (third dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4691
Some const iterator to iterate a 4d container into two Range defined by the indices and strides of th...
HyperVolume< T > acos(const HyperVolume< T > &M)
void fill(InputIterator first, InputIterator last)
Fills the container range [begin(),begin()+size()) with a copy of the range [first,last)
Definition: Matrix4d.hpp:2956
Matrix4d< T > acos(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5101
HyperVolume< T > log10(const HyperVolume< T > &M)
slip::stride_iterator< pointer > col_iterator
Definition: Matrix4d.hpp:196
Matrix4d< T > atan(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5137
Matrix4d< T > sinh(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5173
ptrdiff_t difference_type
Definition: Matrix4d.hpp:180
Matrix4d< T > abs(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5073
HyperVolume< T > sqrt(const HyperVolume< T > &V)
Returns the sqrt value of each element of the HyperVolume.
slip::stride_iterator< const_slab_iterator > const_slab_range_iterator
Definition: Matrix4d.hpp:200
const Matrix4d< T > const_self
Definition: Matrix4d.hpp:173
T & min() const
Returns the min element of the Matrix according to the operator <.
Definition: Matrix4d.hpp:4888
slip::Array4d< T >::iterator4d iterator4d
Definition: Matrix4d.hpp:227
Provides some algorithms to apply C like functions to ranges.
Provides a class to manipulate iterator4d within a slip::Range. It is used to iterate throw 4d contai...
const_pointer const_iterator
Definition: Matrix4d.hpp:184
size_type dim2() const
Returns the number of slices (second dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4676
slip::stride_iterator< const_pointer > const_slice_iterator
Definition: Matrix4d.hpp:193
slip::Matrix4d< char > Matrix4d_c
char alias
Definition: Matrix4d.hpp:3276
col_iterator col_end(const size_type slab, const size_type slice, const size_type col)
Returns a read/write iterator that points to the past-the-end element of the column column of a given...
Provides a class to iterate a 1d range according to a step.
~Matrix4d()
Destructor of the Matrix4d.
Definition: Matrix4d.hpp:3611
HyperVolume< T > tan(const HyperVolume< T > &M)
T sum() const
Returns the sum of the elements of the Matrix.
Definition: Matrix4d.hpp:4904
bool operator==(const slip::Matrix4d< T > &x, const slip::Matrix4d< T > &y)
Definition: Matrix4d.hpp:4738
bool operator==(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1439
HyperVolume< T > asin(const HyperVolume< T > &M)
Matrix4d< T > cosh(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5164
size_type max_size() const
Returns the maximal size (number of elements) in the Matrix4d.
Definition: Matrix4d.hpp:4717
reverse_row_iterator row_rend(const size_type slab, const size_type slice, const size_type row)
Returns a read/write reverse iterator that points to the first element of the row row of a given slab...
HyperVolume< T > log(const HyperVolume< T > &V)
Returns the log value of each element of the HyperVolume.
slice_iterator slice_begin(const size_type slab, const size_type row, const size_type col)
Returns a read/write iterator that points to the first element of the line (slab,row,col) through the slices in the Matrix4d. Iteration is done in ordinary element order (increasing slice number).
slip::Matrix4d< int > Matrix4d_i
int alias
Definition: Matrix4d.hpp:3272
MultivariatePolynomial< T, DIM > operator+(const MultivariatePolynomial< T, DIM > &P1, const MultivariatePolynomial< T, DIM > &P2)
pointwise addition of two MultivariatePolynomial
Provides a class to manipulate iterator4d within a slip::Box4d. It is used to iterate throw 4d contai...
Color< T > operator*(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:658
iterator4d default_iterator
Definition: Matrix4d.hpp:238
Matrix4d< T > sqrt(const Matrix4d< T > &M)
Definition: Matrix4d.hpp:5083
reverse_iterator rbegin()
Returns a read/write reverse iterator that points to the last element in the Matrix4d. Iteration is done in reverse element order.
Definition: Matrix4d.hpp:3698
reverse_slab_iterator slab_rbegin(const size_type slice, const size_type row, const size_type col)
Returns a read/write iterator that points to the last element of the line (slice,row,col) through the slabs in the Matrix4d. Iteration is done in reverse element order (decreasing slab number).
const_pointer const_row_iterator
Definition: Matrix4d.hpp:195
reverse_slice_iterator slice_rbegin(const size_type slab, const size_type row, const size_type col)
Returns a read/write iterator that points to the last element of the line (slab,row,col) through the slices in the Matrix4d. Iteration is done in reverse element order (decreasing slice number).
reverse_iterator4d rlast_back_bottom_right()
Returns a read/write reverse iterator4d. It points to past the first front upper left element of the ...
Definition: Matrix4d.hpp:4404
value_type const * const_pointer
Definition: Matrix4d.hpp:176
void apply(InputIterator first, InputIterator last, OutputIterator result, typename std::iterator_traits< OutputIterator >::value_type(*function)(typename std::iterator_traits< InputIterator >::value_type))
Applies a C-function to each element of a range.
Definition: apply.hpp:128
T & max(const GrayscaleImage< T > &M1)
Returns the max element of a GrayscaleImage.
Color< T > operator/(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:686
bool operator>=(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1485
Color< T > operator-(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:630
slip::Matrix4d< float > Matrix4d_f
float alias
Definition: Matrix4d.hpp:3262
size_type slices() const
Returns the number of slices (second dimension size) in the Matrix4d.
Definition: Matrix4d.hpp:4681
reverse_iterator rend()
Returns a read/write reverse iterator that points to one before the first element in the Matrix4d...
Definition: Matrix4d.hpp:3712
const_iterator begin() const
Returns a read-only (constant) iterator that points to the first element in the Array4d. Iteration is done in ordinary element order.
Definition: Array4d.hpp:3390
HyperVolume< T > exp(const HyperVolume< T > &V)
Returns the exp value of each element of the HyperVolume.
T & min(const Matrix4d< T > &M1)
Definition: Matrix4d.hpp:5059