Re: [eigen] Map questions |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
ok first of all, ok i didn't realize it failed to compile, so ignore my second
e-mail.
> indeed, but that does not solve anything, I mean the compilation error
> is still the same. (it complains a is already defined)
ok, now i understand
> adding Map functions to Matrix does not change the current API, it
> just extend it. On the other hand I agree they are redundant in most
> cases, and having such two ways to express the same thing might be a
> bit confusing.
actually this is what we have with LU and lu(), etc, so it wouldn't be the
first time we do that.
> perhaps we could rename the type Map to MapType, and define Map as a
> global static function, or something in that direction....
Any specific reason for a static global function? A static method in Matrix
seems more natural to me...? The notation isn't heavier,
Vector3d::Map(a) = v;
versus
Map<Vector3d>(a) = v;
Ideally I'd rather have the class named Map and the static function
Matrix::Map()... but I don't remember if this is going to be allowed.
If it isn't legal, then this is actually an argument against using a capital
letter for static methods. We can then make a little exception an call the
method Vector3d::map()...
Cheers,
Benoit
>
> > On Wednesday 29 October 2008 22:51:34 Gael Guennebaud wrote:
> >> Hi,
> >>
> >> On Wed, Oct 29, 2008 at 9:01 PM, Cristóvão Sousa <crisjss@xxxxxxxxx>
wrote:
> >> > Hi,
> >> >
> >> > I would like to do something like
> >> >
> >> > Vector3d v;
> >> > // v = something;
> >> > double a[3];
> >> > Map<Vector3d>(a) = v;
> >>
> >> indeed, "Map<Vector3d>(a) = v;" seems to be equivalent to
> >> "Map<Vector3d> a = v;" that is very unfortunate...
> >>
> >> Actually the following variants works:
> >>
> >> Map<Vector3d>(a,3) = v;
> >>
> >> (Map<Vector3d>(a)) = v;
> >>
> >> Map<Vector3d>(a).operator=(v);
> >>
> >> Map<Vector3d>(a).lazyAssign(v);
> >>
> >> Map<Vector3d> _a(a); _a = v;
> >>
> >> Map<Vector3d>(a).start<3>() = v;
> >>
> >> ...
> >>
> >> I could keep going like this forever, but nothing is really good and
> >> intuitive. Perhaps this is a good motivation to resurrect the
> >> Matrix::Map static functions.... ??? or find something else....
> >>
> >> > Another thing that could be a little bug:
> >> > it is currently possible to do
> >> >
> >> > const double a[3]={1,2,3};
> >> > Map<Vector3d>(a).setZero();
> >> >
> >> > , which discards the const qualifier of a.
> >>
> >> ok, I'll check later if we can do something for that, but there is
> >> nothing urgent here.
> >>
> >> cheers,
> >> gael.
> >
> > ---
---