Slicing in sparse
Kim Hansen
kimhanse at gmail.com
Tue Dec 4 05:58:44 CST 2007
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.
--
Kim Hansen
Vadgårdsvej 3, 2.tv
2860 Søborg
Fastnet: 3956 2437 -- Mobil: 3091 2437
More information about the Bug-octave
mailing list