POV-Ray : Newsgroups : povray.binaries.utilities : Matrices.inc : Re: Matrices.inc Server Time
24 Feb 2024 17:41:04 EST (-0500)
  Re: Matrices.inc  
From: CShake
Date: 9 Sep 2009 01:25:41
Message: <4aa73c55$1@news.povray.org>
Grassblade wrote:
> Not finished yet, but my coding skill isn't good enough to complete this
> yet. Contains generalised inversion, which can invert singular or
> rectangular matrices, plus basic operations.

Glad I found this, I was about to write my own versions for a current 
project. Anyway, I updated your version to fix a few declare/local bugs, 
added the 'rowappend' you left as todo, and added a few new useful 
functions - Swap rows, Multiply row, Reduced Row Echelon Form, and 
Gauss-Jordan Matrix Inversion.

While the Moore-Penrose generalized inversion is versatile, it is quite 
slow. The Gauss-Jordan inversion only works on non-singular square 
matrices, but is much faster with those. Tests of 10000 iterations of 
each for a simple matrix (the example on 
http://en.wikipedia.org/wiki/Gauss%E2%80%93Jordan_elimination) showed 
that the MPGinverse was a little more than 7.5 times slower than GJinverse.
Actual results:
10000 iterations, 3x3 simple matrix {{2,-1,0},{-1,2,-1},{0,-1,2}}
GJinverse 18.515 cpu-seconds
MPGinverse 141.328 cpu-seconds

If you're still around, and don't see a problem with it, I think this 
would be a good addition to the Object Collection with a few updates to 
the naming scheme.


Post a reply to this message

Download 'matrices.inc.txt' (23 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.