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

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

[Octave-bug-tracker] [bug #38466] incorrect broadcasting for 'a .*= b' w


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #38466] incorrect broadcasting for 'a .*= b' when b has fewer dimensions than a
Date: Fri, 8 Apr 2022 12:25:28 -0400 (EDT)

Follow-up Comment #15, bug #38466 (project octave):

This looks like a bad heisenbug. On Octave 8 (hg id ec5b57af230a) on Linux, I
get this error:


octave:1> clear all; a = ones(2, 2, 2); b = ones(2, 1); c = a .* b; assert
(all(a(:) == c(:))); a .*= b; assert (all(a(:) == c(:)))
error: .*=: nonconformant arguments (op1 is 2x2x2, op2 is 2x1)
octave:2>


I then added disp statements to confirm that the first operation was
succeeding, and the problem disappeared!

octave:2> clear all; a = ones(2, 2, 2); b = ones(2, 1); disp('First'); c = a
.* b; assert (all(a(:) == c(:))); disp('Second'); a .*= b; assert (all(a(:) ==
c(:))); disp('Third')
First
Second
Third
octave:3>


The same behavior happens if I mix and match the two statements in any order,
and is repeatable. The presence of the disp statements causes it to work
properly, and if not it causes an error. The first and third disp statements
can be removed but the second seems to be required.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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