Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68348 - in sandbox/odeint/branches/karsten: . boost/numeric/odeint/algebra libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2011-01-21 08:14:22


Author: karsten
Date: 2011-01-21 08:14:20 EST (Fri, 21 Jan 2011)
New Revision: 68348
URL: http://svn.boost.org/trac/boost/changeset/68348

Log:
* algebra unit test included
Added:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_algebra.cpp (contents, props changed)
Text files modified:
   sandbox/odeint/branches/karsten/.cproject | 73 ++++++++++++++++++++++-----------------
   sandbox/odeint/branches/karsten/.project | 2
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp | 29 +++++++++++----
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile | 1
   4 files changed, 64 insertions(+), 41 deletions(-)

Modified: sandbox/odeint/branches/karsten/.cproject
==============================================================================
--- sandbox/odeint/branches/karsten/.cproject (original)
+++ sandbox/odeint/branches/karsten/.cproject 2011-01-21 08:14:20 EST (Fri, 21 Jan 2011)
@@ -5,36 +5,44 @@
         <storageModule moduleId="org.eclipse.cdt.core.settings">
                 <cconfiguration id="0.1427786045">
                         <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1427786045" moduleId="org.eclipse.cdt.core.settings" name="Default">
- <externalSettings/>
- <extensions>
- <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
- <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
- <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
- <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
- <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
- <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
- </extensions>
- </storageModule>
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
                         <storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration buildProperties="" description="" id="0.1427786045" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
- <folderInfo id="0.1427786045." name="/" resourcePath="">
- <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1701227309" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
- <targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1701227309.1923743366" name=""/>
- <builder cleanBuildTarget="--clean" command="bjam" id="org.eclipse.cdt.build.core.settings.default.builder.1866451942" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
- <tool id="org.eclipse.cdt.build.core.settings.holder.libs.295828857" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
- <tool id="org.eclipse.cdt.build.core.settings.holder.1728088817" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
- <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1379843062" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
- </tool>
- <tool id="org.eclipse.cdt.build.core.settings.holder.780742962" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
- <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.157834134" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
- </tool>
- <tool id="org.eclipse.cdt.build.core.settings.holder.421502995" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
- <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1344941182" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
- </tool>
- </toolChain>
- </folderInfo>
- </configuration>
- </storageModule>
+<configuration buildProperties="" description="" id="0.1427786045" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+<folderInfo id="0.1427786045." name="/" resourcePath="">
+<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1701227309" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1701227309.1923743366" name=""/>
+<builder cleanBuildTarget="--clean" command="bjam" id="org.eclipse.cdt.build.core.settings.default.builder.1866451942" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+<tool id="org.eclipse.cdt.build.core.settings.holder.libs.295828857" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+<tool id="org.eclipse.cdt.build.core.settings.holder.1728088817" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.558519945" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+<listOptionValue builtIn="false" value="&quot;${BOOST_ROOT}&quot;"/>
+</option>
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1379843062" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+<tool id="org.eclipse.cdt.build.core.settings.holder.780742962" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1009256344" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+<listOptionValue builtIn="false" value="&quot;${BOOST_ROOT}&quot;"/>
+</option>
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.157834134" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+<tool id="org.eclipse.cdt.build.core.settings.holder.421502995" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.388283580" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+<listOptionValue builtIn="false" value="&quot;${BOOST_ROOT}&quot;"/>
+</option>
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1344941182" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
                         <storageModule moduleId="scannerConfiguration">
                                 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
                                 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
@@ -535,9 +543,10 @@
                         </storageModule>
                         <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
                         <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
- </cconfiguration>
+ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+</cconfiguration>
         </storageModule>
         <storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <project id="odeint.null.1351650296" name="odeint"/>
- </storageModule>
+<project id="odeint.null.1351650296" name="odeint"/>
+</storageModule>
 </cproject>

