Daniel - why is it better using: IMP_NEW(core::Transform, tsm,(t)); for(Particles::iterator it = ps.begin(); it != ps.end();it++) { tsm->apply(*it); } instead of: std::for_each(ps.begin(),ps.end(),SingletonFunctor(new IMP::core::Transform(t)));
I saw you changed it in domino .
thanks, Keren.
Side effect of enforcing that IMP::Objects aren't allocated on the stack (since they are ref counted).
On Aug 6, 2009, at 11:04 PM, Keren Lasker wrote:
> Daniel - > why is it better using: > IMP_NEW(core::Transform, tsm,(t)); > for(Particles::iterator it = ps.begin(); it != ps.end();it++) { > tsm->apply(*it); > } > instead of: > std::for_each(ps.begin(),ps.end(),SingletonFunctor(new > IMP::core::Transform(t))); > > I saw you changed it in domino . > > thanks, > Keren. > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
wouldn't it be easier to have transform function after all? :)
On Thu, Aug 6, 2009 at 11:20 PM, Daniel Russeldrussel@gmail.com wrote: > Side effect of enforcing that IMP::Objects aren't allocated on the stack > (since they are ref counted). > > > On Aug 6, 2009, at 11:04 PM, Keren Lasker wrote: > >> Daniel - >> why is it better using: >> IMP_NEW(core::Transform, tsm,(t)); >> for(Particles::iterator it = ps.begin(); it != ps.end();it++) { >> tsm->apply(*it); >> } >> instead of: >> std::for_each(ps.begin(),ps.end(),SingletonFunctor(new >> IMP::core::Transform(t))); >> >> I saw you changed it in domino . >> >> thanks, >> Keren. >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev >
On Aug 7, 2009, at 10:32 AM, Dina Schneidman wrote:
> wouldn't it be easier to have transform function after all? :)
we basically do :-)
std::foreach(ps.begin(), ps.end(), SingletonFunctor(new core::Transform(t)))
That said, personally, I would just go for:
for (Particles::iterator it = ps.begin(); it != ps.end();it++){ core::XYZ d(*it); d.set_coordinates(t.transform(d.get_coordinates()); }
or
std::foreach(ps.begin(), ps.end(), boost::bind(&Transformation3D::transform, &t, boost::lambda::placeholders::_1))
ok, maybe not that last one :-)
> > On Thu, Aug 6, 2009 at 11:20 PM, Daniel Russeldrussel@gmail.com > wrote: >> Side effect of enforcing that IMP::Objects aren't allocated on the >> stack >> (since they are ref counted). >> >> >> On Aug 6, 2009, at 11:04 PM, Keren Lasker wrote: >> >>> Daniel - >>> why is it better using: >>> IMP_NEW(core::Transform, tsm,(t)); >>> for(Particles::iterator it = ps.begin(); it != ps.end();it++) { >>> tsm->apply(*it); >>> } >>> instead of: >>> std::for_each(ps.begin(),ps.end(),SingletonFunctor(new >>> IMP::core::Transform(t))); >>> >>> I saw you changed it in domino . >>> >>> thanks, >>> Keren. >>> _______________________________________________ >>> IMP-dev mailing list >>> IMP-dev@salilab.org >>> https://salilab.org/mailman/listinfo/imp-dev >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev >> > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
is the one using the XYZ decorator has any efficiency advantage ? On Aug 7, 2009, at 11:00 AM, Daniel Russel wrote:
> > On Aug 7, 2009, at 10:32 AM, Dina Schneidman wrote: > >> wouldn't it be easier to have transform function after all? :) > > we basically do :-) > > std::foreach(ps.begin(), ps.end(), SingletonFunctor(new > core::Transform(t))) > > That said, personally, I would just go for: > > for (Particles::iterator it = ps.begin(); it != ps.end();it++){ > core::XYZ d(*it); > d.set_coordinates(t.transform(d.get_coordinates()); > } > > or > > std::foreach(ps.begin(), ps.end(), > boost::bind(&Transformation3D::transform, &t, > boost::lambda::placeholders::_1)) > > ok, maybe not that last one :-) > > > > >> >> On Thu, Aug 6, 2009 at 11:20 PM, Daniel Russeldrussel@gmail.com >> wrote: >>> Side effect of enforcing that IMP::Objects aren't allocated on the >>> stack >>> (since they are ref counted). >>> >>> >>> On Aug 6, 2009, at 11:04 PM, Keren Lasker wrote: >>> >>>> Daniel - >>>> why is it better using: >>>> IMP_NEW(core::Transform, tsm,(t)); >>>> for(Particles::iterator it = ps.begin(); it != ps.end();it++) { >>>> tsm->apply(*it); >>>> } >>>> instead of: >>>> std::for_each(ps.begin(),ps.end(),SingletonFunctor(new >>>> IMP::core::Transform(t))); >>>> >>>> I saw you changed it in domino . >>>> >>>> thanks, >>>> Keren. >>>> _______________________________________________ >>>> IMP-dev mailing list >>>> IMP-dev@salilab.org >>>> https://salilab.org/mailman/listinfo/imp-dev >>> >>> _______________________________________________ >>> IMP-dev mailing list >>> IMP-dev@salilab.org >>> https://salilab.org/mailman/listinfo/imp-dev >>> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
On Aug 7, 2009, at 11:10 AM, Keren Lasker wrote:
> is the one using the XYZ decorator has any efficiency advantage ? It (probably) saves a call to malloc, so if you only have a few points it might be faster. I'd actually be interested to see if it is noticeable. I'll add a benchmark.
> On Aug 7, 2009, at 11:00 AM, Daniel Russel wrote: > >> >> On Aug 7, 2009, at 10:32 AM, Dina Schneidman wrote: >> >>> wouldn't it be easier to have transform function after all? :) >> >> we basically do :-) >> >> std::foreach(ps.begin(), ps.end(), SingletonFunctor(new >> core::Transform(t))) >> >> That said, personally, I would just go for: >> >> for (Particles::iterator it = ps.begin(); it != ps.end();it++){ >> core::XYZ d(*it); >> d.set_coordinates(t.transform(d.get_coordinates()); >> } >> >> or >> >> std::foreach(ps.begin(), ps.end(), >> boost::bind(&Transformation3D::transform, &t, >> boost::lambda::placeholders::_1)) >> >> ok, maybe not that last one :-) >> >> >> >> >>> >>> On Thu, Aug 6, 2009 at 11:20 PM, Daniel Russeldrussel@gmail.com >>> wrote: >>>> Side effect of enforcing that IMP::Objects aren't allocated on >>>> the stack >>>> (since they are ref counted). >>>> >>>> >>>> On Aug 6, 2009, at 11:04 PM, Keren Lasker wrote: >>>> >>>>> Daniel - >>>>> why is it better using: >>>>> IMP_NEW(core::Transform, tsm,(t)); >>>>> for(Particles::iterator it = ps.begin(); it != ps.end();it++) { >>>>> tsm->apply(*it); >>>>> } >>>>> instead of: >>>>> std::for_each(ps.begin(),ps.end(),SingletonFunctor(new >>>>> IMP::core::Transform(t))); >>>>> >>>>> I saw you changed it in domino . >>>>> >>>>> thanks, >>>>> Keren. >>>>> _______________________________________________ >>>>> IMP-dev mailing list >>>>> IMP-dev@salilab.org >>>>> https://salilab.org/mailman/listinfo/imp-dev >>>> >>>> _______________________________________________ >>>> IMP-dev mailing list >>>> IMP-dev@salilab.org >>>> https://salilab.org/mailman/listinfo/imp-dev >>>> >>> _______________________________________________ >>> IMP-dev mailing list >>> IMP-dev@salilab.org >>> https://salilab.org/mailman/listinfo/imp-dev >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
can we just take this one:
> for (Particles::iterator it = ps.begin(); it != ps.end();it++){ > core::XYZ d(*it); > d.set_coordinates(t.transform(d.get_coordinates()); > }
and call it transform, something like:
void transform(XYZs, Transformation3D)
participants (3)
-
Daniel Russel
-
Dina Schneidman
-
Keren Lasker