Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51257 - in sandbox/itl: boost/itl boost/itl/type_traits libs/itl/example/splititvmap_shell libs/itl/test libs/itl/test/test_interval_map_mixed libs/itl/test/test_interval_set_mixed libs/itl/test/test_itl_interval libs/validate/example/labat_single
From: afojgo_at_[hidden]
Date: 2009-02-15 05:13:41


Author: jofaber
Date: 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
New Revision: 51257
URL: http://svn.boost.org/trac/boost/changeset/51257

Log:
Refactored. More efficient implementation of protonic equality. Diverse clean ups. Stable {msvc-9.0, partly congcc-4.3-a7}

Text files modified:
   sandbox/itl/boost/itl/map.hpp | 14 ++------------
   sandbox/itl/boost/itl/map_algo.hpp | 6 ++----
   sandbox/itl/boost/itl/set_algo.hpp | 1 -
   sandbox/itl/boost/itl/type_traits/neutron.hpp | 2 +-
   sandbox/itl/libs/itl/example/splititvmap_shell/splititvmap_shell.cpp | 17 +----------------
   sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp | 14 --------------
   sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 5 +----
   sandbox/itl/libs/itl/test/test_interval_set_mixed/test_interval_set_mixed.cpp | 8 --------
   sandbox/itl/libs/itl/test/test_interval_set_shared.hpp | 4 ----
   sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp | 2 --
   sandbox/itl/libs/validate/example/labat_single/labat_single.cpp | 12 ++++++++++--
   11 files changed, 17 insertions(+), 68 deletions(-)

Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -583,17 +583,7 @@
 inline bool is_protonic_equal (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
                                const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
 {
- //return Map::lexicographical_protonic_equal(lhs, rhs);
-
- //JODO: Efficient implementation.
- typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
-
- itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> lhs0 = lhs;
- itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> rhs0 = rhs;
- lhs0.absorb_neutrons();
- rhs0.absorb_neutrons();
- return operator==((const base_type&)lhs0, (const base_type&)rhs0);
-
+ return Map::lexicographical_protonic_equal(lhs, rhs);
 }
 
 /** Strict weak less ordering which is given by the Compare order */
@@ -769,7 +759,7 @@
 inline itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>&
 operator &= ( itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& object,
     const typename itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>::set_type& operand)
-{ Map::intersect(object, operand); return object; } //JODO TEST
+{ Map::intersect(object, operand); return object; }
 
 
 template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>

Modified: sandbox/itl/boost/itl/map_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/map_algo.hpp (original)
+++ sandbox/itl/boost/itl/map_algo.hpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -99,7 +99,6 @@
             tmp.swap(result);
         }
 
- // optimized version
         template<class MapType, class SetType>
         void intersect(MapType& result, const MapType& x1, const SetType& x2)
         {
@@ -124,7 +123,7 @@
         }
 
         template<class MapType, class SetType>
- void intersect(MapType& result, const SetType& x2) //JODO TEST
+ void intersect(MapType& result, const SetType& x2)
         {
             // result = result * x2;
             MapType tmp;
@@ -160,14 +159,13 @@
                                                 MapType::inverse_codomain_intersect()(common_value, cur_x2_->CONT_VALUE);
                                                 result.subtract(*res_);
                                                 result.add(MapType::value_type(res_->KEY_VALUE, common_value));
- //JODO result.template flip<MapType::inverse_codomain_intersect>(*insertion.ITERATOR);
                                         }
                     else
                         result.subtract(*insertion.ITERATOR);
                                 }
                         }
 
- if(is_total<MapType>::value && !absorbs_neutrons<MapType>::value)//JODO
+ if(is_total<MapType>::value && !absorbs_neutrons<MapType>::value)
                                 FORALL(typename MapType, it_, result)
                                         it_->CONT_VALUE = neutron<typename MapType::codomain_type>::value();
         }

Modified: sandbox/itl/boost/itl/set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/set_algo.hpp (original)
+++ sandbox/itl/boost/itl/set_algo.hpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -96,7 +96,6 @@
         ObjectT& operator += (ObjectT& result, const ObjectT& x2)
         { return Set::add(result, x2); }
 
- //JODO CL??
         template<class ObjectT, class CoObjectT>
         ObjectT& subtract(ObjectT& result, const CoObjectT& x2)
         {

Modified: sandbox/itl/boost/itl/type_traits/neutron.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/neutron.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/neutron.hpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -18,7 +18,7 @@
     template <class Type> struct neutron
     {
         static Type value();
- inline Type operator()()const { return value(); } //JODO everything static??
+ Type operator()()const { return value(); }
     };
 
 #ifdef ITL_NEEDS_GREGORIAN_DATE_NEUTRON_VALUE

Modified: sandbox/itl/libs/itl/example/splititvmap_shell/splititvmap_shell.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/splititvmap_shell/splititvmap_shell.cpp (original)
+++ sandbox/itl/libs/itl/example/splititvmap_shell/splititvmap_shell.cpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -111,21 +111,6 @@
 
                 }
                 break;
