Mon 06 Nov 2017 02:19:44 PM UTC, comment #13:
I wonder if it mostly depends on what version of gcc/glibc MW used to compiled a particular version....
Dmitri.


Mon 06 Nov 2017 08:42:35 AM UTC, comment #12:
I confirm all NaNs for the example in comment #9

Mon 06 Nov 2017 05:43:05 AM UTC, comment #11:
I also get the allnanswithzeroinlowerright result on 2008b. But strangely on 2014a, I get all nans:

Sat 04 Nov 2017 09:32:18 PM UTC, comment #10:
Rik,And you thought you could not have it both ways:
>> inv (repmat (Inf, [2,2]))
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND =
NaN.
ans =
NaN NaN
NaN 0
>> version
ans =
'9.3.0.713579 (R2017b)'
>>

Sat 04 Nov 2017 08:23:59 PM UTC, comment #9:
The number of corner cases is just ridiculous. What does Matlab return for
I'm guessing it is either all zeros or all NaNs.

Sat 04 Nov 2017 10:05:01 AM UTC, comment #8:
>> inv (complex (0,0))
Warning: Matrix is singular to working precision.
ans =
Inf
>> version
ans =
'9.3.0.713579 (R2017b)'
>>

Sat 04 Nov 2017 04:20:08 AM UTC, comment #7:
@Colin: Can you check this corner case?
In Octave the result is strange
I think better thing would be to do automatic narrowing before calling inv() so that the result would be Inf.

Fri 03 Nov 2017 09:32:56 PM UTC, comment #6:
Yes your guess is correct: Matlab gives the 2x2 matrix of Infs.

Fri 03 Nov 2017 03:52:39 PM UTC, comment #5:
Another test case that needs to be run through Matlab
In Octave, this produces a special Diagonal matrix with Inf only on the diagonal.
On the other hand, my guess is that Matlab will return all Inf as in

Wed 01 Nov 2017 11:01:08 PM UTC, comment #4:
I stepped through the code in dMatrix.cc and in fact the MatrixType is set to Diagonal for the case of a scalar. It looks like the general question is why there isn't an early decision to take care of diagonal matrices which would be very easy
Find attached a quick test (inv.diff). It seems to pass "make check" with no problems. To be complete there should also be some BIST tests for the correct behavior of scalars of all types (double, single, double complex, single complex) with respect to the various operations '1 / x', 'inv (x)', x^1, 'pinv (x)'.
(file #42320)

Mon 30 Oct 2017 10:49:42 AM UTC, comment #3:
The problem is around line 646 of dMatrix.cc. If the condition number is zero, any result is set Inf, except for the (numel() == 1 ) case. What was the purpose of such an explicit exclusion?
I have a more general question: why a scalar is treated as a full matrix and not (at least) as a triangular matrix?

Thu 26 Oct 2017 03:24:56 PM UTC, comment #2:
There have been some previous reports on this.
See bug #49690: inv(inf) behaves differently from inf^1, 1/inf, inf\1
See bug #51246: pinv(0) different from Matlab
As of 10/26/17 and hg id 857b553177a5, I get
The only problem is 'inv (0)'.

Thu 26 Oct 2017 09:22:38 AM UTC, comment #1:
Another edge case:
That should be 0.

Thu 26 Oct 2017 08:20:24 AM UTC, original submission:
That should be "Inf" (e.g., in 4.2.1).
I think it changed sometime in the last few months but I have not bisected it yet to be sure.
