Wednesday, May 03, 2006

Upper Triangular Matrix

For allocating upper triangular matrix, we use the following technique

(Num) * ( Num -1 ) >> 1 + Num

where num is the number of dimensions of the matrix, what essentially this formulae does is m multiplying ( Num *Num -1 is always divisible by 2 and adding num gives the upper traingular matrix)

Nice trick for allocation of upper triangular matrix.

-Kalyan

No comments: