sparse matrices - JAVA

Please help me out here

Consider a two dimensional lower triangular matrix:

8 0 0 0 0
9 11 0 0 0
4 2 -3 0 0
60 0 21 10 0
5 6 94 16 33

To save storage, this two-dimensional matrix may be saved as one dimensional array as shown:

8 9 11 4 2 -3 60 0 21 10 5 6 94 16 33

I want to devise a class to:

1.Store a two dimensional lower-triangular matrix as one dimensional matrix as shown above in order to save storage.

2.Add, subtract or multiplpy two lower-triangular matrices while using their one dimensional array equivalent.

The class needs to cope with 100 X 100 square matrices

Comments

  • Hi, I have analogical problem.

    Actualy, I need to create lower trianguar matrix on the following way:

    I have two arrays, which consists of nonzero elements of lower triangle matrix.

    A = [1 | 2 3 | 4 5 6 | 7 8 9 10]
    B = [1 | 1 1 | 1 1 1 | 1 1 1 1]

    Result matrix will show as following:

    |1 0 0 0 |
    C=|2 3 0 0 |
    |4 5 6 0 |
    |7 8 9 10|

    Thanks in advance!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion