[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #55249] function ones does not always return a
[Octave-bug-tracker] [bug #55249] function ones does not always return a valid matrix
Wed, 19 Dec 2018 18:14:39 -0500 (EST)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Follow-up Comment #1, bug #55249 (project octave):
Thank you for the detailed bug report. What you are seeing is correct, but
Octave does this intentionally. When the function 'ones' is called as
'ones(1,N)' for any N, Octave intentionally returns a "range" type instead of
a fully allocated row vector. The "range" type is documented in the user
manual at http://octave.org/doc/interpreter/Ranges.html.
To force conversion of a range into a normal matrix variable, you can use any
of the following:
c = [c];
c = horzcat (c);
and other similar operations.
The range type is an intentional optimization that is supposed to save memory,
look like a matrix, and transparently expand itself to a matrix when needed.
Does this information address the issue for you, or do you still think that
this is a bug?
Reply to this item at:
Message sent via Savannah