Using diagonal matrix as index

Søren Hauberg soren at hauberg.org
Fri Jan 9 15:24:42 CST 2009


Hi,
  With a recent checkout I get the following IMHO quite odd behaviour:

octave:18> A = magic (5)
A =

   17   24    1    8   15
   23    5    7   14   16
    4    6   13   20   22
   10   12   19   21    3
   11   18   25    2    9

octave:19> A (diag (true (1, 4))) = 4
A =

    4    4    4    4   15
   23    5    7   14   16
    4    6   13   20   22
   10   12   19   21    3
   11   18   25    2    9

Shouldn't this have produced an error since I'm using a 4x4 matrix as
index in a 5x5 matrix? Also, why are the elements placed in first row,
instead of along the diagonal?

Søren



More information about the Bug-octave mailing list