Re: LinearSolve - consumption time for square and rectangular matrices

*To*: mathgroup at smc.vnet.net*Subject*: [mg44027] Re: LinearSolve - consumption time for square and rectangular matrices*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Sat, 18 Oct 2003 03:12:20 -0400 (EDT)*Organization*: Universitaet Leipzig*References*: <bmodpc$hrf$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de*Sender*: owner-wri-mathgroup at wolfram.com

Hi, you should use a QR factorisation for nearly singular systems. And you should not get a solution at all for a singular system by LinearSolve[] Regards Jens Petr Kujan wrote: > > Hello MathGroup, > > I don't know about big difference in consumption time in LinearSolve[] > with square/rectangular matrices. > > I am using Mathematica 5.0, PC: Duron 750, W2k > > Here is example. > (*************************** > 1.) very fast: > input matrices are square {200,200} and rectangular {200,10} > > In[1]:= > *) > > SeedRandom[1]; > A = Table[Random[],{200},{200}]; > B = Table[Random[],{200},{10}]; > LinearSolve[A,B];//Timing > > (* > Out[1]= > {0.03 Second,Null} > > 2.) lots slower: > input matrices are rectangular {201,200}, {201,10} - Overdetermined > > In[2]:= > *) > > SeedRandom[1]; > A = Table[Random[],{201},{200}]; > B = Table[Random[],{201},{10}]; > LinearSolve[A,B];//Timing > > (* > Out[2]= > {0.761 Second,Null} > > In[3]:= > 0.761/.03 > > Out[3]= > 25.3667 > ***************************) > > I expect more difficult computation, but not so difficult. > > Where is problem? Exists some option Method for LinerSolve[] or another > trick? > > Thank in advance for all your help. > Best regards, > Petr.