mirror of
https://github.com/boostorg/odeint.git
synced 2025-05-09 23:24:01 +00:00
nt2_norm_inf defines the infinity norm of a multi-dimensional matrix in the same manner as eigen - that is the largest absolute value
This commit is contained in:
parent
9d0fc0a1b8
commit
31ed4aadde
@ -10,7 +10,8 @@
|
||||
#define BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_NORM_INF_HPP_INCLUDED
|
||||
|
||||
#include <nt2/core/container/table/table.hpp>
|
||||
#include <nt2/include/functions/mnorminf.hpp>
|
||||
#include <nt2/include/functions/globalmax.hpp>
|
||||
#include <nt2/include/functions/abs.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
|
||||
|
||||
@ -22,7 +23,7 @@ namespace boost { namespace numeric { namespace odeint
|
||||
typedef T result_type;
|
||||
result_type operator()(const nt2::container::table<T,S> &v1) const
|
||||
{
|
||||
return mnorminf(v1);
|
||||
return nt2::globalmax(nt2::abs(v1));
|
||||
}
|
||||
};
|
||||
} } }
|
||||
|
@ -39,12 +39,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( test_norm_inf, T, fp_types )
|
||||
nt2::table<T> y = nt2::zeros(8,8, nt2::meta::as_<T>() );
|
||||
y(6,4) = -42;
|
||||
|
||||
nt2::table<T> z = nt2::ones(1,10, nt2::meta::as_<T>() );
|
||||
z(4) = 55;
|
||||
|
||||
BOOST_CHECK_SMALL(vector_space_norm_inf<nt2::table<T> >()(x) - T(55), T(1e-10));
|
||||
BOOST_CHECK_SMALL(vector_space_norm_inf<nt2::table<T> >()(y) - T(42), T(1e-10));
|
||||
BOOST_CHECK_SMALL(vector_space_norm_inf<nt2::table<T> >()(z) - T(64), T(1e-10));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
x
Reference in New Issue
Block a user