We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Invertion of A Matrix
Page Index Toggle Pages: 1
Invertion of A Matrix (Read 861 times)
Invertion of A Matrix
Jul 5th, 2007, 3:24pm
 
hi all,

currently im working on a project with 2D matrices and i really need the inversion of a matrix. i have found a java class which is supposed to work "out of the box" in Pro:

http://www.ee.ucl.ac.uk/~mflanaga/java/Matrix.java
(is the class)

http://www.ee.ucl.ac.uk/~mflanaga/java/Matrix.html#class
(this is the index of the class, if you notice at the bottom it notes "This class uses the following classes in this library:None")

but when i try to construct a matrix its giving me errors. I assumed that it might be a complementary class of flanagan.math.*(http://www.ee.ucl.ac.uk/~mflanaga/java/index.html#down) which i have imported into processing as well, but nothing...

Is there any chance that Processing doesn't support this class or am i making a newbie's mistake and thats why it doesn't work???

thanxx,
alekuh
Re: Invertion of A Matrix
Reply #1 - Jul 5th, 2007, 7:01pm
 
for what ive seen it isnt difficult to use that class..
this should work:


// create a square 4x4 matrix
Matrix m = new Matrix( 4, 4 );
m.inverse();

in a orthogonal system you could just use transpose(), which gives you the inverse of a matrix aswell. and less calculations involved.
Re: Inversion of A Matrix
Reply #2 - Jul 5th, 2007, 7:24pm
 
thanx a lot crmx,

now the problem is that it keeps giving me :

java.lang.UnsupportedClassVersionError: flanagan/math/Matrix (Unsupported major.minor version 49.0)

this means that i miss a java version(i already have tried with JDK). if yes what should i download from java?

alekuh
Re: Invertion of A Matrix
Reply #3 - Jul 5th, 2007, 8:57pm
 
That error means the library needs Java 1.5 and Processing comes with Java 1.4

To use it you'll need to change the version of Java the Processing uses.

You've got 2 options, either get the "without Java" version and have 1.5 (or 1.6) installed on your system as the default Java system. Or, get a 1.5/6 JRE and replace the java directory in the processing folder with it. (The folder has to be called "java" not "jre_1_5_0_6" or whatever.)
Inversion of A Matrix
Reply #4 - Jul 5th, 2007, 9:35pm
 
Done!

i tried the 1st option(withoutJAVA processing 124 and installed the 1.5JRE myself)and works. I will try the second one after i finished my thing now and i'll post it in order for other people to know because the library is really complete for calculations with matrices and arrays.

thanxxx
JohnG rules...

Page Index Toggle Pages: 1