Re: Including MTL

Rene van Paassen <[email protected]> Tue, 18 Jan 2005 11:31:45 +0100
Newsgroups gmane.comp.lib.mtl.devel
Organization Delft University of Technology, Aerospace Engineering
Message-ID <[email protected]>
On Tue, 2005-01-18 at 09:37, Colin Cotter wrote:
> Hello list,
> 
>     I am getting lots of errors when I try to include mtl header files
> (see bottom of mail). To do the including I am writing
> 
> #include "mtl/mtl.h"
> #include "mtl/matrix.h"
> #include "mtl/utils.h"
> #include "mtl/linalg_vec.h"
> 
> Have I missed something important?

Yes. And we are missing something too. 

What platform are you compiling for??

You are most likely using gcc 3.4 (my guess from the errors you are
getting). gcc 3.4 is more strict, more standards compliant, and chokes
on the mtl code. 

Attached is a patch I have used to successfully compile on Fedora Core
3, and the rpm spec file for FC3

For those who know how to read the mailing list archives, I posted a
patch and spec file before, but found out that some of my application
code did not compile. These are the new and improved versions. No
guarantee that I caught all snags.

I think MTL is a great piece of software that fulfils a real need.
However, I am starting to wonder whether it is still being maintained. I
see enough fixes on the mailing list, it seems time to put up some
patches or a new version.

> best wishes
> 
> -cjc 
> _______________________________________________
> This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
-- 
M.M. (RenĂ©) van Paassen                    [email protected]
Associate Professor                                tel. +31 15 278 5370
Faculty of Aerospace Engineering                   fax. +31 15 278 6480
Kluijverweg 1, NL-2629 HS  Delft         Delft University of Technology 
         >>>>>>>>>>>> http://www.cs.lr.tudelft.nl <<<<<<<<<<<<

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
mtl-gcc34.patch (text/x-patch, 23.5 KB)
diff -Nur mtl-2.1.2-21/acconfig.h mtl-2.1.2-21mod/acconfig.h
--- mtl-2.1.2-21/acconfig.h	2002-07-06 17:48:30.000000000 +0200
+++ mtl-2.1.2-21mod/acconfig.h	2005-01-11 10:34:09.000000000 +0100
@@ -34,7 +34,7 @@
 
 #if defined(__sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 730)
 #  define MTL_NO_TEMPLATE
-#elif defined(__GNUC__) && (__GNUC__ < 9)
+#elif defined(__GNUC__) && (__GNUC__ < 3) && (__GNUC_MINOR__ < 4)
 #  define MTL_NO_TEMPLATE
 #elif defined(__KCC_VERSION) && (__KCC_VERSION < 3400)
 #  define MTL_NO_TEMPLATE
diff -Nur mtl-2.1.2-21/mtl/compressed2D.h mtl-2.1.2-21mod/mtl/compressed2D.h
--- mtl-2.1.2-21/mtl/compressed2D.h	2002-07-06 17:48:34.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/compressed2D.h	2005-01-11 10:16:47.000000000 +0100
@@ -612,11 +612,11 @@
   }
 
   void print() const {
-    cout << "values ";
+    std::cout << "values ";
     print_vector(*values);
-    cout << "indices ";
+    std::cout << "indices ";
     print_vector(*indices);
-    cout << "starts ";
+    std::cout << "starts ";
     print_vector(*starts);
   }
 
@@ -666,8 +666,8 @@
     : Base(d, &vals, &inds, &ptrs),
       ptrs(d.first() + 1, -IND_OFFSET) /* F to C */
   {
-    vals.reserve(dim.first() * 5);
-    inds.reserve(dim.first() * 5);
+    vals.reserve(this->dim.first() * 5);
+    inds.reserve(this->dim.first() * 5);
   }
 
   inline compressed2D(dim_type d, size_type nnz)
@@ -683,8 +683,8 @@
     : Base(d, &vals, &inds, &ptrs), 
       ptrs(d.first() + 1, -IND_OFFSET) /* F to C */
   {
-    vals.reserve(dim.first() * 5);
-    inds.reserve(dim.first() * 5);
+    vals.reserve(this->dim.first() * 5);
+    inds.reserve(this->dim.first() * 5);
   }
 
   //: Copy Constructor
