Search code examples
matlaboctaveoperator-precedenceinverse

matlab and octave operator precedence of mldivide: a*A\b gives (a*A)^-1*b instead of a*inv(A)*b


Using Octave, with d*FT\N gives (d*FT)^-1*N instead of the expected d*(FT\N)

For a demo see http://tpcg.io/1En0tS

Is this the same in Matlab? If no, should I file a bug report?


Solution

  • The Octave behavior appears to match the Matlab documentation:

    Within each precedence level, operators have equal precedence and are evaluated from left to right.

    The multiplication and division operators are all in a single precedence level:

    Multiplication (.*), right division (./), left division (.\), matrix multiplication (*), matrix right division (/), matrix left division (\)