What should sparse([1])(2:end) be?

David Bateman David.Bateman at motorola.com
Tue Dec 11 07:59:34 CST 2007


Kim Hansen wrote:
> I had some code that started to break now that the auto converting
> from sparse to full has been removed. The code was:
>
> for x = xs(2:end)
>   ... work on x ...
> endfor
>
> The problem happens when xs is a single sparse number, then xs(2:end)
> will return a sparse [](0x1) instead of a [](1x0) when xs is full.
> This means that the for loop is executed with x=[] in the sparse case
> when it is skipped in the full case.
>
> I know that slicing sparse and full matrices different in some cases,
> but I can not recognise this as one of the cases that we have
> discussed. Is it possible to change sparse(1)(zeros(x,y)) to return
> zeros(x,y) when one of x or y is zero ?
>
> Regards,
>   
Could you give a more complete example so I can test what the compatible
behavior is?

D.

-- 
David Bateman                                David.Bateman at motorola.com
Motorola 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



More information about the Bug-octave mailing list