[med-svn] [SCM] mia branch, master, updated. upstream/2.0.7-64-gb612b58
Gert Wollny
gw.fossdev at gmail.com
Wed Feb 27 10:38:43 UTC 2013
The following commit has been merged in the master branch:
commit 0e091d35feec696577c06675a769c608be54a87e
Author: Gert Wollny <gw.fossdev at gmail.com>
Date: Tue Feb 26 17:10:18 2013 +0100
correct the index type in the tests to avoid ambiguous function warning
diff --git a/gsl++/test_multimin.cc b/gsl++/test_multimin.cc
index 1077ba0..674ff47 100644
--- a/gsl++/test_multimin.cc
+++ b/gsl++/test_multimin.cc
@@ -48,12 +48,15 @@ BOOST_AUTO_TEST_CASE(test_cfdf_multmin )
CFDFMinimizer minimizer(CFDFMinimizer::PProblem(new TestCFDFProblem), gsl_multimin_fdfminimizer_conjugate_fr );
DoubleVector x(2, false);
- x[0] = 5.0;
- x[1] = 7.0;
+ const size_t i0 = 0;
+ const size_t i1 = 1;
+
+ x[i0] = 5.0;
+ x[i1] = 7.0;
BOOST_REQUIRE(minimizer.run(x)== GSL_SUCCESS);
- BOOST_CHECK_CLOSE(x[0], 1.0, 0.1);
- BOOST_CHECK_CLOSE(x[1], 2.0, 0.1);
+ BOOST_CHECK_CLOSE(x[i0], 1.0, 0.1);
+ BOOST_CHECK_CLOSE(x[i1], 2.0, 0.1);
}
TestCFDFProblem::TestCFDFProblem():
@@ -68,8 +71,11 @@ TestCFDFProblem::TestCFDFProblem():
double TestCFDFProblem::do_f(const DoubleVector& v)
{
- const double x = v[0];
- const double y = v[1];
+ const size_t i0 = 0;
+ const size_t i1 = 1;
+
+ const double x = v[i0];
+ const double y = v[i1];
return m_p[2] * (x - m_p[0]) * (x - m_p[0]) +
m_p[3] * (y - m_p[1]) * (y - m_p[1]) + m_p[4];
@@ -78,11 +84,14 @@ double TestCFDFProblem::do_f(const DoubleVector& v)
void TestCFDFProblem::do_df(const DoubleVector& v, DoubleVector& g)
{
- const double x = v[0];
- const double y = v[1];
+ const size_t i0 = 0;
+ const size_t i1 = 1;
+
+ const double x = v[i0];
+ const double y = v[i1];
- g[0] = 2.0 * m_p[2] * (x - m_p[0]);
- g[1] = 2.0 * m_p[3] * (y - m_p[1]);
+ g[i0] = 2.0 * m_p[2] * (x - m_p[0]);
+ g[i1] = 2.0 * m_p[3] * (y - m_p[1]);
}
double TestCFDFProblem::do_fdf(const DoubleVector& x, DoubleVector& g)
@@ -105,13 +114,16 @@ BOOST_AUTO_TEST_CASE(test_cf_multmin )
{
CFMinimizer minimizer(CFMinimizer::PProblem(new TestCFProblem), gsl_multimin_fminimizer_nmsimplex );
+ const size_t i0 = 0;
+ const size_t i1 = 1;
+
DoubleVector x(2, false);
- x[0] = 5.0;
- x[1] = 7.0;
+ x[i0] = 5.0;
+ x[i1] = 7.0;
BOOST_REQUIRE(minimizer.run(x)== GSL_SUCCESS);
- BOOST_CHECK_CLOSE(x[0], 1.0, 1);
- BOOST_CHECK_CLOSE(x[1], 2.0, 1);
+ BOOST_CHECK_CLOSE(x[i0], 1.0, 1);
+ BOOST_CHECK_CLOSE(x[i1], 2.0, 1);
}
@@ -126,8 +138,11 @@ TestCFProblem::TestCFProblem():
double TestCFProblem::do_f(const DoubleVector& v)
{
- const double x = v[0];
- const double y = v[1];
+ const size_t i0 = 0;
+ const size_t i1 = 1;
+
+ const double x = v[i0];
+ const double y = v[i1];
return m_p[2] * (x - m_p[0]) * (x - m_p[0]) +
m_p[3] * (y - m_p[1]) * (y - m_p[1]) + m_p[4];
diff --git a/gsl++/test_vector.cc b/gsl++/test_vector.cc
index 2fd34da..7ca16db 100644
--- a/gsl++/test_vector.cc
+++ b/gsl++/test_vector.cc
@@ -126,8 +126,10 @@ BOOST_AUTO_TEST_CASE( test_vector_non_owning )
{
gsl_vector *x = gsl_vector_calloc(10);
DoubleVector wx(x);
+
+ const size_t i2 = 2;
- wx[2] = 2.0;
+ wx[i2] = 2.0;
BOOST_CHECK_EQUAL(gsl_vector_get(x,2), 2.0);
@@ -140,16 +142,17 @@ BOOST_AUTO_TEST_CASE( test_vector_copy )
DoubleVector wx(10, false);
DoubleVector wy(5, false);
- wx[2] = 3.0;
- BOOST_CHECK_EQUAL(wx[2], 3.0);
+ const size_t i2 = 2;
+ wx[i2] = 3.0;
+ BOOST_CHECK_EQUAL(wx[i2], 3.0);
- wy[2] = 2.0;
- BOOST_CHECK_EQUAL(wy[2], 2.0);
+ wy[i2] = 2.0;
+ BOOST_CHECK_EQUAL(wy[i2], 2.0);
BOOST_CHECK_EQUAL(wx.size(), 10u);
wx = wy;
BOOST_CHECK_EQUAL(wx.size(), 5u);
- BOOST_CHECK_EQUAL(wx[2], 2.0);
+ BOOST_CHECK_EQUAL(wx[i2], 2.0);
}
diff --git a/gsl++/vector_template.hh b/gsl++/vector_template.hh
index 4e5015d..9de0bbe 100644
--- a/gsl++/vector_template.hh
+++ b/gsl++/vector_template.hh
@@ -133,7 +133,7 @@ protected:
a compatibility layer to make it possible to use STL algorithms and constructs.
*/
template <typename T>
-class TVector : public gsl_vector_dispatch<T> {
+class TVector : gsl_vector_dispatch<T> {
public:
typedef typename gsl_vector_dispatch<T>::iterator iterator;
typedef typename gsl_vector_dispatch<T>::const_iterator const_iterator;
--
Packaging of mia in Debian
More information about the debian-med-commit
mailing list