Modified: sandbox/odeint/branches/karsten/.project
==============================================================================
--- sandbox/odeint/branches/karsten/.project (original)
+++ sandbox/odeint/branches/karsten/.project 2011-01-21 08:14:20 EST (Fri, 21 Jan 2011)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
- <name>odeint_new</name>
+ <name>karsten</name>
         <comment></comment>
         <projects>
                 <project>boost</project>

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp 2011-01-21 08:14:20 EST (Fri, 21 Jan 2011)
@@ -26,8 +26,21 @@
  */
 struct standard_operations
 {
+ template< class Fac1 = double >
+ struct scale_sum1
+ {
+ const Fac1 m_alpha1;
+
+ scale_sum1( const Fac1 &alpha1 ) : m_alpha1( alpha1 ) { }
+
+ template< class T1 , class T2 >
+ void operator()( T1 &t1 , const T2 &t2 )
+ {
+ t1 = m_alpha1 * t2;
+ }
+ };
 
- template< class Fac1 , class Fac2 >
+ template< class Fac1 = double , class Fac2 = Fac1 >
         struct scale_sum2
         {
                 const Fac1 m_alpha1;
@@ -43,7 +56,7 @@
         };
 
 
- template< class Fac1 , class Fac2 , class Fac3 >
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 >
         struct scale_sum3
         {
                 const Fac1 m_alpha1;
@@ -61,7 +74,7 @@
         };
 
 
- template< class Fac1 , class Fac2 , class Fac3 , class Fac4 >
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac1 , class Fac4 = Fac1 >
         struct scale_sum4
         {
                 const Fac1 m_alpha1;
@@ -80,7 +93,7 @@
         };
 
 
- template< class Fac1 , class Fac2 , class Fac3 , class Fac4 , class Fac5 >
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac1 , class Fac4 = Fac1 , class Fac5 = Fac1 >
         struct scale_sum5
         {
                 const Fac1 m_alpha1;
@@ -100,7 +113,7 @@
         };
 
 
- template< class Fac1 , class Fac2 , class Fac3 , class Fac4 , class Fac5 , class Fac6 >
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac1 , class Fac4 = Fac1 , class Fac5 = Fac1 , class Fac6 = Fac1 >
         struct scale_sum6
         {
                 const Fac1 m_alpha1;
@@ -121,7 +134,7 @@
         };
 
 
- template< class Fac1 , class Fac2 , class Fac3 , class Fac4 , class Fac5 , class Fac6 , class Fac7 >
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac1 , class Fac4 = Fac1 , class Fac5 = Fac1 , class Fac6 = Fac1 , class Fac7 = Fac1 >
         struct scale_sum7
         {
                 const Fac1 m_alpha1;
@@ -157,7 +170,7 @@
          *
          * ToDo : check if T1, T2, T3 are units and if so convert them to normal floats
          */
- template< class Fac1 >
+ template< class Fac1 = double >
         struct rel_error
         {
                 const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
@@ -180,7 +193,7 @@
          *
          * ToDo : check if T1, T2 are units and if so convert them to normal floats
          */
- template< class Fac1 >
+ template< class Fac1 = double >
         struct maximum
         {
                 template< class T1 , class T2 >

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile 2011-01-21 08:14:20 EST (Fri, 21 Jan 2011)
@@ -20,6 +20,7 @@
         : check_stepper_concepts.cpp
           check_resize.cpp
           check_operations.cpp
+ check_algebra.cpp
           check_implicit_euler.cpp
           check_dense_output_explicit_euler.cpp
           check_dense_output_dopri5.cpp

Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_algebra.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_algebra.cpp 2011-01-21 08:14:20 EST (Fri, 21 Jan 2011)
@@ -0,0 +1,99 @@
+/*
+ * check_operations.cpp
+ *
+ * Created on: Jan 20, 2011
+ * Author: karsten
+ */
+
+#include <cmath>
+#include <complex>
+#include <utility>
+#include <tr1/array>
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include <boost/range.hpp>
+
+#include <boost/numeric/odeint/algebra/standard_operations.hpp>
+#include <boost/numeric/odeint/algebra/standard_algebra.hpp>
+
+using boost::numeric::odeint::standard_operations;
+using boost::numeric::odeint::standard_algebra;
+
+
+
+BOOST_AUTO_TEST_SUITE( standard_algebra_test )
+
+BOOST_AUTO_TEST_CASE( test_for_each2 )
+{
+ std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }};
+ standard_algebra::for_each2( x1 , x2 , standard_operations::scale_sum1<>( 1.0 ) );
+ BOOST_CHECK_CLOSE( x1[0] , 2.0 , 1.0e-10 );
+ BOOST_CHECK_CLOSE( x1[1] , 2.0 , 1.0e-10 );
+}
+
+BOOST_AUTO_TEST_CASE( test_for_each3 )
+{
+ std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }};
+ standard_algebra::for_each3( x1 , x2 , x3 , standard_operations::scale_sum2<>( 1.0 , 2.0 ) );
+ BOOST_CHECK_CLOSE( x1[0] , 8.0 , 1.0e-10 );
+ BOOST_CHECK_CLOSE( x1[1] , 8.0 , 1.0e-10 );
+}
+
+BOOST_AUTO_TEST_CASE( test_for_each4 )
+{
+ std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }};
+ standard_algebra::for_each4( x1 , x2 , x3 , x4 , standard_operations::scale_sum3<>( 1.0 , 2.0 , 3.0 ) );
+ BOOST_CHECK_CLOSE( x1[0] , 20.0 , 1.0e-10 );
+ BOOST_CHECK_CLOSE( x1[1] , 20.0 , 1.0e-10 );
+}
+
+BOOST_AUTO_TEST_CASE( test_for_each5 )
+{
+ std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }};
+ standard_algebra::for_each5( x1 , x2 , x3 , x4 , x5 , standard_operations::scale_sum4<>( 1.0 , 2.0 , 3.0 , 4.0 ) );
+ BOOST_CHECK_CLOSE( x1[0] , 40.0 , 1.0e-10 );
+ BOOST_CHECK_CLOSE( x1[1] , 40.0 , 1.0e-10 );
+}
+
+BOOST_AUTO_TEST_CASE( test_for_each6 )
+{
+ std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }} , x6 = {{ 6.0 , 6.0 }};
+ standard_algebra::for_each6( x1 , x2 , x3 , x4 , x5 , x6 ,standard_operations::scale_sum5<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 ) );
+ BOOST_CHECK_CLOSE( x1[0] , 70.0 , 1.0e-10 );
+ BOOST_CHECK_CLOSE( x1[1] , 70.0 , 1.0e-10 );
+}
+
+BOOST_AUTO_TEST_CASE( test_for_each7 )
+{
+ std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }} , x6 = {{ 6.0 , 6.0 }} , x7 = {{ 7.0 , 7.0 }};
+ standard_algebra::for_each7( x1 , x2 , x3 , x4 , x5 , x6 , x7 , standard_operations::scale_sum6<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ) );
+ BOOST_CHECK_CLOSE( x1[0] , 112.0 , 1.0e-10 );
+ BOOST_CHECK_CLOSE( x1[1] , 112.0 , 1.0e-10 );
+}
+
+BOOST_AUTO_TEST_CASE( test_for_each8 )
+{
+ std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }} , x6 = {{ 6.0 , 6.0 }} , x7 = {{ 7.0 , 7.0 }} , x8 = {{ 8.0 , 8.0 }};
+ standard_algebra::for_each8( x1 , x2 , x3 , x4 , x5 , x6 , x7 , x8 , standard_operations::scale_sum7<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 ) );
+ BOOST_CHECK_CLOSE( x1[0] , 168.0 , 1.0e-10 );
+ BOOST_CHECK_CLOSE( x1[1] , 168.0 , 1.0e-10 );
+}
+
+
+BOOST_AUTO_TEST_CASE( test_for_each2_with_range )
+{
+// std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }};
+// std::tr1::array< double , 4 > x2 = {{ 2.0 , 3.0 , 4.0 , 5.0 }};
+// standard_algebra::for_each2( x1 , std::make_pair( x2.begin() + 1 , x2.begin() + 3 ) , standard_operations::scale_sum1<>( 1.0 ) );
+// BOOST_CHECK_CLOSE( x1[0] , 3.0 , 1.0e-10 );
+// BOOST_CHECK_CLOSE( x1[1] , 4.0 , 1.0e-10 );
+}
+
+
+
+
+
+
+BOOST_AUTO_TEST_SUITE_END()


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk