Re: [eigen] Transform.rotation() hang |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Transform.rotation() hang*From*: Ricard Marxer Piñón <email@xxxxxxxxxxxxxxxx>*Date*: Wed, 11 Feb 2009 12:04:53 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=HLl5YNmlRSbIWKT9y2YHCfgiAJhjqAdeDX3pS5idyho=; b=vB7qP8cVZUNjgjMS8zBzBYpzg94GhP6p9pN2bO9g7Dk4OfYYuHeV6cFL/DKJpDDaSG tVbKF1TYccYXAaIKDEUK4hjUqrsGwrdMEYRH+UOMFqNqaeNc0v+xFTWSue3eGWBDkOhJ jrdJ/GJ5NjX4R+C6J2upbzh8G+lWKOZjeZIHk=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=GFXiu2IY0zNn72YCKCXjpIuXksCbsjR8X4EplZhi4VirkViJgm7hLYCCMOc8GbGJ+6 6LGkuY7HFks9101I/Kb6mENdlhAPTMVjwd8yVaNaUAHtjt8pPtpsTxkQWpOTj2jfRp/v vmAqdVVLoPXfdLQ4SyfVUG1PZr5jSfFpI78IU=

hi,

from an API perspective I think the prune() method would best fit as

cwise().prune(Scalar reference, RealScalar epsilon = precision<RealScalar>())

since it is a coefficient-wise operation.

I think that is what you guys have proposed, but since I wasn't sure I just wanted to confirm.

ricard

On Wed, Feb 11, 2009 at 8:45 AM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:

hi,

to put my 2 cents too.

for sparse objects I added the function:

void prune(Scalar reference, RealScalar epsilon = precision<RealScalar>());

which exactly does what Keir proposed. So, at least we should use the

same API for both.

Now, for dense object you can implement it like this:

eps = epsilon*reference;

m = (m.abs().cwise() < eps).select(0, m);

and finally, we do have what Ben proposed. It is just called

unaryOp(), binaryOp(), redux() and visitor() according to which kind

of functor you want to apply. They work with vectorization if you

define the function "packet()" in your functor (and specialize struct

ei_functor_traits accordingly, see src/Core/Functors.h for examples)

That means, that you can already do something like:

m1.binaryOp<std::less>(b) instead of a.cwise() < m2

or

m1.unaryOp< _something_complicated_mixing_std::less_and_std::bind_and_s_>(b)

instead of "a.cwise() < s" where s is a scalar.

gael.

On Wed, Feb 11, 2009 at 2:05 AM, Schleimer, Ben <bensch128@xxxxxxxxx> wrote:

> It seems to me to be more useful and powerful to have a general map(Functor) for a matrix then write special case coeff-wise methods.

> It make also make some of the uses of cwise more understandable.

>

> template <typename T>

> struct Truncator {

> const T mVal;

> Truncator(const T& v) : mVal(v) {}

> T operator()(const T& in) const { return mVal<=in ? in: T(); }

> }

>

> Matrix4f m << some matrix...;

> Truncator f(m.norm());

> m = m.map<Truncator>(f);

>

> It might be easier to do some of the cwise operations this way

> (like comparisons, "m.cwise() <= m2" seems odd)

> Of course, I don't know if this would work for vectorization

>

> just my $0.02

> Ben

>

>

>

>

> --- On Tue, 2/10/09, Keir Mierle <mierle@xxxxxxxxx> wrote:

>

>> From: Keir Mierle <mierle@xxxxxxxxx>

>> Subject: Re: [eigen] Transform.rotation() hang

>> To: eigen@xxxxxxxxxxxxxxxxxxx

>> Date: Tuesday, February 10, 2009, 5:03 PM

>> I suspect a .truncate() function would be generally useful.

>>

>> Matrix... M;

>> M.truncate()

>> M.clampSmallValues()

>> M.truncateNegligible()

>> M.? Other ideas?

>>

>> Keir

>>

>> On Tue, Feb 10, 2009 at 1:01 PM, Benoit Jacob

>> <jacob.benoit.1@xxxxxxxxx>wrote:

>>

>> > Meanwhile, here are some thoughts if you absolutely

>> have to live with

>> > the current SVD.

>> >

>> > What I can see on your matrices, is that while their

>> norm is (of the

>> > order of magnitude of) 1, they have some coefficients

>> of the order of

>> > magnitude of 1e-300. That could easily be what

>> triggers a bug in the

>> > current SVD.

>> >

>> > So one thing you can do, before calling the SVD (i.e.

>> before calling

>> > rotation()) is to:

>> > 1) compute N = matrix.norm()

>> > 2) for each entry matrix(i,j),

>> > if(ei_isMuchSmallerThan(matrix(i,j), N))

>> > matrix(i,j) = 0;

>> >

>> > Cheers,

>> > Benoit

>> >

>> > 2009/2/10 Ben Axelrod <baxelrod@xxxxxxxxxxxx>:

>> > > Sometimes calling Eigen::Transform.rotation()

>> hangs and does not return.

>> > >

>> > >

>> > >

>> > > This transform matrix runs fine:

>> > >

>> > > 1 0 -1.931e-312 1

>> > >

>> > > 0 1 0 0

>> > >

>> > > 1.931e-312 0 1 1.5

>> > >

>> > > 0 0 0 1

>> > >

>> > >

>> > >

>> > > This transform matrix hangs:

>> > >

>> > > 1 0 -2.357e-312 1

>> > >

>> > > 0 1 0 0

>> > >

>> > > 1.179e-311 0 5 7.5

>> > >

>> > > 0 0 0 1

>> > >

>> > >

>> > >

>> > >

>> > >

>> > > Any help?

>> > >

>> > >

>> > >

>> > > Detailed info: the transforms were computed by:

>> > >

>> > >

>> > >

>> > > Tf * Tr * Qt * Sc

>> > >

>> > >

>> > >

>> > > Where, for the good transform:

>> > >

>> > >

>> > >

>> > > Tf = Transform:

>> > >

>> > > 1 0 0 1

>> > >

>> > > 0 1 0 0

>> > >

>> > > 0 0 1 0

>> > >

>> > > 0 0 0 1

>> > >

>> > >

>> > >

>> > > Tr = Translation:

>> > >

>> > > 0

>> > >

>> > > 0

>> > >

>> > > 1.5

>> > >

>> > >

>> > >

>> > > Qt = Quaternion:

>> > >

>> > > 0

>> > >

>> > > -9.653e-313

>> > >

>> > > 0

>> > >

>> > > 1

>> > >

>> > >

>> > >

>> > > Sc = Scaling:

>> > >

>> > > 1

>> > >

>> > > 1

>> > >

>> > > 1

>> > >

>> > >

>> > >

>> > >

>> > >

>> > > And for the bad transform:

>> > >

>> > >

>> > >

>> > > Tf = Transform:

>> > >

>> > > 1 0 0 1

>> > >

>> > > 0 1 0 0

>> > >

>> > > 0 0 5 0

>> > >

>> > > 0 0 0 1

>> > >

>> > >

>> > >

>> > > Tr = Translation:

>> > >

>> > > 0

>> > >

>> > > 0

>> > >

>> > > 1.5

>> > >

>> > >

>> > >

>> > > Qt = Quaternion:

>> > >

>> > > 0

>> > >

>> > > -1.179e-312

>> > >

>> > > 0

>> > >

>> > > 1

>> > >

>> > >

>> > >

>> > > Sc = Scaling:

>> > >

>> > > 1

>> > >

>> > > 1

>> > >

>> > > 1

>> > >

>> > >

>> > >

>> > >

>> > >

>> > > Thanks,

>> > >

>> > > -Ben

>> >

>> >

>> >

>

>

>

--

ricard

http://www.ricardmarxer.com

http://www.caligraft.com

**Follow-Ups**:**Re: [eigen] Transform.rotation() hang***From:*Benoit Jacob

**References**:**Re: [eigen] Transform.rotation() hang***From:*Keir Mierle

**Re: [eigen] Transform.rotation() hang***From:*Schleimer, Ben

**Re: [eigen] Transform.rotation() hang***From:*Gael Guennebaud

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Transform.rotation() hang** - Next by Date:
**Re: [eigen] Transform.rotation() hang** - Previous by thread:
**Re: [eigen] Transform.rotation() hang** - Next by thread:
**Re: [eigen] Transform.rotation() hang**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |