POV-Ray : Newsgroups : povray.binaries.utilities : Matrices.inc Server Time: 27 Jul 2017 22:49:43 GMT
  Matrices.inc (Message 1 to 2 of 2)  
From: Grassblade
Subject: Matrices.inc
Date: 13 Apr 2007 10:05:01
Message: <web.461f552bde2b404f16325b850@news.povray.org>
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.


Post a reply to this message


Attachments:
Download 'matrices.zip' (4 KB)

From: CShake
Subject: Re: Matrices.inc
Date: 9 Sep 2009 05: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.

CShake


Post a reply to this message


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

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