To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 14547
14546  |  14548
Subject: 
Another matrix inverse question
Newsgroups: 
lugnet.cad
Date: 
Tue, 10 Apr 2007 03:47:17 GMT
Viewed: 
1641 times
  
Hello,
I read James Reynolds' question about inverse matrices and the responses with
interest since I similar questions about matrix inverses.  I used Travis's
TCVector::invertMatrix code as the base for a Java function.  Other than the
change to Java and two-dimensional indices, it should be pretty much the same
function.  However, when I tried to use it in my program it didn't work right.
When I multiplied the original matrix by the inverse, the bottom row of the
product is not right.  I double- (and triple-) checked the adaptation but found
no problems.  I made a simpler test case and the output from it is this:

$ java Xform
x1
  1.5  0.0  0.0  0.0
  0.8  1.0  0.0  0.0
  0.0  0.0  3.0  0.0
  5.0  4.0  0.0  1.0
x1 inverse det: 0.22222222
  0.6666667  -0.0  0.0  0.0
  -0.53333336  1.0  -0.0  0.0
  0.0  -0.0  0.33333334  0.0
  -10.7  -4.0  -0.0  1.0
x1.postMultiply(x2)
  1.0  0.0  0.0  0.0
  0.0  1.0  0.0  0.0
  0.0  0.0  1.0  0.0
  -9.5  0.0  0.0  1.0

NOTE: According to http://www.concentric.net/~Ttwang/tech/javafloat.htm
"-0.0" is numerically identical to "0.0".

It seems that the bottom row of the product is the problem, so I rechecked the
statements that generate the left column of the inverse, but they look OK.  (I
think the left column of the inverse is the correct part to check for that
problem...)

If anyone (Travis?) is brave and/or energetic enough to look at the source code,
it is at http://zephyr.uvsc.edu/~brian/Xform.java

Please let me know if you have comments or suggestions.
Thanks,
Brian Durney



Message has 1 Reply:
  Re: Another matrix inverse question
 
(...) I think you've converted Travis' code properly, but just looking at the code, I'd say it's only intended to produce the inverse of the upper-left 3x3 matrix. None of the other rows or the determinant depend in any way on the 4th row, and it's (...) (17 years ago, 10-Apr-07, to lugnet.cad)

12 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR