Re: Newbie question: big matrix calculations
- To: mathgroup at smc.vnet.net
- Subject: [mg9322] Re: Newbie question: big matrix calculations
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Mon, 27 Oct 1997 02:47:38 -0500
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
Dennis Wayne Scott wrote: > > This is the first time I've ever been in this newsgroup, so please try > to excuse anything I do/say that's silly to the experts... > > I have three 100x100 sparse (diagonal) matrices (matrxD, matrxU, and > matrxL) and three 100x1 matrices (b, x2, and x1), and I'm performing > several operation on them: > > x2 = -Inverse[matrxD].(matrxL+matrxU).x1+Inverse[matrxD].b; You are effectively finding the fixed point: FixedPoint[Inverse[matrixD] . (b - (matrixL + matrixU) . #) & , x1, SameTest -> (Max[Abs[#2 - #1]] < 1/10^5 & )] {1.19247,1.65412,1.62856,1.27819,0.711273} This is considerably faster because you only compute Inverse[matrixD] once (rather than twice each iteration). Note that you get a further speed up if your initial guess is numerical (floating point) rather than exact. However, for this problem, rearranging the matrix equations permits exact solution: N[Inverse[matrixD + (matrixL + matrixU)] . b] {1.19248,1.65414,1.62857,1.2782,0.711278} This is very fast even for 100x100 matrices! Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________