alfC | 1 Jan 2011 03:35
Picon

Re: [units][geometry] subtract_typeof_helper<> help!


Sorry to revive this old thread,

 First I would like to know if there had been any progress in this front.

 Second, I would like to pick the attention of Boost.Geometry again in order to suggest them use boost.units as a way to make the Boost.Geometry library very general.

 Third, after some thinking I have some thoughts about the original question in this post

What I'm struggling with is how to provide a units-aware Vector/Point system
for physical computation.
Currently, I'm favoring using units::quantity<U, Vector<double>> rather than
Vector<units::quantity<U>>.

I think none of the two options makes general sense. The only point at which units make sense is at the "metric" of the space. Since in Boost.geometry library coordinate system an metric are tied together, we need a special type of coordinates system. For example one suggestion could be to extend the coordinate systems of Boost.Geometry to include the units and dimension of space. For example one way to specify points in space could be by means of a type like this

 model::point<double, 3, cs::unit::cartesian<si::length> >

and then specialize all the template functions that use cartesian as coordinate system, for example distance. This makes sense because the only point at which units are useful is when we take distances, modulus or projections between vectors in that "space" with unit/dimension.

 
I expected to use boost::geometry, but that didn't seem to provide much
benefit.

Regardless of whether we see benefit or not at this point I think this is a real problem that we should face. This is a conceptual problem that must be solved sooner or later.
 
Now that I'm not using boost::geometry to implement Vector/Point, it might
be much easier to support Vector<units::quantity<U>> as well.

My example was an intermediate stage.  The example file that I failed to
post looked like this, along with the sample output.
It is interesting that (somehow) the Point/Vector quantities figured
themselves out.
Its interesting because:
   Vector = Point - Point
   Point = Point + Vector
  Vector = Vector + Vector
but _not_ Point = Point + Point
  and the dot product
  Scalar = Vector * Vector

#include "BasicVector.h"

can you please post what is your current implementation of BasicVector.h?


  cout << disp1 << endl;
  cout << abs(disp1) << endl;
  cout << abs_squared(disp1) << endl;
  p1 += disp1;
  cout << p1 << endl;
  Time dt = Time(0.1 * s);
  Velocity v = (p3 - p2) / dt;
  cout << v << endl;
  return EXIT_SUCCESS;
} // main

Output:
<3 3 3> m
(4 5 6) m
<-10 40 -20> m s^-1

this is the sort of things that from a dimensional point of view don't make sense. In the previous "m" or "m s^-1" is just a tag for the vector but it is not a real unit of the vector.
This is more ovbius when vectors are represented in spherical coordinates.

Any thoughts?

Thank you,
Alfredo

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Lloyd | 1 Jan 2011 07:10
Picon

Re: boost asio tcp::socket assign

Thanks Igor.  Wish you (all) a very happy new year...

On Thu, Dec 30, 2010 at 4:05 PM, Igor R <boost.lists <at> gmail.com> wrote:
>> then is there any method/operator (=) available in asio to assign a
>> socket to another socket?
>
> No, socket is non-copyable. If you have to create and pass the socket
> object to from outside, you can define a smart-ptr to tcp::socket in
> your class, or an optional<tcp::socket>.
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Hossein Haeri | 1 Jan 2011 17:19
Picon
Favicon

[Proto] Vector Example Compilation Failure

Dear all,


Trying the Vector example at the Proto documentation:


http://boost.org/doc/libs/1_45_0/doc/html/proto/users_guide.html#boost_proto.users_guide.examples.vector


under Boost 1.42 and GCC 4.5.1 (MinGW32, WinXP, SP3), I get the error message in the PS. Any ideas why this is happening? How would I solve the problem? (BTW, I have already tried the Boost 1.42 version of this example as well.)


TIA,

--Hossein



-------------- Build: Debug in Vector ---------------