@@ -702,8 +702,8 @@
   inline self& operator=(const self& x) {
     vals = x.vals; ptrs = x.ptrs; inds = x.inds;
     /* fill out inhereted part */
-    dim = x.dim;
-    values = &vals; indices = &inds; starts = &ptrs;
+    this->dim = x.dim;
+    this->values = &vals; this->indices = &inds; this->starts = &ptrs;
     return *this;
   }
 
@@ -801,8 +801,8 @@
   inline self& operator=(const self& x) {
     vals = x.vals; inds = x.inds; ptrs = x.ptrs;
     /* fill out inhereted part */
-    dim = x.dim;
-    values = &vals; indices = &inds; starts = &ptrs;
+    this->dim = x.dim;
+    this->values = &vals; this->indices = &inds; this->starts = &ptrs;
     return *this;
   }
 
diff -Nur mtl-2.1.2-21/mtl/dense2D.h mtl-2.1.2-21mod/mtl/dense2D.h
--- mtl-2.1.2-21/mtl/dense2D.h	2002-07-06 17:48:34.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/dense2D.h	2005-01-11 10:16:47.000000000 +0100
@@ -641,9 +641,10 @@
   inline Iterator base () const { return start + pos; }
     
   inline reference deref(Distance pos, not_strided_tag) const { 
-    return reference((T*)start + offset.oned_offset(pos), 
-		offset.oned_length(pos), 
-		starts.first);
+    return reference(const_cast<T*>(reinterpret_cast<const T*>(start)) +
+		     offset.oned_offset(pos), 
+		     offset.oned_length(pos), 
+		     starts.first);
   }
   inline reference deref(Distance pos, strided_tag) const { 
     InnerOneD vec((T*)start + offset.oned_offset(pos), 
@@ -1235,8 +1236,8 @@
   inline void resize(size_type m, size_type n) {
     rep_ptr newdata = new reptype(Offset::size(m, n, 0, 0));
     size_type i, j;
-    size_type M = MTL_MIN(m, offset.major());
-    size_type N = MTL_MIN(n, offset.minor());
+    size_type M = MTL_MIN(m, this->offset.major());
+    size_type N = MTL_MIN(n, this->offset.minor());
     for (i = 0; i < M; ++i)
       for (j = 0; j < N; ++j)
 	(*newdata)[i * n + j] = (*this)(i,j);
@@ -1244,10 +1245,10 @@
       for (; j < n; ++j)
       (*newdata)[i * n + j] = T();
 
-    data_ = newdata;
-    ld_ = n;
-    offset.dim = dim_type(m, n);
-    offset.ld = n;
+    this->data_ = newdata;
+    this->ld_ = n;
+    this->offset.dim = dim_type(m, n);
+    this->offset.ld = n;
   }
 
 };
@@ -1363,7 +1364,7 @@
   inline external2D& operator=(const external2D& x) {
     rep = x.rep;
     super::operator=(x);
-    data_ = &rep;
+    this->data_ = &rep;
     return *this;
   }
 
diff -Nur mtl-2.1.2-21/mtl/envelope2D.h mtl-2.1.2-21mod/mtl/envelope2D.h
--- mtl-2.1.2-21/mtl/envelope2D.h	2002-07-06 17:48:34.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/envelope2D.h	2005-01-11 10:16:47.000000000 +0100
@@ -296,9 +296,9 @@
   inline envelope2D() : dim(0,0) { }
   //: Constructor from dimension pair
   inline envelope2D(dim_type d)
-    : dim(d), val(1, T(0)), ptr(m, size_type(0))
+    : dim(d), val(1, T(0)), ptr(this->m, size_type(0))
   { 
-    val.reserve(m * 5);
+    val.reserve(this->m * 5);
   }
   //: Constructor from dimension abd bandwidth pairs
   inline envelope2D(dim_type d, dim_type)
diff -Nur mtl-2.1.2-21/mtl/initialize.h mtl-2.1.2-21mod/mtl/initialize.h
--- mtl-2.1.2-21/mtl/initialize.h	2002-07-06 17:48:34.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/initialize.h	2005-01-11 10:16:47.000000000 +0100
@@ -58,7 +58,7 @@
       A(row, col) = e.value;
     }
   } else {
-    cout << " matrix type is symmetric but the matrix in the file is not" << endl;
+    std::cout << " matrix type is symmetric but the matrix in the file is not" << std::endl;
     assert(0);
   }
 }
