octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #36385] indexing of sparse matrix by a matrix

 From: jan pfaler Subject: [Octave-bug-tracker] [bug #36385] indexing of sparse matrix by a matrix in 3.2.4 Date: Thu, 03 May 2012 14:22:38 +0000 User-agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/12.04 Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19

```URL:
<http://savannah.gnu.org/bugs/?36385>

Summary: indexing of sparse matrix by a matrix in 3.2.4
Project: GNU Octave
Submitted by: jan
Submitted on: Thu 03 May 2012 02:22:38 PM GMT
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: jan
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 3.2.4
Operating System: GNU/Linux

_______________________________________________________

Details:

Dear Community,

In 3.2.4 indexing of sparse vector using an non-vector array produces a matrix
of expected size, but with only first row in indexing matrix being taken into
account. Example 1 below is expected to produce equal a and b, but only
realizes the first of a.

For ndx (row or column) vector, the result is fine, as well as for both val
and ndx being matrices, see Example 2.

*Example 1

val = 1:10;
ndx = [1:3;7:9],
sval = sparse(val);
a = full(sval(ndx)),
b = val(ndx)

ndx =
1   2   3
7   8   9
a =
7   8   9
0   0   0
b =
1   2   3
7   8   9

*Example 2

ndx = [1:3;7:9],
val = [1:10;11:20]';
sval = sparse(val);
a = full(sval(ndx)),
b = val(ndx)

ndx =
1   2   3
7   8   9
a =
1   2   3
7   8   9
b =
1   2   3
7   8   9

Best Regards,
jan

_______________________________________________________

<http://savannah.gnu.org/bugs/?36385>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```