[Pkg-octave-devel] Bug#295395: [OctDev] [dnj@x.dtu.dk: octave-forge: Replacing a submatrix of a sparse matrix results in a full matrix]

David Bateman David Bateman <David.Bateman@motorola.com>, 295395@bugs.debian.org
Sun, 27 Feb 2005 17:47:52 +0100


Rafael Laboissiere wrote:

>package octave-forge
>tags 295395 upstream
>forwarded 295395 octave-dev@lists.sourceforge.net
>thanks
>
>----- Forwarded message from Dennis J=F8rgensen <dnj@x.dtu.dk> -----
>
>From: Dennis J=F8rgensen <dnj@x.dtu.dk>
>Subject: octave-forge: Replacing a submatrix of a sparse matrix results =
in a full
> matrix
>Date: Tue, 15 Feb 2005 16:28:50 +0100
>To: Debian Bug Tracking System <submit@bugs.debian.org>
>
>Package: octave-forge
>Version: 2004.11.16-3
>Severity: normal
>
>
>With the following commands, I would have expected matrix A to
>stay sparse:
>
>octave:1> A =3D sparse(4,4);
>octave:2> A([1 2 4],[1 2 4]) =3D sprand(3,3,0.2);
>octave:3> issparse(A)
>ans =3D 0
>
>
>Same commands in Matlab:
>
>
> =20
>
>>>A =3D sparse(4,4);    =20
>>>A([1 2 4],[1 2 4]) =3D sprand(3,3,0.2);
>>>issparse(A)
>>>     =20
>>>
>
>ans =3D
>
>     1
>
>
>Replacing sprand() with something returning a full matrix yields
>the same results: sparse 'A' in Matlab, full in Octave.
>
>
>
>Regards,
>
>
>  Dennis J??rgensen
> =20
>

Yes, I know. This is what made me start writing the sparse matrix patch=20
that is currently in the unstable CVS of octave. I started to write a=20
patch to the assign functions for the sparse matrix code and quickly=20
found myself with 2,000 lines of code, and felt if I was going to do=20
that, that I might as well replace the whole thing. The good news is as=20
this was the problem that made me start writing this code, the assign=20
behaviour of the sparse matrices in the unstable octave CVS work as you=20
would expect.... Downside, is that I don't expect a patch for the=20
octave-forge version of the sparse matrix code, as it is completely=20
superseded by the version in octave itself..

D.