gcc-3.4.4 and mtl.h from distribution mtl-2.1.2-22
"Valery Khamenya" <[email protected]> Mon, 8 May 2006 17:06:36 +0200
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi instantiation under gcc-3.4.4 doesn't seem to work for several template functions from mtl.h of distribution mtl-2.1.2-22 . The corresponding patch is attached. P.S. it would be much more convenient to send bugfix without being obliged to subscribe to maillist. Best regards -- Valery A.Khamenya _______________________________________________ This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
mtl.h.patch
(text/x-patch, 3.7 KB)
--- mtl.h 2005-07-05 17:11:49.000000000 +0200
+++ mtl-patched.h 2006-05-08 15:47:13.615935667 +0200
@@ -102,7 +102,12 @@
typename linalg_traits<Vector>::value_type
sum(const Vector& x)
{
- return sum__(x, dim_n<Vector>::RET());
+ // NOTE: manually modified
+ // due to g++ 3.4.4 compile errors
+
+ // return sum__(x, dim_n<Vector>::RET());
+ typedef typename dim_n<Vector>::RET R;
+ return sum__(x, R());
}
#include "mtl/mtl_set.h"
@@ -139,7 +144,12 @@
void
scale_dim(Vector& x, const T& alpha, oned_tag)
{
- oned_scale(x, alpha, dim_n<Vector>::RET());
+ // NOTE: manually modified
+ // due to g++ 3.4.4 compile errors
+
+ // oned_scale(x, alpha, dim_n<Vector>::RET());
+ typedef typename dim_n<Vector>::RET R;
+ oned_scale(x, alpha, R());
}
template <class Matrix, class T>
@@ -233,7 +243,12 @@
inline typename linalg_traits<Vector>::magnitude_type
one_norm(const Vector& x, oned_tag)
{
- return oned_one_norm(x, dim_n<Vector>::RET());
+ // NOTE: manually modified
+ // due to g++ 3.4.4 compile errors
+
+ //return oned_one_norm(x, dim_n<Vector>::RET());
+ typedef typename dim_n<Vector>::RET R;
+ return oned_one_norm(x, R());
}
@@ -285,7 +300,12 @@
inline typename linalg_traits<Vector>::magnitude_type
two_norm(const Vector& x)
{
- return oned_two_norm(x, dim_n<Vector>::RET());
+ // NOTE: manually modified
+ // due to g++ 3.4.4 compile errors
+
+ //return oned_two_norm(x, dim_n<Vector>::RET());
+ typedef typename dim_n<Vector>::RET R;
+ return oned_two_norm(x, R());
}
//: add square
@@ -2432,9 +2452,11 @@
inline void
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()); gcc4
copy__(x, y, typename dim_n<VecX>::RET());
+
}
#if 0
@@ -2702,7 +2724,10 @@
{
MTL_ASSERT(x.size() <= y.size(), "mtl::add()");
- add__(x, y, dim_n<VecX>::RET());
+ // changed due to g++ 3.4.4 compile errors
+ // add__(x, y, dim_n<VecX>::RET());
+ typedef typename dim_n<VecX>::RET R;
+ add__(x, y, R());
}
@@ -2989,11 +3014,16 @@
inline void
ele_mult(const VecX& x, const VecY& y, MTL_OUT(VecZ) z_) MTL_THROW_ASSERTION
{
+
+ // modifed due to g++ 3.4.4 comiler errors
+
VecZ& z = const_cast<VecZ&>(z_);
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, dim_n<VecX>::RET());
+ typedef typename dim_n<VecX>::RET R;
+ ele_mult(x, y, z, R());
}
@@ -3069,8 +3099,12 @@
inline void
swap(VecX& x, VecY& y, oned_tag) MTL_THROW_ASSERTION
{
+ // modifed due to g++ 3.4.4 compile errors
+
MTL_ASSERT(x.size() <= y.size(), "mtl::swap()");
- swap(x, y, dim_n<VecX>::RET());
+ // swap(x, y, dim_n<VecX>::RET());
+ typedef typename dim_n<VecX>::RET R;
+ swap(x, y, R());
}
@@ -3143,7 +3177,13 @@
inline T
dot(const VecX& x, const VecY& y, T s, dense_tag, dense_tag)
{
- return dot(x, y, s, dim_n<VecX>::RET());
+ // NOTE: manually modified
+ // due to g++ 3.4.4 compile errors
+
+ //return dot(x, y, s, dim_n<VecX>::RET());
+
+ typedef typename mtl::dim_n<VecX>::RET R;
+ return dot(x, y, s, R());
}
template <class InputIterator1, class InputIterator2, class T>
@@ -3294,8 +3334,14 @@
inline T
dot_conj(const VecX& x, const VecY& y, T s) MTL_THROW_ASSERTION
{
+ // NOTE: manually modified
+ // due to g++ 3.4.4 compile errors
+
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, dim_n<VecX>::RET());
+ typedef typename mtl::dim_n<VecX>::RET R;
+ return dot_conj(x, y, s, R());
}
//: Dot Conjugate: <tt>s <- x . conj(y)</tt>