diff -Nur mtl-2.1.2-21/mtl/light_matrix.h mtl-2.1.2-21mod/mtl/light_matrix.h
--- mtl-2.1.2-21/mtl/light_matrix.h	2002-07-06 17:48:35.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/light_matrix.h	2005-01-11 10:16:47.000000000 +0100
@@ -125,12 +125,12 @@
     class __iterator {
       typedef __iterator self;
     public:
-      typedef oned::value_type value_type;
-      typedef oned::pointer pointer;
-      typedef oned::size_type size_type;
-      typedef oned::difference_type difference_type;
+      typedef typename oned::value_type value_type;
+      typedef typename oned::pointer pointer;
+      typedef typename oned::size_type size_type;
+      typedef typename oned::difference_type difference_type;
 
-      typedef typename IF<isConst, oned::const_reference, oned::reference>::RET reference;
+      typedef typename IF<isConst, typename oned::const_reference, typename oned::reference>::RET reference;
 
       typedef std::random_access_iterator_tag iterator_category;
 
diff -Nur mtl-2.1.2-21/mtl/linalg_vec.h mtl-2.1.2-21mod/mtl/linalg_vec.h
--- mtl-2.1.2-21/mtl/linalg_vec.h	2002-07-06 17:48:35.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/linalg_vec.h	2005-01-11 10:16:47.000000000 +0100
@@ -128,6 +128,7 @@
 
   typedef size_type Vec_size_type;
   typedef difference_type Vec_difference_type;
+  typedef value_type Vec_value_type;
   typedef iterator Vec_iterator;
   typedef const_iterator Vec_const_iterator;
 
@@ -136,7 +137,7 @@
 
     typedef Vec_size_type size_type;
     typedef Vec_difference_type difference_type;
-    typedef Vec_size_type value_type;
+    typedef Vec_value_type value_type;
 
     class iterator {
     public:
diff -Nur mtl-2.1.2-21/mtl/matrix_implementation.h mtl-2.1.2-21mod/mtl/matrix_implementation.h
--- mtl-2.1.2-21/mtl/matrix_implementation.h	2002-07-06 17:48:35.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/matrix_implementation.h	2005-01-11 10:16:47.000000000 +0100
@@ -348,14 +348,14 @@
     : twod(m_in, orien()), indexer(orien::map(dim_type(m_in.nrows(),
                                                        m_in.ncols())))
   { 
-    mtl::initialize(me, m_in);
+    initialize(me, m_in);
   }
   template <class Me>
   inline matrix_implementation(hbstream& m_in, Me& me)
     : twod(m_in, orien()), indexer(orien::map(dim_type(m_in.nrows(),
                                                        m_in.ncols())))
   { 
-    mtl::initialize(me, m_in);
+    initialize(me, m_in);
   }
   template <class Me>
   inline matrix_implementation(mmstream& m_in, band_type bw, Me& me)
@@ -366,7 +366,7 @@
       indexer(orien::map(dim_type(m_in.nrows(), m_in.ncols())),
               orien::map(bw))
   { 
-    mtl::initialize(me, m_in);
+    initialize(me, m_in);
   }
   template <class Me>
   inline matrix_implementation(hbstream& m_in, band_type bw, Me& me)
@@ -377,7 +377,7 @@
       indexer(orien::map(dim_type(m_in.nrows(), m_in.ncols())),
               orien::map(bw))
   { 
-    mtl::initialize(me, m_in);
+    initialize(me, m_in);
   }
 
   inline ~matrix_implementation() { }
@@ -487,6 +487,7 @@
   typedef typename Base::reference reference;
   typedef typename Base::const_reference const_reference;
   typedef typename Base::dim_type dim_type;
+  typedef typename Base::band_type band_type;
   typedef typename Base::dyn_dim dyn_dim;
   typedef typename Base::TwoD TwoD;
   typedef typename Base::OneD OneD;
@@ -624,8 +625,8 @@
   inline ~row_matrix() { }
 
   inline void resize(size_type m, size_type n) { 
-    twod.resize(m, n); 
-    indexer.dim = dim_type(m, n);
+    this->twod.resize(m, n); 
+    this->indexer.dim = dim_type(m, n);
   }
 
   /* submatrix */
@@ -654,18 +655,18 @@
   inline submatrix_type sub_matrix(size_type row_start, size_type row_finish,
                                    size_type col_start, size_type col_finish) const
   {
-    dim_type starts = indexer.at(dim_type(row_start, col_start));
+    dim_type starts = this->indexer.at(dim_type(row_start, col_start));
     size_type m = row_finish - row_start;
     size_type n = col_finish - col_start;
     typedef typename TwoD::is_strided IsStrided;
     if (IsStrided::id) {
-      return submatrix_type((value_type*)twod.data() 
-			    + starts.second() * twod.ld() + starts.first(),
-			    m, n, twod.ld());
+      return submatrix_type((value_type*) this->twod.data() 
+			    + starts.second() * this->twod.ld() + starts.first(),
+			    m, n, this->twod.ld());
     } else {
-      return submatrix_type((value_type*)twod.data() 
-			    + starts.first() * twod.ld() + starts.second(),
-			    m, n, twod.ld());
+      return submatrix_type((value_type*)this->twod.data() 
+			    + starts.first() * this->twod.ld() + starts.second(),
+			    m, n, this->twod.ld());
     }
   }
 
@@ -851,8 +852,8 @@
   inline ~column_matrix() { }
 
   inline void resize(size_type m, size_type n) { 
-    twod.resize(n, m); 
-    indexer.dim = dim_type(n, m);
+    this->twod.resize(n, m); 
+    this->indexer.dim = dim_type(n, m);
   }
 
   /* submatrix */
@@ -877,18 +878,18 @@
   inline submatrix_type sub_matrix(size_type row_start, size_type row_finish,
                              size_type col_start, size_type col_finish) const
   {
-    dim_type starts = indexer.at(dim_type(row_start, col_start));
+    dim_type starts = this->indexer.at(dim_type(row_start, col_start));
     size_type m = row_finish - row_start;
     size_type n = col_finish - col_start;
     typedef typename TwoD::is_strided IsStrided;
     if (IsStrided::id) {
-      return submatrix_type((value_type*)twod.data() 
-			    + starts.second() * twod.ld() + starts.first(),
-			    m, n, twod.ld());
+      return submatrix_type((value_type*)this->twod.data() 
+			    + starts.second() * this->twod.ld() + starts.first(),
+			    m, n, this->twod.ld());
     } else {
-      return submatrix_type((value_type*)twod.data() 
-			    + starts.first() * twod.ld() + starts.second(),
-			    m, n, twod.ld());
+      return submatrix_type((value_type*)this->twod.data() 
+			    + starts.first() * this->twod.ld() + starts.second(),
+			    m, n, this->twod.ld());
     }
   }
 
@@ -950,7 +951,7 @@
 template<class Matrix>
 inline typename rows_type<Matrix>::type
 rows(const Matrix& A) { 
-  return rows_type<Matrix>::type(A, do_strided());
+  return typename rows_type<Matrix>::type(A, do_strided());
 }
 
 //: Access the column-wise view of the matrix
@@ -965,7 +966,7 @@
 template<class Matrix>
 inline typename columns_type<Matrix>::type
 columns(const Matrix& A) { 
-  return columns_type<Matrix>::type(A, do_strided());
+  return typename columns_type<Matrix>::type(A, do_strided());
 }
 
 //: Swap the orientation of a matrix.
@@ -1228,18 +1229,18 @@
 
   //: dynamic uplo constructor
   inline symmetric_matrix(size_type n, int uplo_, int sub)
-    : Base(m, n, Uplo::bandwidth(uplo_, sub, sub)) , uplo(uplo_) { }
+    : Base(this->m, n, Uplo::bandwidth(uplo_, sub, sub)) , uplo(uplo_) { }
 
   //: constructor for external data with dynamic uplo
   inline symmetric_matrix(pointer d, size_type n, int uplo_, int sub)
-    : Base(d, m, n, 
+    : Base(d, this->m, n, 
            Uplo::bandwidth(uplo_, sub, sub).first,
            Uplo::bandwidth(uplo_, sub, sub).second) { }
 
   //: compressed2D external data constructor
   inline symmetric_matrix(size_type m, size_type n, size_type nnz,
 			  pointer val, size_type* ptrs, size_type* inds)
-    : Base(m, n, nnz, val, ptrs, inds) { }
+    : Base(this->m, n, nnz, val, ptrs, inds) { }
 
   //: deprecated 
   inline symmetric_matrix(pointer d, size_type n, int sub)
@@ -1308,10 +1309,10 @@
   
   /* bandwidth (is symmetric too) */
   inline int sub() const {
-    return MTL_MAX(indexer.super(), indexer.sub());
+    return MTL_MAX(this->indexer.super(), this->indexer.sub());
   }
   inline int super() const { 
-    return MTL_MAX(indexer.super(), indexer.sub());
+    return MTL_MAX(this->indexer.super(), this->indexer.sub());
   }
 
 };
diff -Nur mtl-2.1.2-21/mtl/mtl2lapack.h mtl-2.1.2-21mod/mtl/mtl2lapack.h
--- mtl-2.1.2-21/mtl/mtl2lapack.h	2002-07-06 17:48:35.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/mtl2lapack.h	2005-01-11 10:16:47.000000000 +0100
@@ -1125,8 +1125,9 @@
     int m = a.nrows();
     int n = a.ncols();
     int info;
+    typedef typename VectorT::value_type VT;
     mtl_lapack_dispatch::orgqr(m, n, tau.size(), a.data(), lda,
-			       tau.data(), info);
+			       const_cast<VT*>(tau.data()), info);
     return info;
   }
 
