Boost logo

Ublas :

Subject: Re: [ublas] symmetric matrices, row and column-major
From: Tiago Requeijo (tiago.requeijo.dev_at_[hidden])
Date: 2009-02-24 15:18:58


There is definitely something wrong. I just finished recompiling my program
with boost 1.32, 1.37 and 1.38.

Versions 1.37 and 1.38 have the problem I described above (ublas::lower,
ublas::upper have no impact on the storage, it seems lower storage is always
used). Version 1.32 returns the expected behavior.

I will check the code in transposed_structure::element() and
triangular_type::element(...), and report back as soon as I find what's
breaking this.

On Tue, Feb 24, 2009 at 2:11 PM, Gunter Winkler <guwi17_at_[hidden]> wrote:

> Tiago Requeijo schrieb:
> > I'm having a problem with row and column major in symmetric matrices.
> > I'm probably not understanding correctly how the storage takes place
> > in memory. I assumed upper+column_major storage was the same as
> > lower+row_major. Here's an example:
>
> The mapping from (i,j) to storage location is defined in
> basic_row_major::lower_element and basic_row_major::upper_element (see
> functional.hpp).
>
> symmetric_matrix::operator(i,j) uses the triangular_type::element(...)
> method to dispatch to the corresponding storage mapping from the layout
> type (row major/column major). Maybe this mapping does not work as
> expected.
>
> I recently introduced the transposed_structure template to reduce the
> number of implementations for the diffentent triangular types. Can you
> check if the problem is caused by a wrong implementation of
> transposed_structure::element()?
>
> > Upper part of the symmetric matrix:
> >
> > 0.34 0.9 1.17 0.689 1.42
> > ---- 1.36 0.9 0.808 0.146
> > ---- ---- 0.572 1.55 1.61
> > ---- ---- ---- 0.093 1.32
> > ---- ---- ---- ---- 0.828
> >
> >
> > ublas::symmetric_matrix<double, ublas::upper, ublas::column_major> S
> > double* a = &(S.data()[0]);
> > ublas::symmetric_matrix<double, ublas::lower, ublas::column_major> S2
> > double* a2 = &(S2.data()[0]);
> >
> > Contents of a, a2:
> > 0.34 0.9 1.17 0.689 1.42 1.36 0.9 0.808
> > 0.146 0.572 1.55 1.61 0.093 1.32 0.828
> >
> This seems to be wrong ...
>
> mfg
> Gunter
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
>