Compiling: main.cpp
In file included from d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/vector:65:0,
from D:\My Documents\My Programmes\Tutorial\Proto\Examples\Vector\main.cpp:10:
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h: In instantiation of 'std::_Vector_base<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>':
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h:171:5: instantiated from 'std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:5: instantiated from 'const int boost::mpl::aux::template_arity_impl<std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>, 1>::value'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:5: instantiated from 'const int boost::mpl::aux::template_arity<std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_> >::value'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:30: instantiated from 'boost::mpl::aux::template_arity<std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_> >'
D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:247:13: instantiated from 'boost::proto::detail::terminal_matches<const std::vector<int>&, std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_> >'
D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:322:13: [ skipping 7 instantiation contexts ]
D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:505:13: instantiated from 'boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar>'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/nested_type_wknd.hpp:28:1: instantiated from 'boost::mpl::aux::nested_type_wknd<boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar> >'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/and.hpp:29:1: instantiated from 'boost::mpl::aux::and_impl<true, boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar>, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/and.hpp:55:1: instantiated from 'boost::mpl::and_<mpl_::bool_<true>, boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar>, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >'
D:\Sources\Boost\boost_1_42_0/boost/proto/operators.hpp:219:9: instantiated from 'boost::proto::detail::enable_binary<VectorDomain, IsVector<std::vector<int> >, std::vector<int>, IsVector<std::vector<int> >, std::vector<int>, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> > >'
D:\My Documents\My Programmes\Tutorial\Proto\Examples\Vector\main.cpp:223:34: instantiated from here
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h:71:60: error: no class template named 'rebind' in 'struct boost::proto::wildcardns_::_'
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h: In instantiation of 'std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>':
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:5: instantiated from 'const int boost::mpl::aux::template_arity_impl<std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>, 1>::value'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:5: instantiated from 'const int boost::mpl::aux::template_arity<std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_> >::value'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:30: instantiated from 'boost::mpl::aux::template_arity<std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_> >'
D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:247:13: instantiated from 'boost::proto::detail::terminal_matches<const std::vector<int>&, std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_> >'
D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:322:13: instantiated from 'boost::proto::detail::matches_<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l>, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_> >, 0l> >'
D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:505:13: [ skipping 6 instantiation contexts ]
D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:505:13: instantiated from 'boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar>'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/nested_type_wknd.hpp:28:1: instantiated from 'boost::mpl::aux::nested_type_wknd<boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar> >'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/and.hpp:29:1: instantiated from 'boost::mpl::aux::and_impl<true, boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar>, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >'
D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/and.hpp:55:1: instantiated from 'boost::mpl::and_<mpl_::bool_<true>, boost::proto::result_of::matches<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> >, VectorGrammar>, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >'
D:\Sources\Boost\boost_1_42_0/boost/proto/operators.hpp:219:9: instantiated from 'boost::proto::detail::enable_binary<VectorDomain, IsVector<std::vector<int> >, std::vector<int>, IsVector<std::vector<int> >, std::vector<int>, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::multiplies, boost::proto::argsns_::list2<VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> >, VectorExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const std::vector<int>&>, 0l> > >, 2l> > >'
D:\My Documents\My Programmes\Tutorial\Proto\Examples\Vector\main.cpp:223:34: instantiated from here
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h:173:58: error: no type named 'value_type' in 'struct boost::proto::wildcardns_::_'
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h:196:20: error: no members matching 'std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>::_Base::_M_allocate' in 'struct std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>::_Base'
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h:197:20: error: no members matching 'std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>::_Base::_M_deallocate' in 'struct std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>::_Base'
d:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.5.1/include/c++/bits/stl_vector.h:199:20: error: no members matching 'std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>::_Base::_M_get_Tp_allocator' in 'struct std::vector<boost::proto::wildcardns_::_, boost::proto::wildcardns_::_>::_Base'
Process terminated with status 1 (0 minutes, 2 seconds)
7 errors, 0 warnings


_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Matthias Troyer | 1 Jan 2011 17:20
Picon

Re: [Accumulators] Retract samples


On 24 Dec 2010, at 09:59, Alex Hagen-Zanker wrote:

> On 23/12/2010 15:40, Matthias Troyer wrote:
>> On Dec 23, 2010, at 1:00 PM, Alex Hagen-Zanker wrote:
>> 
>>> Dear all,
>>> 
>>> I am considering using Boost Accumulators for a moving window calculation.  When a window would step
from left to right, it should add the sample on the right side of the window and retract the sample on the left
side on each step.
>>> 
>>> For weighted accumulators, it might be possible to use negative weights. But, since the accumulators
do not appear to be intended for this use, there may be implementation details that invalidate the use of
negative weights.
>>> 
>>> Is there a recommended way to retract samples in Boost Accumulators?
>>> 
>>> Thanks, Alex
>> Hi Alex,
>> 
>> This is not the intended use of the accumulator library.
>> 
>> Matthias
>> 
> I was afraid so. It is a pity because I require so much of the functionality that is already in Boost Accumulators.
> Thanks, Alex

Maybe you can reuse the framework and the accumulators, and derive new stats classes and a framework that
has a retract feature as well? Or you could look at the time series library.

Matthias
dada | 1 Jan 2011 18:08
Picon

[Serialization] [1.42]Don't understand warning with export

Happy new year !

Dear boost users,

I don' understand this warning (g++, boost v1.42):
"export.hpp:129: warning: type qualifiers ignored on function return type"

--------------------------
     export.hpp
--------------------------
          template<class T>
          struct guid_initializer
         {
          ...
(L.129)     const void export_guid(mpl::true_) const {
             }
          ...
         };
-----------------------

This warning happens when i use the  BOOST_CLASS_EXPORT macro.
Any idea ?
Thanks,
Damien.
Robert Ramey | 1 Jan 2011 19:02

Re: [Serialization] [1.42]Don't understand warning with export