diff -Nur mtl-2.1.2-21/mtl/mtl_config.h mtl-2.1.2-21mod/mtl/mtl_config.h
--- mtl-2.1.2-21/mtl/mtl_config.h	2002-07-06 17:48:34.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/mtl_config.h	2005-01-11 10:16:48.000000000 +0100
@@ -6,7 +6,7 @@
 
 #define HAVE_COPYSIGN 1
 #define HAVE_STD_ABS 1
-#define MTL_EXCEPTIONS 0
+#define MTL_EXCEPTIONS 1
 /* #undef USE_BLAIS */
 #define MTL_CMPLR_HAS_LIMITS 1
 
@@ -46,7 +46,7 @@
 
 #if defined(__sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 730)
 #  define MTL_NO_TEMPLATE
-#elif defined(__GNUC__) && (__GNUC__ < 9)
+#elif defined(__GNUC__) && (__GNUC__ < 3)
 #  define MTL_NO_TEMPLATE
 #elif defined(__KCC_VERSION) && (__KCC_VERSION < 3400)
 #  define MTL_NO_TEMPLATE
diff -Nur mtl-2.1.2-21/mtl/mtl_config.h.in mtl-2.1.2-21mod/mtl/mtl_config.h.in
--- mtl-2.1.2-21/mtl/mtl_config.h.in	2002-07-06 17:48:34.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/mtl_config.h.in	2005-01-11 10:44:34.388225897 +0100
@@ -45,7 +45,7 @@
 
 #if defined(__sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 730)
 #  define MTL_NO_TEMPLATE
