Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'sparse arrays' topicStudent Support Forum > General > "sparse arrays"

Help | Reply To Topic
Author Comment/Response
Hosam
09/28/11 6:59pm

Why doesn't this attempt at creating a sparse matrix from a dense one work?

SparseArray[{i_Integer, j_Integer} /; Part[J, i, j] >= 0.1 :>
Part[J, i, j], {Num,Num}];

The i,j element of the original Num x Num matrix J is Exp[-(Norm[x[[i]] - x[[j]]])^2/range^2],

where x is linked to a two dimensional metric (if that helps), so the matrix is almost band diagonal.

What I want to do is essentially floor out elements that are smaller than my threshhold and then construct a sparse matrix from the leftover.

Any help is appreciated, thanks.

URL: ,
Help | Reply To Topic