Behaviour of backslash operator for non-square matrices least-squares fitting
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Matt O'Donnell
am 24 Feb. 2020
Kommentiert: Matt O'Donnell
am 24 Feb. 2020
I am currently trying to reproduce a set of results from a pre-existing project and can't get to the bottom of the following difference.
Phi = design matrix of input data size(29507x97)
Ref = reference values to fit to, six data sets, size(29507x6)
Phi = rand(29507,97);
Ref = rand(29507,6);
c1 = Phi\Ref;
for ii = 1:6
c2(:,ii) = Phi\Ref(:,ii);
end
all(all(c1==c2))
I would have expected c1 to give identical results to c2. I can't find detailed information on what the "\" algorithm is doing differently between these case.
Any help appreciated!
0 Kommentare
Akzeptierte Antwort
the cyclist
am 24 Feb. 2020
They are equal, to within floating-point precision. Notice that
max(abs(c1(:)-c2(:)))
is around 1e-16.
4 Kommentare
Matt J
am 24 Feb. 2020
Bearbeitet: Matt J
am 24 Feb. 2020
Also, internal parallelization of mldivide and other linear algebra operations is different depending on the size of the inputs. So, when you perform the mldivide column-by-column, the inputs are divided up into parallel chunks in a different way, leading to floating point differences.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!