Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2008-03-01 17:33:37


Am Samstag, 23. Februar 2008 23:41 schrieb Giuseppe Bilotta:
> Hello all,
>
> I was wondering if it was possible to 'decompose' a matrix into its
> diagonal and lower and upper triangles, in uBLAS.
>
> The idea would be, given some matrix M, to have some methods like
>
> M.diagonal()
>
> to return a diagonal_adaptor with the diagonal of M,
>
> M.lower_triangle()
> M.upper_triangle()
>
> to return triangular matrices of the appropriate type with the lower
> and upper triangles of the matrix M (thus excluding the diagonal of
> the matrix), in such a way that
>
> M = M.diagonal() + M.lower_triangle() + M.upper_triangle()
>
> Is there anything like this in uBLAS?

there are

triangular_adaptor and banded_adaptor

Thus it should be posible to write

M = matrix<...>(n,n);
L = triangular_adaptor<lower>(M);
D = banded_adaptor(M,0,0);
U = triangular_adaptor<upper>(M);

which satifies M == L + D + U;

(see triangular.hpp and banded.hpp)

mfg
Gunter