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

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

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Is this a bug with Visual Studio ?*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Wed, 20 Mar 2013 19:01:24 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=RZ3Dg3qD/g3j7KAKpaiQDWQN1H70ZaZ3M+u3RXt28gE=; b=G0bXRsHHD417Af2Lz8cRBnea+9YVS9OSf07hYEpquPapND+j/x9+v9MrfpY+VxZnUe adcbIQyvw01zkkx1pldgkip9cDPg33FXjcv6rOBxw1WCacG04XbrP5NXImngdDM6O8EI KOBNqoNU42VaEOM1rfJQM/nG8ksFu4tQ6ciM1E8vrwkbfCCqcUpA2BFCihnhiKxeSOsE o1tXPAOE7wYTyXVoQVI3Kzg6HG90BAW327iNqBXi5kPAD3tSoC4RVovjNZmMrqunu37t FRE6lOnyUkvoa3Nx1Y8BLDTop6G8o4QuT33BKLQf2SZ/PAkru3JSGRS8R6rsc97+h5b9 lFpQ==

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 >> >> ---------------------------------------------- >> >> >> >> >> > >> > >> > >> >> >> > >

**References**:**Re: [eigen] Is this a bug with Visual Studio ?***From:*Gael Guennebaud

**Re: [eigen] Is this a bug with Visual Studio ?***From:*Yann Salaun

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Student contribution proposal** - Next by Date:
**[eigen] [FAQ] how to have an initialized static Matrix** - Previous by thread:
**Re: [eigen] Is this a bug with Visual Studio ?** - Next by thread:
**[eigen] [FAQ] how to have an initialized static Matrix**

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