[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60839] linsolve returns an incorrect solution
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #60839] linsolve returns an incorrect solution with an inconsistent system |
Date: |
Mon, 28 Jun 2021 02:43:19 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Edg/91.0.864.59 |
Update of bug #60839 (project octave):
Status: None => Invalid
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
See the documentation for `linsolve`:
>> With no options, this function is equivalent to the left division operator
(x = A \ b) or the matrix-left-divide function (x = mldivide (A, b)).
>> The optional second output R is the inverse condition number of A (zero if
matrix is singular).
And the documentation for `mldivide`:
>> If the system is not square, or if the coefficient matrix is singular, a
minimum norm solution is computed.
So what you are seeing is the expected result afaict.
You could check the second output argument of `linsolve` to query whether the
input matrix is singular.
For your example:
>> [S, R] =
linsolve([1.000,-1.000,1.000,1.000,-1.000;1.000,-1.000,-1.000,1.000,-1.000;1.000,-1.000,-1.000,1.000,-1.000;-1.000,-1.000,1.000,1.000,-1.000;-1.000,-1.000,1.000,-1.0
00,-1.000],[-1.000;-1.000;1.000;1.000;1.000])
warning: matrix singular to machine precision
warning: called from
linsolve at line 113 column 7
S =
-1.0000e+00
-2.5000e-01
-5.0000e-01
-2.5622e-16
-2.5000e-01
R = 0
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60839>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/