From help-request at octave dot org Sat Oct 1 04:23:34 2005 Subject: Re: generating sparse matricies From: avraham To: plrobert at ucsd dot edu Cc: soren at hauberg dot org, help-octave@bevo.che.wisc.edu Date: Sat, 1 Oct 2005 14:11:57 +0200 On Fri, Sep 30, 2005 at 11:07:31PM -0700, Paul Roberts wrote: > Hello, > > I am using Octave 2.1.64. I would like to iteratively build a sparse matrix > uring code like: > > X = sparse(10000,1000); > for j=1:1000 > X(:, j) = rand(10000,1) < 0.01; > end > > I have found however that when I try X(:,j) = rand(10000,1) < 0.01;, the > matrix X is converted to a full matrix. This happens even if I write: X(:,j) > = sparse(rand(10000,1) < 0.01); > > My questions are: (1) Will this be changed in future versions of Octave and > (2) is there an efficient work around for this issue? I have tried using > sphcat, but that seems to be very slow. > > Thanks! > > Paul Hello, I still have 2.1.64. Asking: help sprand I get: sprand is the user-defined function from the file /usr/share/octave/2.1.64/site/m/octave-forge/sparse/sprand.m Which means that you need octave-forge as well. Good luck, Avraham ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------