This is an automated email from the git hooks/post-receive script.

logari81 pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
     new 988411b5 Improve code readability and remove unused typedefs
988411b5 is described below

commit 988411b584a646f80fe898abf0e96b82368a6056
Author: Konstantinos Poulios <[email protected]>
AuthorDate: Mon Jan 26 23:41:52 2026 +0100

    Improve code readability and remove unused typedefs
    
      - remove value_type alias "ITER"
      - remove typedef "reference", these objects are not fully
        conforming with stl containers anyway
---
 src/gmm/gmm_sub_matrix.h | 296 +++++++++++++++++++++++++++++------------------
 src/gmm/gmm_sub_vector.h | 113 ++++++++++++------
 2 files changed, 260 insertions(+), 149 deletions(-)

diff --git a/src/gmm/gmm_sub_matrix.h b/src/gmm/gmm_sub_matrix.h
index f89d626e..04de6ac3 100644
--- a/src/gmm/gmm_sub_matrix.h
+++ b/src/gmm/gmm_sub_matrix.h
@@ -43,7 +43,7 @@
 namespace gmm {
 
   /* ********************************************************************* */
-  /*           sub row matrices type                                      */
+  /*            sub row matrices type                                      */
   /* ********************************************************************* */
 
   template <typename PT, typename SUBI1, typename SUBI2>
@@ -52,9 +52,10 @@ namespace gmm {
     typedef typename std::iterator_traits<PT>::value_type M;
     typedef M * CPT;
     typedef typename std::iterator_traits<PT>::reference ref_M;
-    typedef typename select_ref<typename linalg_traits<M>
-            ::const_row_iterator, typename linalg_traits<M>::row_iterator,
-           PT>::ref_type iterator;
+    typedef typename select_ref<typename linalg_traits<M>::const_row_iterator,
+                                typename linalg_traits<M>::row_iterator,
+                                PT>::ref_type
+      iterator;
     typedef typename linalg_traits<this_type>::reference reference;
     typedef typename linalg_traits<this_type>::porigin_type porigin_type;
 
@@ -62,16 +63,16 @@ namespace gmm {
     SUBI2 si2;
     iterator begin_;
     porigin_type origin;
-    
-    reference operator()(size_type i, size_type j) const 
+
+    reference operator()(size_type i, size_type j) const
     { return linalg_traits<M>::access(begin_ + si1.index(i), si2.index(j)); }
-   
-    size_type nrows(void) const { return si1.size(); }
-    size_type ncols(void) const { return si2.size(); }
-    
+
+    size_type nrows() const { return si1.size(); }
+    size_type ncols() const { return si2.size(); }
+
     gen_sub_row_matrix(ref_M m, const SUBI1 &s1, const SUBI2 &s2)
       : si1(s1), si2(s2), begin_(mat_row_begin(m)),
-       origin(linalg_origin(m)) {}
+        origin(linalg_origin(m)) {}
     gen_sub_row_matrix() {}
     gen_sub_row_matrix(const gen_sub_row_matrix<CPT, SUBI1, SUBI2> &cr) :
       si1(cr.si1), si2(cr.si2), begin_(cr.begin_),origin(cr.origin) {}
@@ -82,36 +83,35 @@ namespace gmm {
     typedef gen_sub_row_matrix<PT, SUBI1, SUBI2> this_type;
     typedef typename modifiable_pointer<PT>::pointer MPT;
     typedef typename std::iterator_traits<PT>::value_type M;
-    typedef typename select_ref<typename linalg_traits<M>
-            ::const_row_iterator, typename linalg_traits<M>::row_iterator,
-           PT>::ref_type ITER;
-    typedef ITER value_type;
-    typedef ITER *pointer;
-    typedef ITER &reference;
+    typedef typename select_ref<typename linalg_traits<M>::const_row_iterator,
+                                typename linalg_traits<M>::row_iterator,
+                                PT>::ref_type
+      value_type;
+    typedef value_type *pointer;
     typedef ptrdiff_t difference_type;
     typedef size_t size_type;
     typedef std::random_access_iterator_tag  iterator_category;
     typedef gen_sub_row_matrix_iterator<PT, SUBI1, SUBI2> iterator;
 
-    ITER it;
+    value_type it;
     SUBI1 si1;
     SUBI2 si2;
     size_type ii;
-    
+
     iterator operator ++(int) { iterator tmp = *this; ii++; return tmp; }
     iterator operator --(int) { iterator tmp = *this; ii--; return tmp; }
     iterator &operator ++()   { ii++; return *this; }
     iterator &operator --()   { ii--; return *this; }
     iterator &operator +=(difference_type i) { ii += i; return *this; }
     iterator &operator -=(difference_type i) { ii -= i; return *this; }
-    iterator operator +(difference_type i) const 
+    iterator operator +(difference_type i) const
     { iterator itt = *this; return (itt += i); }
     iterator operator -(difference_type i) const
     { iterator itt = *this; return (itt -= i); }
     difference_type operator -(const iterator &i) const { return ii - i.ii; }
 
-    ITER operator *() const { return it + si1.index(ii); }
-    ITER operator [](int i) { return it + si1.index(ii+i); }
+    value_type operator *() const { return it + si1.index(ii); }
+    value_type operator [](int i) { return it + si1.index(ii+i); }
 
     bool operator ==(const iterator &i) const { return (ii == i.ii); }
     bool operator !=(const iterator &i) const { return !(i == *this); }
@@ -119,14 +119,13 @@ namespace gmm {
     bool operator > (const iterator &i) const { return (ii >  i.ii); }
     bool operator >=(const iterator &i) const { return (ii >= i.ii); }
 
-    gen_sub_row_matrix_iterator(void) {}
-    gen_sub_row_matrix_iterator(const 
-            gen_sub_row_matrix_iterator<MPT, SUBI1, SUBI2> &itm)
+    gen_sub_row_matrix_iterator() {}
+    gen_sub_row_matrix_iterator
+      (const gen_sub_row_matrix_iterator<MPT, SUBI1, SUBI2> &itm)
       : it(itm.it), si1(itm.si1), si2(itm.si2), ii(itm.ii) {}
-    gen_sub_row_matrix_iterator(const ITER &iter, const SUBI1 &s1,
-                               const SUBI2 &s2, size_type i)
+    gen_sub_row_matrix_iterator(const value_type &iter, const SUBI1 &s1,
+                                const SUBI2 &s2, size_type i)
       : it(iter), si1(s1), si2(s2), ii(i) { }
-    
   };
 
   template <typename PT, typename SUBI1, typename SUBI2>
@@ -136,64 +135,90 @@ namespace gmm {
     typedef typename which_reference<PT>::is_reference is_reference;
     typedef abstract_matrix linalg_type;
     typedef typename linalg_traits<M>::origin_type origin_type;
-    typedef typename select_ref<const origin_type *, origin_type *,
-                               PT>::ref_type porigin_type;
+    typedef typename select_ref<const origin_type *,
+                                origin_type *,
+                                PT>::ref_type
+      porigin_type;
     typedef typename linalg_traits<M>::value_type value_type;
     typedef typename select_ref<value_type,
-            typename linalg_traits<M>::reference, PT>::ref_type reference;
+                                typename linalg_traits<M>::reference,
+                                PT>::ref_type
+      reference;
     typedef abstract_null_type sub_col_type;
     typedef abstract_null_type col_iterator;
     typedef abstract_null_type const_sub_col_type;
     typedef abstract_null_type const_col_iterator;
-    typedef typename sub_vector_type<const typename org_type<typename
-           linalg_traits<M>::const_sub_row_type>::t *, SUBI2>::vector_type
-            const_sub_row_type;
-    typedef typename select_ref<abstract_null_type, 
-           typename sub_vector_type<typename org_type<typename 
linalg_traits<M>::sub_row_type>::t *,
-           SUBI2>::vector_type, PT>::ref_type sub_row_type;
+    typedef typename sub_vector_type
+                     <const typename org_type<typename linalg_traits<M>
+                                                       
::const_sub_row_type>::t *,
+                      SUBI2>::vector_type
+      const_sub_row_type;
+    typedef typename select_ref
+                     <abstract_null_type,
+                      typename sub_vector_type<typename org_type
+                                                        <typename 
linalg_traits<M>
+                                                                  
::sub_row_type>::t *,
+                                               SUBI2>::vector_type,
+                      PT>::ref_type
+      sub_row_type;
     typedef gen_sub_row_matrix_iterator<typename const_pointer<PT>::pointer,
-           SUBI1, SUBI2> const_row_iterator;
-    typedef typename select_ref<abstract_null_type, 
-           gen_sub_row_matrix_iterator<PT, SUBI1, SUBI2>, PT>::ref_type
-            row_iterator;
+                                        SUBI1, SUBI2>
+      const_row_iterator;
+    typedef typename select_ref<abstract_null_type,
+                                gen_sub_row_matrix_iterator<PT, SUBI1, SUBI2>,
+                                PT>::ref_type
+      row_iterator;
     typedef typename linalg_traits<const_sub_row_type>::storage_type
-            storage_type;
+      storage_type;
     typedef row_major sub_orientation;
     typedef linalg_true index_sorted;
+
     static size_type nrows(const this_type &m) { return m.nrows(); }
+
     static size_type ncols(const this_type &m) { return m.ncols(); }
+
     static const_sub_row_type row(const const_row_iterator &it)
     { return const_sub_row_type(linalg_traits<M>::row(*it), it.si2); }
+
     static sub_row_type row(const row_iterator &it)
     { return sub_row_type(linalg_traits<M>::row(*it), it.si2); }
+
     static const_row_iterator row_begin(const this_type &m)
     { return const_row_iterator(m.begin_, m.si1, m.si2, 0); }
+
     static row_iterator row_begin(this_type &m)
     { return row_iterator(m.begin_, m.si1, m.si2, 0); }
+
     static const_row_iterator row_end(const this_type &m)
     { return const_row_iterator(m.begin_, m.si1, m.si2,  m.nrows()); }
+
     static row_iterator row_end(this_type &m)
     { return row_iterator(m.begin_, m.si1, m.si2, m.nrows()); }
+
     static origin_type* origin(this_type &v) { return v.origin; }
+
     static const origin_type* origin(const this_type &v) { return v.origin; }
+
     static void do_clear(this_type &m) {
       row_iterator it = mat_row_begin(m), ite = mat_row_end(m);
       for (; it != ite; ++it) clear(row(it));
     }
+
     static value_type access(const const_row_iterator &itrow, size_type i)
     { return linalg_traits<M>::access(*itrow, itrow.si2.index(i)); }
+
     static reference access(const row_iterator &itrow, size_type i)
     { return linalg_traits<M>::access(*itrow, itrow.si2.index(i)); }
   };
-  
+
   template <typename PT, typename SUBI1, typename SUBI2>
   std::ostream &operator <<(std::ostream &o,
-                           const gen_sub_row_matrix<PT, SUBI1, SUBI2>& m)
+                            const gen_sub_row_matrix<PT, SUBI1, SUBI2>& m)
   { gmm::write(o,m); return o; }
 
 
   /* ********************************************************************* */
-  /*           sub column matrices type                                   */
+  /*            sub column matrices type                                   */
   /* ********************************************************************* */
 
   template <typename PT, typename SUBI1, typename SUBI2>
@@ -202,9 +227,10 @@ namespace gmm {
     typedef typename std::iterator_traits<PT>::value_type M;
     typedef M * CPT;
     typedef typename std::iterator_traits<PT>::reference ref_M;
-    typedef typename select_ref<typename linalg_traits<M>
-            ::const_col_iterator, typename linalg_traits<M>::col_iterator,
-           PT>::ref_type iterator;
+    typedef typename select_ref<typename linalg_traits<M>::const_col_iterator,
+                                typename linalg_traits<M>::col_iterator,
+                                PT>::ref_type
+      iterator;
     typedef typename linalg_traits<this_type>::reference reference;
     typedef typename linalg_traits<this_type>::porigin_type porigin_type;
 
@@ -212,13 +238,13 @@ namespace gmm {
     SUBI2 si2;
     iterator begin_;
     porigin_type origin;
-    
+
     reference operator()(size_type i, size_type j) const
     { return linalg_traits<M>::access(begin_ + si2.index(j), si1.index(i)); }
 
-    size_type nrows(void) const { return si1.size(); }
-    size_type ncols(void) const { return si2.size(); }
-    
+    size_type nrows() const { return si1.size(); }
+    size_type ncols() const { return si2.size(); }
+
     gen_sub_col_matrix(ref_M m, const SUBI1 &s1, const SUBI2 &s2)
       : si1(s1), si2(s2), begin_(mat_col_begin(m)),
         origin(linalg_origin(m)) {}
@@ -233,35 +259,34 @@ namespace gmm {
     typedef typename modifiable_pointer<PT>::pointer MPT;
     typedef typename std::iterator_traits<PT>::value_type M;
     typedef typename select_ref<typename linalg_traits<M>::const_col_iterator,
-                               typename linalg_traits<M>::col_iterator,
-                               PT>::ref_type ITER;
-    typedef ITER value_type;
-    typedef ITER *pointer;
-    typedef ITER &reference;
+                                typename linalg_traits<M>::col_iterator,
+                                PT>::ref_type
+      value_type;
+    typedef value_type *pointer;
     typedef ptrdiff_t difference_type;
     typedef size_t size_type;
     typedef std::random_access_iterator_tag  iterator_category;
     typedef gen_sub_col_matrix_iterator<PT, SUBI1, SUBI2> iterator;
 
-    ITER it;
+    value_type it;
     SUBI1 si1;
     SUBI2 si2;
     size_type ii;
-    
+
     iterator operator ++(int) { iterator tmp = *this; ii++; return tmp; }
     iterator operator --(int) { iterator tmp = *this; ii--; return tmp; }
     iterator &operator ++()   { ii++; return *this; }
     iterator &operator --()   { ii--; return *this; }
     iterator &operator +=(difference_type i) { ii += i; return *this; }
     iterator &operator -=(difference_type i) { ii -= i; return *this; }
-    iterator operator +(difference_type i) const 
+    iterator operator +(difference_type i) const
     { iterator itt = *this; return (itt += i); }
     iterator operator -(difference_type i) const
     { iterator itt = *this; return (itt -= i); }
     difference_type operator -(const iterator &i) const { return ii - i.ii; }
 
-    ITER operator *() const { return it + si2.index(ii); }
-    ITER operator [](int i) { return it + si2.index(ii+i); }
+    value_type operator *() const { return it + si2.index(ii); }
+    value_type operator [](int i) { return it + si2.index(ii+i); }
 
     bool operator ==(const iterator &i) const { return (ii == i.ii); }
     bool operator !=(const iterator &i) const { return !(i == *this); }
@@ -269,12 +294,12 @@ namespace gmm {
     bool operator > (const iterator &i) const { return (ii >  i.ii); }
     bool operator >=(const iterator &i) const { return (ii >= i.ii); }
 
-    gen_sub_col_matrix_iterator(void) {}
-    gen_sub_col_matrix_iterator(const 
-       gen_sub_col_matrix_iterator<MPT, SUBI1, SUBI2> &itm)
+    gen_sub_col_matrix_iterator() {}
+    gen_sub_col_matrix_iterator
+      (const gen_sub_col_matrix_iterator<MPT, SUBI1, SUBI2> &itm)
       : it(itm.it), si1(itm.si1), si2(itm.si2), ii(itm.ii) {}
-    gen_sub_col_matrix_iterator(const ITER &iter, const SUBI1 &s1,
-                               const SUBI2 &s2, size_type i)
+    gen_sub_col_matrix_iterator(const value_type &iter, const SUBI1 &s1,
+                                const SUBI2 &s2, size_type i)
       : it(iter), si1(s1), si2(s2), ii(i) { }
   };
 
@@ -282,73 +307,108 @@ namespace gmm {
   struct linalg_traits<gen_sub_col_matrix<PT, SUBI1, SUBI2> > {
     typedef gen_sub_col_matrix<PT, SUBI1, SUBI2> this_type;
     typedef typename std::iterator_traits<PT>::value_type M;
-    typedef typename linalg_traits<M>::origin_type origin_type;
-    typedef typename select_ref<const origin_type *, origin_type *,
-                               PT>::ref_type porigin_type;
     typedef typename which_reference<PT>::is_reference is_reference;
     typedef abstract_matrix linalg_type;
+    typedef typename linalg_traits<M>::origin_type origin_type;
+    typedef typename select_ref<const origin_type *,
+                                origin_type *,
+                                PT>::ref_type
+      porigin_type;
     typedef typename linalg_traits<M>::value_type value_type;
     typedef typename select_ref<value_type,
-            typename linalg_traits<M>::reference, PT>::ref_type reference;
+                                typename linalg_traits<M>::reference,
+                                PT>::ref_type
+      reference;
     typedef abstract_null_type sub_row_type;
     typedef abstract_null_type row_iterator;
     typedef abstract_null_type const_sub_row_type;
     typedef abstract_null_type const_row_iterator;
-    typedef typename sub_vector_type<const typename org_type<typename 
linalg_traits<M>::const_sub_col_type>::t *, SUBI1>::vector_type 
const_sub_col_type;
-    typedef typename select_ref<abstract_null_type, typename 
sub_vector_type<typename org_type<typename linalg_traits<M>::sub_col_type>::t 
*, SUBI1>::vector_type, PT>::ref_type sub_col_type;
+    typedef typename sub_vector_type
+                     <const typename org_type<typename linalg_traits<M>
+                                                       
::const_sub_col_type>::t *,
+                      SUBI1>::vector_type
+      const_sub_col_type;
+    typedef typename select_ref
+                     <abstract_null_type,
+                      typename sub_vector_type<typename org_type
+                                                        <typename 
linalg_traits<M>
+                                                                  
::sub_col_type>::t *,
+                                               SUBI1>::vector_type,
+                      PT>::ref_type
+      sub_col_type;
     typedef gen_sub_col_matrix_iterator<typename const_pointer<PT>::pointer,
-           SUBI1, SUBI2> const_col_iterator;
-    typedef typename select_ref<abstract_null_type, 
-           gen_sub_col_matrix_iterator<PT, SUBI1, SUBI2>, PT>::ref_type
-            col_iterator;
+                                        SUBI1, SUBI2>
+      const_col_iterator;
+    typedef typename select_ref<abstract_null_type,
+                                gen_sub_col_matrix_iterator<PT, SUBI1, SUBI2>,
+                                PT>::ref_type
+      col_iterator;
+    typedef typename linalg_traits<const_sub_col_type>::storage_type
+      storage_type;
     typedef col_major sub_orientation;
     typedef linalg_true index_sorted;
-    typedef typename linalg_traits<const_sub_col_type>::storage_type
-    storage_type;
+
     static size_type nrows(const this_type &m) { return m.nrows(); }
+
     static size_type ncols(const this_type &m) { return m.ncols(); }
+
     static const_sub_col_type col(const const_col_iterator &it)
     { return const_sub_col_type(linalg_traits<M>::col(*it), it.si1); }
+
     static sub_col_type col(const col_iterator &it)
     { return sub_col_type(linalg_traits<M>::col(*it), it.si1); }
+
     static const_col_iterator col_begin(const this_type &m)
     { return const_col_iterator(m.begin_, m.si1, m.si2, 0); }
+
     static col_iterator col_begin(this_type &m)
     { return col_iterator(m.begin_, m.si1, m.si2, 0); }
+
     static const_col_iterator col_end(const this_type &m)
     { return const_col_iterator(m.begin_, m.si1, m.si2,  m.ncols()); }
+
     static col_iterator col_end(this_type &m)
-    { return col_iterator(m.begin_, m.si1, m.si2, m.ncols()); } 
+    { return col_iterator(m.begin_, m.si1, m.si2, m.ncols()); }
+
     static origin_type* origin(this_type &v) { return v.origin; }
+
     static const origin_type* origin(const this_type &v) { return v.origin; }
+
     static void do_clear(this_type &m) {
       col_iterator it = mat_col_begin(m), ite = mat_col_end(m);
       for (; it != ite; ++it) clear(col(it));
     }
+
     static value_type access(const const_col_iterator &itcol, size_type i)
     { return linalg_traits<M>::access(*itcol, itcol.si1.index(i)); }
+
     static reference access(const col_iterator &itcol, size_type i)
     { return linalg_traits<M>::access(*itcol, itcol.si1.index(i)); }
   };
 
-  template <typename PT, typename SUBI1, typename SUBI2> std::ostream 
&operator <<
-  (std::ostream &o, const gen_sub_col_matrix<PT, SUBI1, SUBI2>& m)
+  template <typename PT, typename SUBI1, typename SUBI2>
+  std::ostream &operator <<(std::ostream &o,
+                            const gen_sub_col_matrix<PT, SUBI1, SUBI2>& m)
   { gmm::write(o,m); return o; }
 
+
   /* ******************************************************************** */
-  /*           sub matrices                                              */
+  /*            sub matrices                                              */
   /* ******************************************************************** */
-  
+
   template <typename PT, typename SUBI1, typename SUBI2, typename ST>
   struct sub_matrix_type_ {
     typedef abstract_null_type return_type;
   };
+
   template <typename PT, typename SUBI1, typename SUBI2>
   struct sub_matrix_type_<PT, SUBI1, SUBI2, col_major>
   { typedef gen_sub_col_matrix<PT, SUBI1, SUBI2> matrix_type; };
+
   template <typename PT, typename SUBI1, typename SUBI2>
   struct sub_matrix_type_<PT, SUBI1, SUBI2, row_major>
   { typedef gen_sub_row_matrix<PT, SUBI1, SUBI2> matrix_type; };
+
   template <typename PT, typename SUBI1, typename SUBI2>
   struct sub_matrix_type {
     typedef typename std::iterator_traits<PT>::value_type M;
@@ -358,51 +418,63 @@ namespace gmm {
   };
 
   template <typename M, typename SUBI1, typename SUBI2>  inline
-    typename select_return<typename sub_matrix_type<const M *, SUBI1, SUBI2>
-    ::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI2>::matrix_type,
-    M *>::return_type
+  typename select_return
+           <typename sub_matrix_type<const M *, SUBI1, SUBI2>::matrix_type,
+            typename sub_matrix_type<M *, SUBI1, SUBI2>::matrix_type,
+            M *>::return_type
   sub_matrix(M &m, const SUBI1 &si1, const SUBI2 &si2) {
     GMM_ASSERT2(si1.last() <= mat_nrows(m) && si2.last() <= mat_ncols(m),
-               "sub matrix too large");
-    return typename select_return<typename sub_matrix_type<const M *, SUBI1,
-      SUBI2>::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI2>
-      ::matrix_type, M *>::return_type(linalg_cast(m), si1, si2);
+                "sub matrix too large");
+    return
+      typename select_return
+               <typename sub_matrix_type<const M *, SUBI1,SUBI2>::matrix_type,
+                typename sub_matrix_type<M *, SUBI1, SUBI2>::matrix_type,
+                M *>::return_type(linalg_cast(m), si1, si2);
   }
 
   template <typename M, typename SUBI1, typename SUBI2>  inline
-    typename select_return<typename sub_matrix_type<const M *, SUBI1, SUBI2>
-    ::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI2>::matrix_type,
-    const M *>::return_type
+  typename select_return
+           <typename sub_matrix_type<const M *, SUBI1, SUBI2>::matrix_type,
+            typename sub_matrix_type<M *, SUBI1, SUBI2>::matrix_type,
+            const M *>::return_type
   sub_matrix(const M &m, const SUBI1 &si1, const SUBI2 &si2) {
     GMM_ASSERT2(si1.last() <= mat_nrows(m) && si2.last() <= mat_ncols(m),
-               "sub matrix too large");
-    return typename select_return<typename sub_matrix_type<const M *, SUBI1,
-      SUBI2>::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI2>
-      ::matrix_type, const M *>::return_type(linalg_cast(m), si1, si2);
+                "sub matrix too large");
+    return
+      typename select_return
+               <typename sub_matrix_type<const M *, SUBI1, SUBI2>::matrix_type,
+                typename sub_matrix_type<M *, SUBI1, SUBI2>::matrix_type,
+                const M *>::return_type(linalg_cast(m), si1, si2);
   }
 
   template <typename M, typename SUBI1>  inline
-    typename select_return<typename sub_matrix_type<const M *, SUBI1, SUBI1>
-    ::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI1>::matrix_type,
-    M *>::return_type
+  typename select_return
+           <typename sub_matrix_type<const M *, SUBI1, SUBI1>::matrix_type,
+            typename sub_matrix_type<M *, SUBI1, SUBI1>::matrix_type,
+            M *>::return_type
   sub_matrix(M &m, const SUBI1 &si1) {
     GMM_ASSERT2(si1.last() <= mat_nrows(m) && si1.last() <= mat_ncols(m),
-               "sub matrix too large");
-    return typename select_return<typename sub_matrix_type<const M *, SUBI1,
-      SUBI1>::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI1>
-      ::matrix_type, M *>::return_type(linalg_cast(m), si1, si1);
+                "sub matrix too large");
+    return
+      typename select_return
+               <typename sub_matrix_type<const M *, SUBI1, SUBI1>::matrix_type,
+                typename sub_matrix_type<M *, SUBI1, SUBI1>::matrix_type,
+                M *>::return_type(linalg_cast(m), si1, si1);
   }
 
   template <typename M, typename SUBI1>  inline
-    typename select_return<typename sub_matrix_type<const M *, SUBI1, SUBI1>
-    ::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI1>::matrix_type,
-    const M *>::return_type
+  typename select_return
+           <typename sub_matrix_type<const M *, SUBI1, SUBI1>::matrix_type,
+            typename sub_matrix_type<M *, SUBI1, SUBI1>::matrix_type,
+            const M *>::return_type
   sub_matrix(const M &m, const SUBI1 &si1) {
     GMM_ASSERT2(si1.last() <= mat_nrows(m) && si1.last() <= mat_ncols(m),
-               "sub matrix too large");
-    return typename select_return<typename sub_matrix_type<const M *, SUBI1,
-      SUBI1>::matrix_type, typename sub_matrix_type<M *, SUBI1, SUBI1>
-      ::matrix_type, const M *>::return_type(linalg_cast(m), si1, si1);
+                "sub matrix too large");
+    return
+      typename select_return
+               <typename sub_matrix_type<const M *, SUBI1, SUBI1>::matrix_type,
+                typename sub_matrix_type<M *, SUBI1, SUBI1>::matrix_type,
+                const M *>::return_type(linalg_cast(m), si1, si1);
   }
 
 }
diff --git a/src/gmm/gmm_sub_vector.h b/src/gmm/gmm_sub_vector.h
index 7c817975..4d31494b 100644
--- a/src/gmm/gmm_sub_vector.h
+++ b/src/gmm/gmm_sub_vector.h
@@ -96,12 +96,14 @@ namespace gmm {
   void  sparse_sub_vector_iterator<IT, MIT, SUBI>::backward()
   { while(itb!=itbe && index()==size_type(-1)) --itb; }
 
+
   template <typename PT, typename SUBI> struct sparse_sub_vector {
     typedef sparse_sub_vector<PT, SUBI> this_type;
     typedef typename std::iterator_traits<PT>::value_type V;
-    typedef V * CPT;
     typedef typename select_ref<typename linalg_traits<V>::const_iterator,
-            typename linalg_traits<V>::iterator, PT>::ref_type iterator;
+                                typename linalg_traits<V>::iterator,
+                                PT>::ref_type
+      iterator;
     typedef typename linalg_traits<this_type>::reference reference;
     typedef typename linalg_traits<this_type>::porigin_type porigin_type;
 
@@ -110,21 +112,24 @@ namespace gmm {
     SUBI si;
 
     size_type size() const { return si.size(); }
-   
+
     reference operator[](size_type i) const
     { return linalg_traits<V>::access(origin, begin_, end_, si.index(i)); }
 
-    sparse_sub_vector(V &v, const SUBI &s) : begin_(vect_begin(v)),
-       end_(vect_end(v)), origin(linalg_origin(v)), si(s) {}
-    sparse_sub_vector(const V &v, const SUBI &s) 
+    sparse_sub_vector(V &v, const SUBI &s)
+      : begin_(vect_begin(v)), end_(vect_end(v)),
+        origin(linalg_origin(v)), si(s) {}
+    sparse_sub_vector(const V &v, const SUBI &s)
       : begin_(vect_begin(const_cast<V &>(v))),
         end_(vect_end(const_cast<V &>(v))),
         origin(linalg_origin(const_cast<V &>(v))), si(s) {}
     sparse_sub_vector() {}
-    sparse_sub_vector(const sparse_sub_vector<CPT, SUBI> &cr)
-      : begin_(cr.begin_),end_(cr.end_),origin(cr.origin), si(cr.si) {} 
+    sparse_sub_vector(const sparse_sub_vector<V *, SUBI> &cr)
+      : begin_(cr.begin_), end_(cr.end_),
+        origin(cr.origin), si(cr.si) {}
   };
 
+
   template <typename IT, typename MIT, typename SUBI, typename ORG,
             typename PT> inline
   void set_to_begin(sparse_sub_vector_iterator<IT, MIT, SUBI> &it,
@@ -136,10 +141,11 @@ namespace gmm {
     set_to_end(it.itbe, o, typename linalg_traits<VECT>::pV(), ref_t());
     it.forward();
   }
+
   template <typename IT, typename MIT, typename SUBI, typename ORG,
             typename PT> inline
   void set_to_begin(sparse_sub_vector_iterator<IT, MIT, SUBI> &it,
-                    ORG o, const sparse_sub_vector<PT, SUBI> *, 
+                    ORG o, const sparse_sub_vector<PT, SUBI> *,
                     linalg_modifiable) {
     typedef sparse_sub_vector<PT, SUBI> VECT;
     typedef typename linalg_traits<VECT>::V_reference ref_t;
@@ -147,7 +153,7 @@ namespace gmm {
     set_to_end(it.itbe, o, typename linalg_traits<VECT>::pV(), ref_t());
     it.forward();
   }
-  
+
   template <typename IT, typename MIT, typename SUBI, typename ORG,
             typename PT> inline
   void set_to_end(sparse_sub_vector_iterator<IT, MIT, SUBI> &it,
@@ -158,6 +164,7 @@ namespace gmm {
     set_to_end(it.itbe, o, typename linalg_traits<VECT>::pV(), ref_t());
     it.forward();
   }
+
   template <typename IT, typename MIT, typename SUBI, typename ORG,
             typename PT> inline
   void set_to_end(sparse_sub_vector_iterator<IT, MIT, SUBI> &it,
@@ -180,23 +187,33 @@ namespace gmm {
             typename linalg_traits<V>::index_sorted>::bool_type index_sorted;
     typedef typename linalg_traits<V>::is_reference V_reference;
     typedef typename linalg_traits<V>::origin_type origin_type;
-    typedef typename select_ref<const origin_type *, origin_type *,
-                                PT>::ref_type porigin_type;
+    typedef typename select_ref<const origin_type *,
+                                origin_type *,
+                                PT>::ref_type
+      porigin_type;
     typedef typename which_reference<PT>::is_reference is_reference;
     typedef abstract_vector linalg_type;
     typedef typename linalg_traits<V>::value_type value_type;
-    typedef typename select_ref<value_type, typename
-            linalg_traits<V>::reference, PT>::ref_type reference;
+    typedef typename select_ref<value_type,
+                                typename linalg_traits<V>::reference,
+                                PT>::ref_type
+      reference;
     typedef typename select_ref<typename linalg_traits<V>::const_iterator,
-            typename linalg_traits<V>::iterator, PT>::ref_type pre_iterator;
-    typedef typename select_ref<abstract_null_type, 
+                                typename linalg_traits<V>::iterator,
+                                PT>::ref_type
+      pre_iterator;
+    typedef typename select_ref<abstract_null_type,
                                 sparse_sub_vector_iterator<pre_iterator,
                                                            pre_iterator, SUBI>,
-                                PT>::ref_type iterator;
-    typedef sparse_sub_vector_iterator<typename linalg_traits<V>
-            ::const_iterator, pre_iterator, SUBI> const_iterator;
+                                PT>::ref_type
+      iterator;
+    typedef sparse_sub_vector_iterator
+            <typename linalg_traits<V>::const_iterator, pre_iterator, SUBI>
+      const_iterator;
     typedef abstract_sparse storage_type;
+
     static size_type size(const this_type &v) { return v.size(); }
+
     static iterator begin(this_type &v) {
       iterator it;
       it.itb = v.begin_;
@@ -208,6 +225,7 @@ namespace gmm {
         it.forward();
       return it;
     }
+
     static const_iterator begin(const this_type &v) {
       const_iterator it;
       it.itb = v.begin_;
@@ -219,6 +237,7 @@ namespace gmm {
         it.forward();
       return it;
     }
+
     static iterator end(this_type &v) {
       iterator it;
       it.itb = v.end_;
@@ -230,6 +249,7 @@ namespace gmm {
         it.forward();
       return it;
     }
+
     static const_iterator end(const this_type &v) {
       const_iterator it;
       it.itb = v.end_;
@@ -241,8 +261,13 @@ namespace gmm {
         it.forward();
       return it;
     }
-    static origin_type* origin(this_type &v) { return v.origin; }
-    static const origin_type* origin(const this_type &v) { return v.origin; }
+
+    static origin_type* origin(this_type &v)
+    { return v.origin; }
+
+    static const origin_type* origin(const this_type &v)
+    { return v.origin; }
+
     static void clear(origin_type* o, const iterator &begin_,
                       const iterator &end_) {
       std::deque<size_type> ind;
@@ -251,19 +276,25 @@ namespace gmm {
       for (; !(ind.empty()); ind.pop_back())
         access(o, begin_, end_, ind.back()) = value_type(0);
     }
-    static void do_clear(this_type &v) { clear(v.origin, begin(v), end(v)); }
+
+    static void do_clear(this_type &v)
+    { clear(v.origin, begin(v), end(v)); }
+
     static value_type access(const origin_type *o, const const_iterator &it,
                              const const_iterator &ite, size_type i)
     { return linalg_traits<V>::access(o, it.itb, ite.itb, it.si.index(i)); }
+
     static reference access(origin_type *o, const iterator &it,
                             const iterator &ite, size_type i)
     { return linalg_traits<V>::access(o, it.itb, ite.itb, it.si.index(i)); }
   };
 
-  template <typename PT, typename SUBI> std::ostream &operator <<
-  (std::ostream &o, const sparse_sub_vector<PT, SUBI>& m)
+  template <typename PT, typename SUBI>
+  std::ostream &operator <<(std::ostream &o,
+                            const sparse_sub_vector<PT, SUBI>& m)
   { gmm::write(o,m); return o; }
 
+
   /* ********************************************************************* */
   /*            skyline sub-vectors                                        */
   /* ********************************************************************* */
@@ -337,7 +368,9 @@ namespace gmm {
     typedef typename std::iterator_traits<PT>::value_type V;
     typedef V * pV;
     typedef typename select_ref<typename linalg_traits<V>::const_iterator,
-            typename linalg_traits<V>::iterator, PT>::ref_type iterator;
+                                typename linalg_traits<V>::iterator,
+                                PT>::ref_type
+      iterator;
     typedef typename linalg_traits<this_type>::reference reference;
     typedef typename linalg_traits<this_type>::porigin_type porigin_type;
 
@@ -346,7 +379,7 @@ namespace gmm {
     SUBI si;
 
     size_type size() const { return si.size(); }
-   
+
     reference operator[](size_type i) const
     { return linalg_traits<V>::access(origin, begin_, end_, si.index(i)); }
 
@@ -389,7 +422,7 @@ namespace gmm {
     set_to_end(itbe, o, typename linalg_traits<VECT>::pV(), ref_t());
     update_for_sub_skyline(it.itb, itbe, it.si);
   }
-  
+
   template <typename IT, typename MIT, typename SUBI, typename ORG,
             typename PT> inline
   void set_to_end(skyline_sub_vector_iterator<IT, MIT, SUBI> &it,
@@ -412,7 +445,7 @@ namespace gmm {
     IT itb = it.itb;
     set_to_begin(itb, o, typename linalg_traits<VECT>::pV(), ref_t());
     set_to_end(it.itb, o, typename linalg_traits<VECT>::pV(), ref_t());
-    update_for_sub_skyline(itb, it.itb, it.si);   
+    update_for_sub_skyline(itb, it.itb, it.si);
   }
 
 
@@ -424,18 +457,24 @@ namespace gmm {
     typedef typename linalg_traits<V>::is_reference V_reference;
     typedef typename linalg_traits<V>::origin_type origin_type;
     typedef typename select_ref<const origin_type *,
-                                origin_type *, PT>::ref_type porigin_type;
+                                origin_type *,
+                                PT>::ref_type
+      porigin_type;
     typedef V * pV;
     typedef typename which_reference<PT>::is_reference is_reference;
     typedef abstract_vector linalg_type;
     typedef typename linalg_traits<V>::value_type value_type;
-    typedef typename select_ref<value_type, typename
-            linalg_traits<V>::reference, PT>::ref_type reference;
+    typedef typename select_ref<value_type,
+                                typename linalg_traits<V>::reference,
+                                PT>::ref_type
+      reference;
     typedef typename linalg_traits<V>::const_iterator const_V_iterator;
-    typedef typename linalg_traits<V>::iterator V_iterator;    
+    typedef typename linalg_traits<V>::iterator V_iterator;
     typedef typename select_ref<const_V_iterator,
-                                V_iterator, PT>::ref_type pre_iterator;
-    typedef typename select_ref<abstract_null_type, 
+                                V_iterator,
+                                PT>::ref_type
+      pre_iterator;
+    typedef typename select_ref<abstract_null_type,
                                 skyline_sub_vector_iterator<pre_iterator,
                                                             pre_iterator, 
SUBI>,
                                 PT>::ref_type iterator;
@@ -510,7 +549,7 @@ namespace gmm {
     typedef typename vect_ref_type<PT,  V>::iterator iterator;
     typedef tab_ref_index_ref_with_origin<iterator,
       sub_index::const_iterator, V> vector_type;
-  }; 
+  };
 
   template <typename PT>
   struct svrt_ir<PT, unsorted_sub_index, abstract_dense> {
@@ -518,14 +557,14 @@ namespace gmm {
     typedef typename vect_ref_type<PT,  V>::iterator iterator;
     typedef tab_ref_index_ref_with_origin<iterator,
       unsorted_sub_index::const_iterator, V> vector_type;
-  }; 
+  };
 
   template <typename PT>
   struct svrt_ir<PT, sub_interval, abstract_dense> {
     typedef typename std::iterator_traits<PT>::value_type V;
     typedef typename vect_ref_type<PT,  V>::iterator iterator;
     typedef tab_ref_with_origin<iterator, V> vector_type;
-  }; 
+  };
 
   template <typename PT>
   struct svrt_ir<PT, sub_slice, abstract_dense> {


Reply via email to