Thanks, Roger. I wanted to make sure that I had not missed an idiom.
It is unlikely that the current performance will prove inadequate: almost any operation one does on such a matrix is likely to be much more expensive in time and space. Best wishes, John Roger Hui wrote: > That is the way to do it. > > The approach is this: that expression is the most "natural" way > in J to do the task. If the current performance proves to be > inadequate then we can try to improve the implementation, rather > than invent some alternative (such as another primitive or m!:n). > > > > ----- Original Message ----- > From: "John Randall" <[EMAIL PROTECTED]> > To: "Programming forum" <[email protected]> > Sent: Thursday, April 06, 2006 3:08 PM > Subject: Re: [Jprogramming] Padding a matrix > > Thanks to all for your comments on this. > > Here's a related problem. Suppose I have a sparse matrix m. I can get > the index array i and value list x using > > i=:4 $. m > x=:5 $. m > > How do you do the reverse, that is, amend an initially empty sparse matrix > m with these indices and values? > > I am currently using > > x (<"1 i) } m > > but I fear this reflects my ignorance. > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