-#elif defined(__GNUC__) && (__GNUC__ < 9)
+#elif defined(__GNUC__) && (__GNUC__ < 3) && (__GNUC_MINOR__ < 4)
 #  define MTL_NO_TEMPLATE
 #elif defined(__KCC_VERSION) && (__KCC_VERSION < 3400)
 #  define MTL_NO_TEMPLATE
diff -Nur mtl-2.1.2-21/mtl/mtl.h mtl-2.1.2-21mod/mtl/mtl.h
--- mtl-2.1.2-21/mtl/mtl.h	2002-07-06 17:48:35.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/mtl.h	2005-01-11 10:16:48.000000000 +0100
@@ -114,7 +114,7 @@
 typename linalg_traits<Vector>::value_type
 sum(const Vector& x)
 {
-  return sum__(x, dim_n<Vector>::RET());
+  return sum__(x, typename dim_n<Vector>::RET());
 }
 
 #include "mtl/mtl_set.h"
@@ -151,7 +151,7 @@
 void
 scale_dim(Vector& x, const T& alpha, oned_tag)
 {
-  oned_scale(x, alpha, dim_n<Vector>::RET());
+  oned_scale(x, alpha, typename dim_n<Vector>::RET());
 }
 
 template <class Matrix, class T>
@@ -245,7 +245,7 @@
 inline typename linalg_traits<Vector>::magnitude_type
 one_norm(const Vector& x, oned_tag)
 {
-  return oned_one_norm(x, dim_n<Vector>::RET());
+  return oned_one_norm(x, typename dim_n<Vector>::RET());
 }
 
 
@@ -297,7 +297,7 @@
 inline typename linalg_traits<Vector>::magnitude_type
 two_norm(const Vector& x)
 {
-  return oned_two_norm(x, dim_n<Vector>::RET());
+  return oned_two_norm(x, typename dim_n<Vector>::RET());
 }
 
 //: add square
