Boost logo

Ublas :

Subject: Re: [ublas] pointer to matrix structure
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2011-08-08 11:53:17

Am 08.08.2011 um 14:14 schrieb Marcel Rehberg:

> On Mon, 08 Aug 2011 11:41:31 +0200, Kraus Philipp <philipp.kraus_at_[hidden]> wrote:
>> Am 08.08.2011 um 11:20 schrieb Marcel Rehberg:
>>> Right, this would copy the data. What I meant was to use ublas::<T,ublas::column_major> for your original matrix, right from the beginning.
>>> It does not make a difference from the ublas interface point of view. So it wouldn't require any code changes except in the definition of the matrices*. To make things easier you could use a typedef like
>> I think there is a difference: I read the matrix data often in the row-order, a loop over the rows and a inner loop over the columns, so if I use a column-major the loops must / should be changed. If I use a column-major matrix and iterate first over the rows and with the inner loop over the columns, it can be create a poor performance, so I would like to have a row-major matrix.
> Ah sorry, I wasn't even aware of the performance penalty* and I don't know a way to avoid it. My approach would be to choose the ordering based on what is the most time or memory consuming operation. In my case I use lapack quite allot and so I went with ublas::column_major just to avoid the copying. Sorry that I can't help more.

Thanks for your idea, at this time my code works with calling the ctor, but I think this isn't a good solution.