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

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

[Octave-bug-tracker] [bug #48564] Octave does not accept "1 / ND array",


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #48564] Octave does not accept "1 / ND array", "mrdivide (1, ND array)", "mldivide (ND array, 1)"
Date: Sun, 29 Jan 2017 20:14:21 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46

Follow-up Comment #9, bug #48564 (project octave):

Admittedly I've been including this patch in my mxe cross-builds ever since
July '16 but never came back to this bug report.

JWE noted additional tests are required as well.

AFAIR mldivide's behavior should still be patched as well, see comment #7. I
just checked this in Matlab r2017a prerelease:

>> format compact
>> A = rand (2, 2)
A =
    0.9572    0.8003
    0.4854    0.1419
>> 1/A
Error using  / 
Matrix dimensions must agree. 
>> mrdivide (1, A)
Error using  / 
Matrix dimensions must agree. 
>> mldivide (A, 1)
Error using  \ 
Matrix dimensions must agree. 
>>
>> B = rand (2, 2, 2)
B(:,:,1) =
    0.4218    0.7922
    0.9157    0.9595
B(:,:,2) =
    0.6557    0.8491
    0.0357    0.9340
>> 1/B
ans(:,:,1) =
    2.3710    1.2623
    1.0920    1.0422
ans(:,:,2) =
    1.5250    1.1777
   28.0020    1.0707
>> mrdivide (1, B)
ans(:,:,1) =
    2.3710    1.2623
    1.0920    1.0422
ans(:,:,2) =
    1.5250    1.1777
   28.0020    1.0707
>> mldivide (B, 1)
ans(:,:,1) =
    2.3710    1.2623
    1.0920    1.0422
ans(:,:,2) =
    1.5250    1.1777
   28.0020    1.0707
>> 



..while Octave (with John's patch) does:

>> format compact
>> A = rand (2,2 )
A =
   0.0056131   0.2872653
   0.2929287   0.0012764

>> 1/A
ans =
   178.1534     3.4811
     3.4138   783.4536

>> mrdivide (1, A)
ans =
   178.1534     3.4811
     3.4138   783.4536

>> mldivide (A, 1)
error: mldivide: operator \: nonconformant arguments (op1 is 2x2, op2 is 1x1)
>> 
>> B= rand(2,2,2)
B =
ans(:,:,1) =
   0.81579   0.11887
   0.17132   0.96621
ans(:,:,2) =
   0.042480   0.204788
   0.486795   0.743011

>> 1/B
ans =
ans(:,:,1) =
   1.2258   8.4122
   5.8371   1.0350
ans(:,:,2) =
   23.5404    4.8831
    2.0543    1.3459

>> mrdivide (1, B)
ans =
ans(:,:,1) =
   1.2258   8.4122
   5.8371   1.0350
ans(:,:,2) =
   23.5404    4.8831
    2.0543    1.3459

>> mldivide (B, 1)
error: mldivide: operator \: nonconformant arguments (op1 is 2x4, op2 is 1x1)
>>


(BTW where do those empty lines in Octave come from? they started appearing
some months ago)

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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