From bug-octave-request at octave dot org Mon May 3 09:38:07 2004 Subject: Re: bug in 2.1.57 From: David Bateman To: q127038 Cc: David Bateman , bug@octave.org Date: Mon, 3 May 2004 16:33:51 +0200 According to q127038 (on 05/03/04): > > > > there seems to be a bug in 2.1.57: > > > > > > octave-2.1.57:23> tic;j=1000;a=rand(j);b=rand(j,1);toc > > > ans = 0.19179 > > > octave-2.1.57:24> tic;c=b\a;toc > > > ans = 0.070998 > > > > > > b is a 1000x1 vector. It cannot end up in the denominator. > > > octave should complain about it. > > > > With matlab this gives > > > > >> tic;j=1000;a=rand(j);b=rand(j,1);toc > > > > elapsed_time = > > > > 0.0942 > > > > >> tic;c=b\a;toc > > > > elapsed_time = > > > > 0.1803 > > > > I don't see the problem with this formula... > > as I understand it: > > c=b\a > means basically > c=b^(-1)*a > b cannot be inverted as it has rank null due to the fact that it is a > jx1 matrix/vector. > Also the size rule does not fit: > b\a ==> [jx1] operates-with [jxj] >From "help -i operators" `X \ Y' Left division. This is conceptually equivalent to the expression inverse (x) * y but it is computed without forming the inverse of X. If the system is not square, or if the coefficient matrix is singular, a minimum norm solution is computed. As "b" is a 1000x1 matrix, although inverse(b) can't be calculated, in the context of this calculation it is the pseudo inverse and is 1x1000 and so there is no problem with the above... D. -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------