help on java

Discussion in 'Programmer's Corner' started by anmali, Nov 30, 2007.

  1. anmali

    Thread Starter New Member

    Oct 27, 2007
    1
    0
    Hello, I have a question in java. How would you store a lower triangular matrix EFFICIENTLY in a one dimensional array of size n(n+1)/2 and it stores the matrix row by row skipping the zeros above the diagonal i.e
    a(1,1),a(2,1)a(2,2),a(3,1)a(3,2)a(3,3)a(4,1)a(4,2)....a(n,n)

    oh btw the lower triangular matrix is something like this {{1,0,0},{2,3,0},{4,5,6}}


    any help would be really appreciated ...

    MANY MANY THANKS IN ADVANCE
     
Loading...