Boost logo

Ublas :

Subject: [ublas] wavefront index
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-08-29 09:06:10


Hi,

I need an idea for creating a upper or lower triangular matrix with
index positions. For example on 3x3 matrix with the indices [0,2]

        0 1 2 3 4 5
        --------------------------------
0 | - 1 0 0 1 0
1 | - 2 1 1 2
2 | - 0 2 2
3 | - 1 0
4 | - 2
5 | -

The same matrix with the index [0,3]

        0 1 2 3 4 5
        --------------------------------
0 | - 2 2 3 1 0
1 | - 3 3 0 2
2 | - 0 0 1
3 | - 1 1
4 | - 2
5 | -

I need at the end the index pairs for 0, 1, 2, 3 like:

0: (0,5), (1,4), (2,4), (2,3)
1: (0,4), (3,4), (2,5), (3,5)
2: (1,5), (0,2), (0,1), (4,5)
3: (0,3), (1,3), (1,2)

I can do it in a naive way, but I have large matrices, so I would do
this in a fast way. This structure is found in some "parallel numeric"
papers with the name "wavefront". Do you have any idea for creating
this structure in a fast way with boost? I have tested it with
std::multimap<std::size_t, std::pair<std::size_t, std::size_t> > but
I'm not satisfied.

I would appreciate to get some ideas or tips

Thanks

Phil