- //JODO REV
- //case '_':
- // {
- // cout << "input: lwb upb >> ";
- // cin >> lwb >> upb;
- // typename MapTV::interval_type
- // itv = typename MapTV::interval_type(lwb,upb);
- // split_interval_set<typename MapTV::domain_type> sgl(itv);
- // m1.erase(itv);
-
- // cout << "_" << itv.as_string().c_str()<<" "<< " =" << endl;
- // cout << "{" << m1.as_string() << "}" << endl;
-
- // }
- // break;
             case 'j':
                 {
                     m1.join();
@@ -158,7 +143,7 @@
 {
     cout << ">> Interval Template Library: Test splititvmap_shell.cpp <<\n";
     cout << "-----------------------------------------------------------\n";
- mapTestShell< interval_map<int, int> >(); //JODO REV
+ mapTestShell< interval_map<int, int> >();
 
     return 0;
 }

Modified: sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -331,10 +331,6 @@
     std::pair<interval<T>,U> I8_9D_1(I8_9D, u1);
     std::pair<interval<T>,U> I8_9I_1(I8_9I, u1);
 
- //JODO INSIGHT: With respect to subtraction all interval_sets are working equivalently:
- //Never does a subtract operation introduce or preserve interval borders within
- //the range of the subtracted elements. This is almost trivial.
- //LAW: y -= x == y -= x.join()
     SplitIntervalMapT split_map;
     split_map.add(I0_4D_1).add(I2_6D_1).add(I5_7D_1).add(I7_8D_1).add(I8_9I_1);
     BOOST_CHECK_EQUAL( split_map.iterative_size(), 7 );
@@ -417,10 +413,6 @@
     std::pair<interval<T>,U> I8_9D_1(I8_9D, u1);
     std::pair<interval<T>,U> I8_9I_1(I8_9I, u1);
 
- //JODO INSIGHT: With respect to subtraction all interval_sets are working equivalently:
- //Never does a subtract operation introduce or preserve interval borders within
- //the range of the subtracted elements. This is almost trivial.
- //LAW: y -= x == y -= x.join()
     SplitIntervalMapT split_map;
     split_map.add(I0_4D_1).add(I2_6D_1).add(I5_7D_1).add(I7_8D_1).add(I8_9I_1);
     BOOST_CHECK_EQUAL( split_map.iterative_size(), 7 );
@@ -505,10 +497,6 @@
     std::pair<interval<T>,U> I8_9D_1(I8_9D, u1);
     std::pair<interval<T>,U> I8_9I_1(I8_9I, u1);
 
- //JODO INSIGHT: With respect to subtraction all interval_sets are working equivalently:
- //Never does a subtract operation introduce or preserve interval borders within
- //the range of the subtracted elements. This is almost trivial.
- //LAW: y -= x == y -= x.join()
     SplitIntervalMapT split_map;
     split_map.add(I0_4D_1).add(I2_6D_1).add(I5_7D_1).add(I7_8D_1).add(I8_9I_1);
     BOOST_CHECK_EQUAL( split_map.iterative_size(), 7 );
@@ -838,7 +826,6 @@
     BOOST_CHECK_EQUAL( split_AB, split_ab );
 
     split_AB = split_A;
- //(split_AB &= mapping_pair<T,U>(v1,u1)) += make_pair(interval<T>::open(v1,v7), u1); //JODO
     split_AB &= mapping_pair<T,U>(v1,u1);
     split_AB += make_pair(interval<T>::open(v1,v7), u2);
     split_ab2.clear();
@@ -936,7 +923,6 @@
     BOOST_CHECK_EQUAL( split_AB, split_ab );
 
     split_AB = split_A;
- //(split_AB &= mapping_pair<T,U>(v1,u1)) += make_pair(interval<T>::open(v1,v7), u1); //JODO
     split_AB &= interval<T>(v1);
     split_AB += make_pair(interval<T>::open(v1,v7), u1);
     split_ab2.clear();

Modified: sandbox/itl/libs/itl/test/test_interval_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_shared.hpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -28,7 +28,7 @@
     // we are able to test operations only for the most basic values
     // neutron (0, empty, T() ...) and unon.
 
- //T v0 = neutron<T>(); //JODO check operator() variant
+ //T v0 = neutron<T>();
     //T v1 = unon<T>();
     T v0 = neutron<T>::value();
     T v1 = unon<T>::value();
@@ -256,8 +256,6 @@
     BOOST_CHECK_EQUAL( enclosure(map_A), I0_9I );
     BOOST_CHECK_EQUAL( map_A.lower(), I0_9I.lower() );
     BOOST_CHECK_EQUAL( map_A.upper(), I0_9I.upper() );
- //JODO: LAW !a.empty() => enclosure(a).lower() == a.lower()
- //JODO: LAW !a.empty() => enclosure(a).upper() == a.upper()
 
     IntervalMapT map_A1 = map_A, map_B1 = map_B,
                  map_A2 = map_A, map_B2 = map_B;
@@ -591,7 +589,6 @@
     //map_AB -> [1]
     // 1
 
- //JODO intersection with key-element not yet working
     map_A.clear();
     map_A.add(I0_3D_1).add(I6_9D_1);
     map_AB = map_A;

Modified: sandbox/itl/libs/itl/test/test_interval_set_mixed/test_interval_set_mixed.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_set_mixed/test_interval_set_mixed.cpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_set_mixed/test_interval_set_mixed.cpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -321,10 +321,6 @@
     interval<T> I8_9D = interval<T>::rightopen(v8,v9);
     interval<T> I8_9I = interval<T>::closed(v8,v9);
 
- //JODO INSIGHT: With respect to subtraction all interval_sets are working equivalently:
- //Never does a subtract operation introduce or preserve interval borders within
- //the range of the subtracted elements. This is almost trivial.
- //LAW: y -= x == y -= x.join()
     split_interval_set<T> split_set;
     split_set.add(I0_4D).add(I2_6D).add(I5_7D).add(I7_8D).add(I8_9I);
     BOOST_CHECK_EQUAL( split_set.iterative_size(), 7 );
@@ -432,10 +428,6 @@
     interval<T> I8_9D = interval<T>::rightopen(v8,v9);
     interval<T> I8_9I = interval<T>::closed(v8,v9);
 
- //JODO INSIGHT: With respect to subtraction all interval_sets are working equivalently:
- //Never does a subtract operation introduce or preserve interval borders within
- //the range of the subtracted elements. This is almost trivial.
- //LAW: y -= x == y -= x.join()
     split_interval_set<T> split_set;
     split_set.add(I0_4D).add(I2_6D).add(I5_7D).add(I7_8D).add(I8_9I);
     BOOST_CHECK_EQUAL( split_set.iterative_size(), 7 );

Modified: sandbox/itl/libs/itl/test/test_interval_set_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_set_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_set_shared.hpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -24,8 +24,6 @@
     // we are able to test operations only for the most basic values
     // neutron (0, empty, T() ...) and unon.
 
- //T v0 = neutron<T>(); //JODO check operator() variant
- //T v1 = unon<T>();
     T v0 = neutron<T>::value();
     T v1 = unon<T>::value();
     interval<T> I0_0I(v0);
@@ -217,8 +215,6 @@
     BOOST_CHECK_EQUAL( enclosure(set_A), I0_9I );
     BOOST_CHECK_EQUAL( set_A.lower(), I0_9I.lower() );
     BOOST_CHECK_EQUAL( set_A.upper(), I0_9I.upper() );
- //JODO: LAW !a.empty() => enclosure(a).lower() == a.lower()
- //JODO: LAW !a.empty() => enclosure(a).upper() == a.upper()
 
     IntervalSet<T> set_A1 = set_A, set_B1 = set_B,
                    set_A2 = set_A, set_B2 = set_B;

Modified: sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp (original)
+++ sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -30,8 +30,6 @@
     BOOST_CHECK_EQUAL(interval<T>().empty(), true);
     BOOST_CHECK_EQUAL(interval<T>().cardinality(), itl::neutron<typename itl::size<T>::type>::value());
     BOOST_CHECK_EQUAL(interval<T>().size(), itl::neutron<typename itl::size<T>::type>::value());
- //JODO STATIC_ASSERTS length fails with std::string
- //BOOST_CHECK_EQUAL(interval<T>().length(), itl::neutron<itl::typename difference<T>::type>::value());
     BOOST_CHECK_EQUAL(interval<T>().lower(), itl::unon<T>::value());
     BOOST_CHECK_EQUAL(interval<T>().upper(), itl::neutron<T>::value());
 

Modified: sandbox/itl/libs/validate/example/labat_single/labat_single.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_single/labat_single.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_single/labat_single.cpp 2009-02-15 05:13:39 EST (Sun, 15 Feb 2009)
@@ -14,6 +14,8 @@
 
 #include <boost/itl/set.hpp>
 #include <boost/itl/map.hpp>
+#include <boost/itl/interval_morphism.hpp>
+#include <boost/validate/laws/induced_relation.hpp>
 #include <boost/validate/validater/law_validater.hpp>
 #include <boost/validate/gentor/gentorprofile.hpp>
 #include <boost/validate/gentor/rangegentor.hpp>
@@ -45,8 +47,14 @@
         // <interval_map<int, nat> > TestLawT;
         //LawValidater<TestLawT, RandomGentor> test_law;
 
- typedef InplaceAssociativity
- <itl::interval_map<int, int, partial_absorber>, inplace_et> TestLawT;
+ //typedef InplaceAssociativity
+ // <itl::interval_map<int, int, partial_absorber>, inplace_et> TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
+
+ typedef InducedRelation
+ <itl::interval_map<int, int, partial_enricher>,
+ typename itl::interval_map<int, int, partial_enricher>::atomized_type,
+ Interval::Atomize, protonic_equal> TestLawT;
         LawValidater<TestLawT, RandomGentor> test_law;
 
         //-----------------------------------------------------------------------------


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