@@ -1539,7 +1539,7 @@
 {
   typename VecX::const_iterator xi = x.begin();
   for (; xi != x.end(); ++xi) {
-    mtl::add(mtl::scaled(A[xi.index()], *xi), y);
+    add(scaled(A[xi.index()], *xi), y);
   }
 }
   
@@ -1552,7 +1552,7 @@
 {
   typename Matrix::const_iterator Ai;
   for (Ai = A.begin(); Ai != A.end(); ++Ai) {
-    y[Ai.index()] = mtl::dot(*Ai, x); // this is a sparse dot
+    y[Ai.index()] = dot(*Ai, x); // this is a sparse dot
   }
 }
 
@@ -1580,9 +1580,9 @@
        instead
        */
     if (z.size() <= x.size())
-      mtl::add(z, x, z);
+      add(z, x, z);
     else
-      mtl::add(x, z, z);      
+      add(x, z, z);      
   }
 }
 
@@ -1672,7 +1672,7 @@
   MTL_THROW_ASSERTION
 {
   VecZ& z = const_cast<VecZ&>(z_);
-  mtl::copy(y, z);
+  copy(y, z);
   typedef typename matrix_traits<Matrix>::shape Shape;
   mult_shape__(A, x, z, Shape());
 }
@@ -1700,7 +1700,7 @@
 inline void
 mult_dim__(const Matrix& A, const VecX& x, VecY& y, oned_tag) MTL_THROW_ASSERTION
 {
-  mtl::mult(A, x, mtl::scaled(y, 0), y);
+  mult(A, x, scaled(y, 0), y);
 #if 0
   typedef typename matrix_traits<Matrix>::shape Shape;
   mult_shape__(A, x, y, Shape());
@@ -1782,7 +1782,7 @@
       scal = *Aij;
       jj = Aij.column();
       // add B[jj] and tmp1 into tmp2
-      add(mtl::scaled(B[jj], scal), tmp1, tmp2);
+      add(scaled(B[jj], scal), tmp1, tmp2);
       tmp1.clear();
       // swap tmp1 and tmp2
       tmp3 = tmp1; tmp1 = tmp2; tmp2 = tmp3;
@@ -1848,7 +1848,7 @@
       scal = *Bjk;
       kk = Bjk.row();
       // add A[kk] and tmp1 into tmp2
-      add(mtl::scaled(A[kk], scal), tmp1, tmp2);
+      add(scaled(A[kk], scal), tmp1, tmp2);
       tmp1.clear();
       // swap tmp1 and tmp2
       tmp3 = tmp1; tmp1 = tmp2; tmp2 = tmp3;
@@ -1987,7 +1987,7 @@
         C(i,j) += B(i,j);
   }
 
-  simple_mult(A, B, C, mtl::dense_tag(), Orien());
+  simple_mult(A, B, C, dense_tag(), Orien());
 }
 
 //: Dispatch to row/column general and banded matrices
@@ -2243,7 +2243,7 @@
 
   /* unoptimized version */
   for (int j = 0; j < B.ncols(); ++j)
