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$>
References: <j3bumn$9ts$> <j3cqer$o66$> <j3df6i$jnq$> <j3dftj$lkh$> <j3dk7r$3mp$> <j3dtcs$rjq$> <j3efp3$h5h$> <j3g9a9$rf1$> <j3ga5n$194$> <j3gbfp$63s$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1314644847 19553 (29 Aug 2011 19:07:27 GMT)
NNTP-Posting-Date: Mon, 29 Aug 2011 19:07:27 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:741625

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <j3gbfp$63s$>...
> 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.
> 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...