[Numpy-discussion] triangular matrix fill

Tom Waite twaite@berkeley....
Thu May 22 20:19:22 CDT 2008

I have a question on filling a lower triangular matrix using numpy. This
is essentially having two loops and the inner loop upper limit is the
outer loop current index. In the inner loop I have a vector being
multiplied by a constant set in the outer loop. For a matrix N*N in size,
the C the code is:

for(i = 0; i < N; ++i){
    for(j = 0; j < i; ++j){
        Matrix[i*N + j] = V1[i] * V2[j];


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080522/915efc36/attachment-0001.html 

More information about the Numpy-discussion mailing list