|
From: | David Bateman |
Subject: | Re: [Chanegset]: Re: cat does not convert sparse matrices? |
Date: | Thu, 18 Sep 2008 17:03:32 +0200 |
User-agent: | Thunderbird 2.0.0.16 (X11/20080725) |
David Bateman wrote:
dbateman wrote:In fact I think I see two bugs here Francesco Potorti`-2 wrote:In Octave 3.0.1, I cannot catenate a full double matrix with a sparse logical matrix. Is this normal or a bug? octave> a=zeros(3,3,0); octave> b1=zeros(3,3); octave> b2=sparse(1,1,true,3,3); octave> whos a b1 b2 *** local user variables: Prot Name Size Bytes Class==== ==== ==== ===== ===== rwd a 3x3x0 0 doublerwd b1 3x3 72 double rwd b2 3x3 21 logical Total is 10 elements using 93 bytes octave> size(cat(3,a,b1)) ans = 3 3 1Trailing singleton dimensions should be dropped, So I suspect there is a function call missing in the cat function that should do this.The attached patch addresses this, butoctave> size(cat(3,a,b2)) error: invalid conversion of NDArray to Matrix error: range error for insert error: evaluating argument list element number 1The sparse logical matrix should be promoted to a sparse matrix and the concatenation allowed. Ok, I'll look at this wen I'm on a development machine.It seems I missed the point you made by this one.. Sparse logical matrices are promoted to sparse double matrices before concatenation with another double matrix. The issue above is that a 3x3x0 is an NDArray and the Sparse matrix type only supports 2D arrays and so the conversion of the 3x3x0 array to a sparse matrices prior to the concatenation fails. It would be interesting to know what matlab does in this case, as I suspect it fails as well. If it doesn't then I suppose we need to special case for this.
For this case in MatlabR2007b >> cat(3,zeros(2,2,0),speye(2)) ??? Error using ==> cat CAT arguments dimensions are not consistent. So it seems they don't support this either.. D. -- David Bateman address@hiddenMotorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob) 91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax) The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary
[Prev in Thread] | Current Thread | [Next in Thread] |