Brian Silverman | 7c33ab2 | 2018-08-04 17:14:51 -0700 | [diff] [blame^] | 1 | //============================================================================== |
| 2 | // Copyright 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI |
| 3 | // Copyright 2014 NumScale SAS |
| 4 | // |
| 5 | // Distributed under the Boost Software License, Version 1.0. |
| 6 | // See accompanying file LICENSE.txt or copy at |
| 7 | // http://www.boost.org/LICENSE_1_0.txt |
| 8 | //============================================================================== |
| 9 | #include <boost/numeric/odeint.hpp> |
| 10 | #include <nt2/table.hpp> |
| 11 | #include <nt2/include/functions/zeros.hpp> |
| 12 | #include <nt2/include/functions/ones.hpp> |
| 13 | |
| 14 | #include <boost/config.hpp> |
| 15 | #ifdef BOOST_MSVC |
| 16 | #pragma warning(disable:4996) |
| 17 | #endif |
| 18 | |
| 19 | #define BOOST_TEST_MODULE odeint_nt2_copy |
| 20 | |
| 21 | #include <boost/test/included/unit_test.hpp> |
| 22 | #include <boost/test/floating_point_comparison.hpp> |
| 23 | #include <boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp> |
| 24 | |
| 25 | #include <boost/mpl/list.hpp> |
| 26 | |
| 27 | using namespace boost::unit_test; |
| 28 | using namespace boost::numeric::odeint; |
| 29 | |
| 30 | typedef boost::mpl::list< float , double > fp_types; |
| 31 | |
| 32 | BOOST_AUTO_TEST_SUITE( nt2_norm_inf ) |
| 33 | |
| 34 | BOOST_AUTO_TEST_CASE_TEMPLATE( test_norm_inf, T, fp_types ) |
| 35 | { |
| 36 | nt2::table<T> x = nt2::ones(10,1, nt2::meta::as_<T>() ); |
| 37 | x(4) = 55; |
| 38 | |
| 39 | nt2::table<T> y = nt2::zeros(8,8, nt2::meta::as_<T>() ); |
| 40 | y(6,4) = -42; |
| 41 | |
| 42 | BOOST_CHECK_SMALL(vector_space_norm_inf<nt2::table<T> >()(x) - T(55), T(1e-10)); |
| 43 | BOOST_CHECK_SMALL(vector_space_norm_inf<nt2::table<T> >()(y) - T(42), T(1e-10)); |
| 44 | } |
| 45 | |
| 46 | BOOST_AUTO_TEST_SUITE_END() |