|
It is now almost 7 years later, I totally agree with Ofek (why require more memory when the user *knows* the actual memory upperbound), but still no fix in Matlab :-(
Time for a *BUMP*. Please?
Thanks,
Paul
"Penny Anderson" <no.spam.for.me@nospam.org> wrote in message <d6ia15$683$1@fred.mathworks.com>...
> Ofek,
>
> The algorithm is naively using a default nzmax=max([length(i) length(j)
> length(s)]) and if you specify nzmax less than this, it simply errors. We
> can work on this.
>
> Penny Anderson
> The MathWorks, Inc.
>
> "Ofek Shilon" <ofek@simbionix.com> wrote in message
> news:1116484617.460575.323190@g47g2000cwa.googlegroups.com...
> Penny,
>
> Thanks for the reply. So it is indeed an allocation implementation
> issue and not a simple bug in the syntax check?
>
> Ofek
>
>
> Penny Anderson wrote:
> > Ofek,
> >
> > I agree with you and I actually added it to our enhancement database
> 6
> > months ago (see how prescient I am ;-). However, there is no promise
> that we
> > will implement this new behavior for sparse.
> >
> > Penny Anderson
> > The MathWorks, Inc.
> >
> > "Ofek Shilon" <ofek@simbionix.com> wrote in message
> > news:1116440995.308920.9610@g44g2000cwa.googlegroups.com...
> > Hi Titus
> > I disagree also.
> > The syntax for the 'sparse' command is designed to enable
> accomulation.
> > When sparse encounters repeated couples of indices in i & j,
> according
> > to its documentation and indeed its behavior, the formed matrix
> > accumulates the values in the repeated locations adding them to the
> > previous ones it encountered. Check again that -
> > A=sparse([1,1],[1,1],[1,2])
> > gives the result -
> > A =
> > (1,1) 3
> > that is, a 1x1 matrix, although i and j are of length 2 (that is the
> > most minimalistic example of this useful feature).
> > Now in my real life situation i need to accumulate a very large
> amount
> > of data into a relatively small sparse matrix. To allocate memory by
> > the size of the accumulating vectors i,j & s would be both
> disasterous
> > to the performence and comletely unnecessary.
> > A possible explanation to the situation is that the implementation of
> > the built-in 'sparse' caches the entire accumulated data into the
> > designated storage prior to arranging (and squeezing) it, but that
> > seems extremely wasteful and very untypical to the mathworks guys. A
> > more probable explanation (IMHO) is just an irrelevant check of the
> > data, i.e., a bug.
> >
> > is there anyone from the mathworks around, who can say what's
> happening
> > inside there?
> >
> > Ofek
> >
> >
> >
> >
> > Hi Ofek,
> >
> > I disagree: nzmax is the number of non zero entries, i.e., it need to
> > be
> > always at least the length of i, j and s (and usually is length(i)).
> > I admit, the routine could error out with a "better" error message,
> > when nzmax<numel(i).
> > The reason for the parameter nzmax is to give the user the
> possibility
> > to tell the sparse, that you are going to add some elements later
> (and
> > want to reserve the memory already at construction).
> >
> >
> > Titus
> >
> >
> > "Ofek Shilon" <o...@simbionix.com> schrieb im Newsbeitrag
> > news:1116427512.377765.120370@o13g2000cwo.googlegroups.com...
> >
> >
> > seems like a bug to me. theres no reason that i can thing of to halt
> > the execution of A=sparse([1,1],[1,1],[1,2],1,1,1) . nzmax
> should
> > be
> > compared to the product max(i)*max(j) (my original post had a typo
> > there). i had quite a bad time locating this particular 'feature'
> in
> > my program - the example i gave is a simplified one, of course.
> > Ofek
> >
> > Titus Edelhofer May 18, 7:31 am show options
> > Newsgroups: comp.soft-sys.matlab
> > From: "Titus Edelhofer" <titus.edelho...@mathworks.de> - Find
> messages
> > by this author
> > Date: Wed, 18 May 2005 13:31:34 +0200
> > Local: Wed,May 18 2005 7:31 am
> > Subject: Re: sparse matrix bug?
> > Hi,
> > this is not a bug, you may call it "not too
> > descriptive error message".
> > Try
> > A=sparse([1,1],[1,1],[1,2],1,1,2)
> > instead... ;-)
> > Titus
> >
> > "Ofek Shilon" <o...@simbionix.com> schrieb im Newsbeitrag
> > news:1116415617.514627.64740@f14g2000cwb.googlegroups.com...
> > > take a very simple accumulating sparse-matrix generation:
> > > A=sparse([1,1],[1,1],[1,2])
> > > No problem:
> > > A =
> > > (1,1) 3
> > > However, while trying to declare the space to allocate:
> > > A=sparse([1,1],[1,1],[1,2],1,1,1)
> > > I get the very annoying:
> > > ??? Error using ==> sparse
> > > Index exceeds matrix dimensions.
> > > which seems like an obvious bug. Is it possible that while
> analyzing
> > > the syntax 'sparse(i,j,s,n,m,nzmax)' matlab checks nzmax versus
> > > numel(i) | numel(j) , instead of versus max(i)|max(j) ?
>
>
|