Re: [eigen] Is this a bug with Visual Studio ?

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


OK, so you do not need at all to perform computations at the top array
level. So using a Array<MatrixXcd,Dynamic,Dynamic> might be fine, but
to avoid numerous dynamic memory allocations I recommend you to write
your own little 2D array with an operator()(i,j) returning the
(i,j)-th matrix as a Map:

typedef Matrix<std::complex<double>, Dynamic,Dynamic, 0, 16, 16> MiniMatrixXcd;

Map<MiniMatrixXcd> operator()(int i,int j) { return
Map<MatrixXcd>(m_data+(i+j*m_blockRows)*m_matrixRows*m_matrixCols,
m_matrixRows, m_matrixCols); }

Here m_data would be a large buffer of complexes holding all your mini
matrices. I declared a new MiniMatrixXcd type to tell Eigen that your
maximal matrix size is 16x16 thus allowing for better performance. A
Map<MiniMatrixXcd> is very similar to a MatrixXcd with the difference
that it does not hold its memory.

gael

On Wed, Mar 20, 2013 at 6:20 PM, Yann Salaun <yann.salaun@xxxxxxxx> wrote:
> The data structure that I need is a 2D array of complex matrices (all the same size).
> The size of the main array can easily reach 1000 * 100, and the maximum size of the matrices is 16.
> The main operation will be to compute the inverse of each matrix.
>
> Thanks a lot for your time and for any suggestion.
> Yann
>
> ----- Original Message -----
>> From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
>> To: "eigen" <eigen@xxxxxxxxxxxxxxxxxxx>
>> Sent: Wednesday, March 20, 2013 5:56:50 PM
>> Subject: Re: [eigen] Is this a bug with Visual Studio ?
>>
>> Currently I cannot really tell. I guess it depends a lot on what you
>> really need in term of dimensionality (apparently 3D), and
>> operations?
>> (slicing in all dimension? tensor products ?)
>>
>> gael
>>
>> On Wed, Mar 20, 2013 at 5:49 PM, Yann Salaun <yann.salaun@xxxxxxxx>
>> wrote:
>> > Thanks for your answers. I've read the following thread:
>> > http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2011/02/msg00045.html
>> > What is in your opinion the best way to manipulate multidimensional
>> > arrays
>> > with Eigen?
>> >
>> > Yann
>> > ________________________________
>> >
>> > From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
>> > To: "eigen" <eigen@xxxxxxxxxxxxxxxxxxx>
>> > Sent: Wednesday, March 20, 2013 5:26:21 PM
>> >
>> > Subject: Re: [eigen] Is this a bug with Visual Studio ?
>> >
>> > This is indeed very experimental, and I doubt we can go very far
>> > without some significant change in the definitions of Scalar and
>> > RealScalar. In the meantime you can try to add :
>> >
>> >   static inline RealScalar epsilon() { return
>> > NumTraits<RealScalar>::epsilon(); }
>> >   static inline RealScalar dummy_precision() { return
>> > NumTraits<RealScalar>::dummy_precision(); }
>> >
>> > line 143 in src/Core/NumTraits.h
>> >
>> > and let us know how far you can go.
>> >
>> > gael
>> >
>> > On Wed, Mar 20, 2013 at 5:12 PM, Christoph Hertzberg
>> > <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>> >> On 20.03.2013 17:07, Yann Salaun wrote:
>> >>>
>> >>> No, actually I mean
>> >>>
>> >>> Array<ArrayXXcd, 1, Dynamic> foo;
>> >>>
>> >>> but I have the same error with the simpler case.
>> >>
>> >>
>> >> Arrays of Arrays (as well as Matrices of Matrices) are very
>> >> experimental
>> >> at
>> >> the moment. There is an ongoing discussion about sparse matrices
>> >> consisting
>> >> of block matrices here:
>> >>
>> >>
>> >> http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2013/03/msg00039.html
>> >>
>> >> Christoph
>> >>
>> >> --
>> >> ----------------------------------------------
>> >> Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
>> >> Cartesium 0.049
>> >> Universität Bremen
>> >> Enrique-Schmidt-Straße 5
>> >> 28359 Bremen
>> >>
>> >> Tel: +49 (421) 218-64252
>> >> ----------------------------------------------
>> >>
>> >>
>> >
>> >
>> >
>>
>>
>>
>
>



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