Boost logo

Ublas :

From: Dominik Szczerba (dominik_at_[hidden])
Date: 2008-09-01 16:28:24


On Monday 01 September 2008 10:22:01 pm Gunter Winkler wrote:
> Dominik Szczerba schrieb:
> > is it also available for small dense matrices?
>
> no - only sparse types can use a different index base. Why is such a
> feature important for dense matrices?

for the same reason as base index: notation compatibility (matlab, fortran)

> A workaround is to create a custom matrix class like
>
> // untested
> class my_matrix : public matrix<double> {
> ...
> const double & operator() (size_type i, size_type j) const {
> return matrix<double>::operator()(i-1, j-1);
> }

this will have quite some overhead for frequent calls, will it not?

>
> >>> - unfold a matrix into vector, like in matlab v=m(:)
> >>
> >> It's possible, though not 'officially' supported.
> >
> > any hint how? just referencing the first element of the matrix?
>
> Yes. You can always use &(v.data()[0]) to get a raw pointer to the data.

can I 'mount' or 'wrap' this pointer in a vector?

thanks a lot,
Dominik
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas

-- 
Dominik Szczerba, Ph.D.
Computational Physics Group
Foundation for Research on Information Technologies in Society
http://www.itis.ethz.ch