-    mtl::tri_solve(T, columns(B)[j]);
+    tri_solve(T, columns(B)[j]);
 
 
   /* JGS need to do an optimized version of this
@@ -2445,7 +2445,7 @@
 oned_copy(const VecX& x, VecY& y, dense_tag, dense_tag) MTL_THROW_ASSERTION
 {
   MTL_ASSERT(x.size() <= y.size(), "mtl::copy()");
-  copy__(x, y, dim_n<VecX>::RET());
+  copy__(x, y, typename dim_n<VecX>::RET());
 }  
 
 #if 0
@@ -2478,7 +2478,7 @@
 oned_copy(const VecX& x, VecY& y, sparse_tag, dense_tag) MTL_THROW_ASSERTION
 {
   typedef typename linalg_traits<VecY>::value_type T;
-  mtl::set_value(y, T(0));
+  set_value(y, T(0));
   typename VecX::const_iterator xi;
   for (xi = x.begin(); xi != x.end(); ++xi)
     y[xi.index()] = *xi;
@@ -2713,7 +2713,7 @@
 {
   MTL_ASSERT(x.size() <= y.size(), "mtl::add()");
 
-  add__(x, y, dim_n<VecX>::RET());
+  add__(x, y, typename dim_n<VecX>::RET());
 }
 
 
@@ -2770,14 +2770,14 @@
     ++yi;
   }
   z_.clear();
-  mtl::copy(z, z_);
+  copy(z, z_);
 }
 
 template <class VecX, class VecY, class VecZ>
 inline void
 oned_add(const VecX& x, const VecY& y, VecZ& z, dense_tag) MTL_THROW_ASSERTION
 {
-  oned_add(x, y, z, dim_n<VecX>::RET());
+  oned_add(x, y, z, typename dim_n<VecX>::RET());
 }
 
 
@@ -3003,7 +3003,7 @@
   MTL_ASSERT(x.size() <= y.size(), "mtl::ele_mult()");
   MTL_ASSERT(x.size() <= z.size(), "mtl::ele_mult()");
 
-  ele_mult(x, y, z, dim_n<VecX>::RET());
+  ele_mult(x, y, z, typename dim_n<VecX>::RET());
 }
 
 
@@ -3080,7 +3080,7 @@
 swap(VecX& x, VecY& y, oned_tag) MTL_THROW_ASSERTION
 {
   MTL_ASSERT(x.size() <= y.size(), "mtl::swap()");
-  swap(x, y, dim_n<VecX>::RET());
+  swap(x, y, typename dim_n<VecX>::RET());
 }  
 
 
@@ -3153,7 +3153,7 @@
 inline T
 dot(const VecX& x, const VecY& y, T s, dense_tag, dense_tag)
 {
-  return dot(x, y, s, dim_n<VecX>::RET());
+  return dot(x, y, s, typename dim_n<VecX>::RET());
 }
 
 template <class InputIterator1, class InputIterator2, class T>
@@ -3246,7 +3246,7 @@
 dot(const VecX& x, const VecY& y) MTL_THROW_ASSERTION
 {
   typedef typename VecX::value_type T;
-  return mtl::dot(x, y, T(0));
+  return dot(x, y, T(0));
 }
 
 #ifdef USE_DOUBLE_DOUBLE
@@ -3305,7 +3305,7 @@
 dot_conj(const VecX& x, const VecY& y, T s) MTL_THROW_ASSERTION
 {
   MTL_ASSERT(x.size() <= y.size(), "mtl::dot_conj()");
-  return dot_conj(x, y, s, dim_n<VecX>::RET());
+  return dot_conj(x, y, s, typename dim_n<VecX>::RET());
 }
 
 //: Dot Conjugate:   <tt>s <- x . conj(y)</tt>
@@ -3319,7 +3319,7 @@
 dot_conj(const VecX& x, const VecY& y) MTL_THROW_ASSERTION
 {
   typedef typename VecX::value_type T;
-  return mtl::dot_conj(x, y, T(0));
+  return dot_conj(x, y, T(0));
 }
 
 
diff -Nur mtl-2.1.2-21/mtl/mtl_set.h mtl-2.1.2-21mod/mtl/mtl_set.h
--- mtl-2.1.2-21/mtl/mtl_set.h	2002-07-06 17:48:35.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/mtl_set.h	2005-01-11 10:16:48.000000000 +0100
@@ -28,7 +28,7 @@
 void
 set__(Vector x, const T& alpha, oned_tag)
 {
-  oned_set(x, alpha, dim_n<Vector>::RET());
+  oned_set(x, alpha, typename dim_n<Vector>::RET());
 }
 
 
@@ -59,7 +59,7 @@
 void
 set__(Matrix A, const T& alpha, twod_tag)
 {
-  set__(A, alpha, dim_m<Matrix>::RET());
+  set__(A, alpha, typename dim_m<Matrix>::RET());
 }
 
 
diff -Nur mtl-2.1.2-21/mtl/reverse_iter.h mtl-2.1.2-21mod/mtl/reverse_iter.h
--- mtl-2.1.2-21/mtl/reverse_iter.h	2002-07-06 17:48:36.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/reverse_iter.h	2005-01-11 10:16:48.000000000 +0100
@@ -68,15 +68,15 @@
   reverse_iter(Iter x) : super(x) {}
 
   inline difference_type index() const {
-    Iter tmp = current;
+    Iter tmp = this->current;
     return (--tmp).index(); 
   }
   inline difference_type row() const {
-    Iter tmp = current;
+    Iter tmp = this->current;
     return (--tmp).row(); 
   }
   inline difference_type column() const {
-    Iter tmp = current;
+    Iter tmp = this->current;
     return (--tmp).column(); 
   }
 
diff -Nur mtl-2.1.2-21/mtl/transform_iterator.h mtl-2.1.2-21mod/mtl/transform_iterator.h
--- mtl-2.1.2-21/mtl/transform_iterator.h	2002-07-06 17:48:36.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/transform_iterator.h	2005-01-11 10:16:48.000000000 +0100
@@ -264,24 +264,24 @@
   inline general_stride_iterator(RandomAccessIterator i, StrideGen s) 
     : super(*this, i), stride_gen(s) { }
   inline self& operator++() {
-    stride_gen.inc(iter);
+    stride_gen.inc(this->iter);
     return *this; 
   }
   inline self& operator--() { 
-    stride_gen.dec(iter);
+    stride_gen.dec(this->iter);
     return *this; 
   }
   inline self& operator+=(Distance n) { 
-    stride_gen.advance(iter, n);
+    stride_gen.advance(this->iter, n);
     return *this; 
   }
   inline self& operator-=(Distance n) {
-    stride_gen.advance(iter, -n);
+    stride_gen.advance(this->iter, -n);
     return *this; 
   }
 
   inline Distance diff(const self& y) const {
-    return stride_gen.diff(iter, y.iter, y.stride_gen);
+    return stride_gen.diff(this->iter, y.iter, y.stride_gen);
   }
 
   inline friend Distance operator-(const self& x, const self& y) {
diff -Nur mtl-2.1.2-21/mtl/utils.h mtl-2.1.2-21mod/mtl/utils.h
--- mtl-2.1.2-21/mtl/utils.h	2002-07-06 17:48:36.000000000 +0200
+++ mtl-2.1.2-21mod/mtl/utils.h	2005-01-11 10:16:48.000000000 +0100
@@ -50,7 +50,7 @@
 {
   for (typename Vector::iterator i = x.begin();
        i != x.end(); ++i) {
-    mtl::print_vector(*i);
+    print_vector(*i);
   }
 }
 
@@ -63,7 +63,7 @@
   Int i,j;
   for (i=0; i < A.nrows(); ++i) {
     for (j=0; j < A.ncols(); ++j)
-      mtl::print_all_matrix( A(i,j) );
+      print_all_matrix( A(i,j) );
     std::cout << std::endl;
   }
 }
@@ -80,7 +80,7 @@
     A_i = (*A_kk).begin();
     A_iend = (*A_kk).end();
     while (not_at(A_i, A_iend)) {
-      mtl::print_all_matrix( *A_i );
+      print_all_matrix( *A_i );
       ++A_i;
     }
     ++A_kk;
@@ -99,7 +99,7 @@
     A_i = (*A_kk).begin();
     A_iend = (*A_kk).end();
     while (not_at(A_i, A_iend)) {
-      mtl::print_all_matrix( *A_i );
+      print_all_matrix( *A_i );
       ++A_i;
     }
     ++A_kk;
mtl.spec (text/plain, 1.1 KB)
Prefix: /usr
Name: mtl
Summary: Matrix Template Library
Version: 2.1.2.21
Release: 5
Source0: mtl-2.1.2-21.tar.gz
Source1: mtl_reference.tar.gz
Patch0: mtl-gcc34.patch
Group: Development
BuildRoot: /var/tmp/%{name}-buildroot
Copyright: Artistic
BuildArch: noarch
Requires: blas, lapack

%description
MTL is a template-based library for linear algebra

%prep
rm -rf $RPM_BUILD_ROOT



%setup -q -T -D -b 1 -n mtl_reference
%setup -q -n mtl-2.1.2-21
%patch0 -p1

%build
./configure --prefix=$RPM_BUILD_ROOT%{prefix} --enable-exceptions --with-lapack

%install
make install DESTDIR=$RPM_BUILD_ROOT

cd $RPM_BUILD_ROOT
find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > \
	$RPM_BUILD_DIR/file.list.%{name}

find . -type f | sed -e 's,^\.,\%attr(-\,root\,root) ,' \
	-e '/\/config\//s|^|%config|' >> \
	$RPM_BUILD_DIR/file.list.%{name}

find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> \
	$RPM_BUILD_DIR/file.list.%{name}

#echo "%docdir %{prefix}/doc/kde" >> $RPM_BUILD_DIR/file.list.%{name}


%clean
rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/file.list.%{name}

%files -f ../file.list.%{name}
%doc $RPM_BUILD_DIR/mtl_reference
%doc LICENSE
%doc contrib/examples