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

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

[Octave-bug-tracker] [bug #62291] "zeros" with vector input is incompati


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #62291] "zeros" with vector input is incompatible with Matlab
Date: Mon, 11 Apr 2022 22:11:53 -0400 (EDT)

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

trying a few other options in octave:


zeros (1, [1 2 3])
ans = 0

zeros (1, [2 3])
ans = 
  0  0

zeros (1, [5 4 2])
  0  0  0  0  0


so seems like octave is just taking input_two(1) for the second term and
ignoring what follows.

I disagree with comment #0 that zeros (1, 1:10) should give you the same
output as zeros(1,10).  vector inputs should only be valid with a single input
( zeros([1 3 4]) = zeros(1,3,4).  mixing scalar and vector inputs is
ambiguous.  for zeros(1,1:10), how should octave determine from [1 2 3 4 5 6 7
8 9 10] that it is to use 10 as the second input?  

If anything, I could see it be consistent with other usage and easily
deterministic for zeros(1, [2 3]) to be equivalent to zeros(1, 2, 3), and I
would even find it quite convenient at times.  But I could see that resulting
in quite a few user errors, and is a bit beyond scope of this report. 

I agree that an error message for nonscalars when nargin>1 makes the most
sense. 


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62291>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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