Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Sparse matrix indexing speed -- shape sensitivity
Date: Mon, 29 Aug 2011 19:07:27 +0000 (UTC)
Organization: Xoran Technologies
Lines: 24
Message-ID: <j3go1f$j31$1@newscl01ah.mathworks.com>
References: <j3bumn$9ts$1@newscl01ah.mathworks.com> <j3cqer$o66$1@newscl01ah.mathworks.com> <j3df6i$jnq$1@newscl01ah.mathworks.com> <j3dftj$lkh$1@newscl01ah.mathworks.com> <j3dk7r$3mp$1@newscl01ah.mathworks.com> <j3dtcs$rjq$1@newscl01ah.mathworks.com> <j3efp3$h5h$1@newscl01ah.mathworks.com> <j3g9a9$rf1$1@newscl01ah.mathworks.com> <j3ga5n$194$1@newscl01ah.mathworks.com> <j3gbfp$63s$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1314644847 19553 172.30.248.46 (29 Aug 2011 19:07:27 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Aug 2011 19:07:27 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:741625

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <j3gbfp$63s$1@newscl01ah.mathworks.com>...
>
> But your argument does not hold to my book. I'm talking about the limitation due to overflow when switching from multi-indexes to linear index.
>[snip] 
> In the case of ndsparse, the product of n-1 first dimension must be reasonably small, even if the computer RAM is infinity, which is much more restrictive. This is flawed due to the software design rather than hardware limitation.
====================

That's all true, but again it's true of normal MATLAB sparse matrices as well. :-)

If you like, you can consider the purpose of ndSparse as something that allows you to start with a normal 2D MATLAB sparse matrix and then reshape it in N dimensions. All the same limitations on reshaping and indexing that are present in ndSparse are due to limitations already present in normal matrices.


> In Matlab sparse, each dimension can go up reasonably to 1e7, and it can goes to 1e9 if the RAM is big enough.
====================

So, yes, what you're effectively saying here is that you would have hoped for better from ndSparse and that's fine. 

But I could equally well hope that the following normal sparse matrix, which is full of only zeros wouldn't take up 400 MB of storage, and that I could reshape it to my liking.

>> A=sparse(1e9,1e8);
>> A(:);
??? Matrix is too large to convert to linear index.

I could even call these things software design limitations (the 400MB surely is), but of course I know that there are trade-offs involved...