Boost logo

Ublas :

From: Anna.Maria.G_at_[hidden]
Date: 2005-03-31 11:24:59


Hi,
I have a Problem with submatrix. I heard it should work with project, but it
doesn't.

I have a matrix with a lot of Null-Elements, so I saved it as sparse_matrix
(or compressed_matrix). Now I want to take a part of this matrix.

For example

I have sparse_matrix<int, row_major> M1(n_rows,n_cols);

M1 = 1 0 0 4 0 0 3 0 0
0 2 0 0 0 5 0 0 2
1 0 0 0 0 5 0 0 0

and I need two matrices G1 and G2 (also sparse or compressed)

G1 = 1 0 0 G2 = 4 0 0 3 0 0
0 2 0 0 0 5 0 0 2
1 0 0 0 0 5 0 0 0

I tried to do it with "project", but it doesn't work (even with simply
matricies).

Is M1 defined as
matrix<int, row_major> M1(n_rows,n_cols-n_rows);

I can take a submatrix from M1 with:

for (i = 0; i < split_row; i++)
G1[i](range (0,G1.size2())) = M1[i](range (split_col-1,M1.size2()));

But it doesn't work with sparse_matrix.

Can somebody help me?

Thanks a lot,
Anna

--
Sparen beginnt mit GMX DSL: http://www.gmx.net/de/go/dsl