|Re: [eigen] Using Eigen::Map to use eigen operations on my data|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Using Eigen::Map to use eigen operations on my data
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 29 Oct 2009 18:31:20 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=0Dr7/PycpVgflwrOWCX8wSD0s39oIUlDW5K0bKAOOYQ=; b=wi5BnYeOvNypD9zg4W1JOcsHh63v1SWZz4siyWIhv7BDFqMMvhBtULNfnLkYoOaJ/7 GWmHZBPZDCV8MkDII1lyQLhaZQTymsIxXwDDpT07B9IQ8rPl+jK4Sq0FlZlKkx1hBBli eOYawSYbxeKZaAu5qcrKuv7PGbLHPBWn779ec=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=TdHKsIO4+yaMKovkkqNiXrRFYdIxLiw3TI/kDKJ1et9K0QsPDtH6MzQEVU52/ZeWgL dCI8nIZLadl5wuFJZ5nVYMY4hnpJNZYaTRNYPKi3wfUqlH8hf5fEqzRk/CawWgV4yWrz plU62HNoN/slZHInUuOzq8aNtLhyJ54HUA0RM=
2009/10/29 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> 2009/10/29 Robert Lupton the Good <rhl@xxxxxxxxxxxxxxxxxxx>:
>> I guess I boiled this down too far (boiled it dry?).
>> I'm writing some swig bindings to pass numpy arrays to code that uses Eigen.
>> I can unpack the data from the numpy arrays, so I have a (float *data, int
>> nx, int ny) tuple. I'd like to pass that to my routines that expect
>> After Benoit's explanation, it looks as if I need to redo my interface to
>> expect Map<MatrixXf> or (to preserve the option of passing MatrixXf)
>> template them over the argument type --- for type safety, Benoit proposes
>> using MatrixBase<T>.
>> Fine, I can do that --- although the details of the swig typedefs will be
>> nasty as templates must be explicitly expanded. I can work on that.
> If you need only MatrixXf and Map<MatrixXf>, you could code these as 2
> separate functions and do without templates. (They could internally
> call a common template function that would be an implementation
>> I still think that the manual entry is confusing --- it maps an array and
>> then assigns it to a Matrix2f but all the mapping is doing is initialising
>> the memory.
> Indeed. I'll try to remember to clarify that.
Sorry, I can't find the example you're talking about. Can you show me?
It sounds confusing indeed.
>Note that the docs also talk about:
> * This class represents a matrix or vector expression mapping an >existing array of data.
> * It can be used to let Eigen interface without any overhead with >non-Eigen data structures,
> * such as plain C arrays or structures from other libraries.
> Which is true, but apparently not quite as simple as it might seem.
Here on the other hand, i don't see how this should be changed? The
difficulty in your case didnt come from Eigen, it rather seems that
you hit generic difficulties in interfacing templated code with
something (swig) that doesn't like templates.