dada <at> lamef.bordeaux.ensam.fr wrote:
> Happy new year !
>
> Dear boost users,
>
> I don' understand this warning (g++, boost v1.42):
> "export.hpp:129: warning: type qualifiers ignored on function return
> type"
> --------------------------
>     export.hpp
> --------------------------
>          template<class T>
>          struct guid_initializer
>         {
>          ...
> (L.129)     const void export_guid(mpl::true_) const {
>             }
>          ...
>         };
> -----------------------
>
> This warning happens when i use the  BOOST_CLASS_EXPORT macro.
> Any idea ?
> Thanks,
> Damien.

This is an innocuous coding error in export.hpp.  The warning can
be ignored and has since been removed.

Robert Ramey
dada | 1 Jan 2011 21:10
Picon

Re: [Serialization] [1.42]Don't understand warning with export

Robert Ramey <ramey <at> rrsd.com> a écrit :

> dada <at> lamef.bordeaux.ensam.fr wrote:
>> Happy new year !
>>
>> Dear boost users,
>>
>> I don' understand this warning (g++, boost v1.42):
>> "export.hpp:129: warning: type qualifiers ignored on function return
>> type"
>> --------------------------
>>     export.hpp
>> --------------------------
>>          template<class T>
>>          struct guid_initializer
>>         {
>>          ...
>> (L.129)     const void export_guid(mpl::true_) const {
>>             }
>>          ...
>>         };
>> -----------------------
>>
>> This warning happens when i use the  BOOST_CLASS_EXPORT macro.
>> Any idea ?
>> Thanks,
>> Damien.
>
> This is an innocuous coding error in export.hpp.  The warning can
> be ignored and has since been removed.
>
> Robert Ramey
>
Ok, thanks for your answer, could i safely replace the "const void" by  
"void" in export.hpp sources ?

"const void export_guid(mpl::true_) const" become
"      void export_guid(mpl::true_) const"
Barend Gehrels | 1 Jan 2011 23:34
Picon
Favicon

Re: [units][geometry] subtract_typeof_helper<> help!

Hi,

>  Second, I would like to pick the attention of Boost.Geometry again in 
> order to suggest them use boost.units as a way to make the 
> Boost.Geometry library very general.
> (...)
> I think none of the two options makes general sense. The only point at 
> which units make sense is at the "metric" of the space. Since in 
> Boost.geometry library coordinate system an metric are tied together, 
> we need a special type of coordinates system. For example one 
> suggestion could be to extend the coordinate systems of Boost.Geometry 
> to include the units and dimension of space. For example one way to 
> specify points in space could be by means of a type like this
>
>  model::point<double, 3, cs::unit::cartesian<si::length> >
>
> and then specialize all the template functions that use cartesian as 
> coordinate system, for example distance. This makes sense because the 
> only point at which units are useful is when we take distances, 
> modulus or projections between vectors in that "space" with 
> unit/dimension.

I will look at this usage soon.

Thanks, Barend
alfC | 2 Jan 2011 08:07
Picon

Re: [units][geometry] subtract_typeof_helper<> help!

Hi Barend,

I will look at this usage soon.

Great, please keep me (us) posted. I have several half implemented routines to handle geometric objects (e.g point) with "dimension" and also a set of adapted_boost_array_units.hpp. I am stuck now because I reached the point at which I can't understand the internals of the library.

What I have so far is for example
    using namespace boost::geometry;
    using namespace boost::units;
    model::point<double, 3, cs::units_cartesian<si::length> > p1(1.*si::meter,2.*si::meter,3.*si::meter);
    std::clog << distance(p1,p1) << std::endl; // outputs   0. * meter

and

#include<boost/geometry/geometries/adapted/boost_array_units_cartesian.hpp>
...
    using namespace boost::units;
    boost::array<quantity<si::length>, 3> p5={{10.*si::meter,11.*si::meter,12.*si::meter}};
    std::clog << distance(p5,p5) << std::endl; //outputs 0. * meter

the implementation I have is very primitive and it is practically a mockup because it bypasses most of the features of the Boost.Geometry library; mainly because I didn't understand them internally.

Thank you,
Alfredo

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Eric Niebler | 2 Jan 2011 15:11
Picon
Favicon
Gravatar

Re: [Proto] Vector Example Compilation Failure

On 1/1/2011 11:19 AM, Hossein Haeri wrote:
> Dear all,
> 
> Trying the Vector example at the Proto documentation:
> 
> http://boost.org/doc/libs/1_45_0/doc/html/proto/users_guide.html#boost_proto.users_guide.examples.vector
> 
> under Boost 1.42 and GCC 4.5.1 (MinGW32, WinXP, SP3), I get the error
> message in the PS. Any ideas why this is happening? How would I solve
> the problem? (BTW, I have already tried the Boost 1.42 version of this
> example as well.)

Hi Hossein,

This is the same problem as last time, although you would need to dig
into BOOST_PROTO_DEFINE_OPERATORS to know that. As last time, this
problem doesn't not appear in Boost trunk.

I don't think gcc-4.5 was available when Boost 1.42 was released, so
it's not surprising there are problems. Would it be possible for you to
use a more recent version of Boost?

--

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Gmane