Boost logo

Ublas :

Subject: Re: [ublas] pointer to matrix structure
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2011-08-08 05:03:20


Am 08.08.2011 um 10:37 schrieb Marcel Rehberg:

> Hi,
>
> On Sun, 07 Aug 2011 22:38:26 +0200, Philipp Kraus <philipp.kraus_at_[hidden]> wrote:
>
>> I have found a solution with this:
>>
>> ublas::matrix<T> x = ublas::trans(p_dataset);
>> write( &(x.data()[0]), p_datatype, l_dataspace );
>>
>> but can I change it without the transpose, because p_dataset is a very large matrix? The write method is a library function that writes my matrix data, but the write method need a "column oriantated array structure", but my p_dataset input matrix is a row oriantated matrix.
>
> You could use
>
> ublas::matrix<T,ublas::column_major> X
>
> as your main matrix type. I use it to interface lapack which also expects column orientation.

I use ublas;;row_major matrices primary. Do I need convert the matrix like:

ublas::<T, ublas::column_major> x = my_row_major_matrix;
write( &(x.data()[0]) ...)

?

Because on this the copy-constructor will be called and I create a full matrix clone. My matrix is large (around 10^7 - 10^9 (non-zero) elements so I wouln't copy the data)

Thanks

Phil