Slicing in sparse

David Bateman David.Bateman at motorola.com
Tue Dec 4 06:28:51 CST 2007


Kim Hansen wrote:
> On Dec 4, 2007 12:13 PM, David Bateman <David.Bateman at motorola.com> wrote:
>   
>> octave:3> x=ones([2 0]); x(1)=2
>> error: A(I) = X: unable to resize A
>> error: assignment failed, or no method for `matrix = scalar'
>> error: evaluating assignment expression near line 3, column 20
>> octave:3>  x=sparse(ones([2 0])); x(3,:)=2
>> x = Compressed Column Sparse (rows = 3, cols = 0, nnz = 0)
>>
>> octave:4>  x=ones([2 0]); x(3,:)=2
>> x = [](3x0)
>> octave:5>  x=sparse([]); x(3,:)=2
>> x =
>>
>> Compressed Column Sparse (rows = 3, cols = 1, nnz = 1)
>>
>>   (3, 1) ->  2
>>
>> which duplicates the matlab behavior.
>>     
>
> But is that a behaviour we want duplicated in Octave?
>
> I think it is dangerous to have different rules for sparse and full
> matrices combined with the auto conversion from sparse to full.
>
>   
Is it better to be consistent with full matrices or with matlab? At this
point I think it might be better to be consistent with matlab.

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