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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51880] sparse() ignores value of scalar colum


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #51880] sparse() ignores value of scalar column index input arg
Date: Tue, 29 Aug 2017 09:34:13 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #2, bug #51880 (project octave):

If I understand correctly, the xcidx vector has length nc+1 and with this
code, if the specified column is less than nc, then the remaining elements
would be uninitialized.  Is that OK?

Also, is there any check to ensure that c(0) > 0?  Maybe it can't be less than
zero since it is supposed to be an element of an index vector?

Anyway, I came up with this instead:


  xcidx (0) = 0;
  for (octave_idx_type j = 0; j < nc; j++)
    xcidx (j+1) = j >= c(0) ? new_nz : 0;


but I don't know whether it is correct to set all the remaining xcidx elements
to new_nz.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]