View Issue Details

IDProjectCategoryView StatusLast Update
0000856FreeCADBugpublic2012-10-22 12:22
Reporterwmayer Assigned To 
PriorityurgentSeveritymajorReproducibilityhave not tried
Status closedResolutionfixed 
Fixed in Version0.13 
Summary0000856: Wrong inverse of a matrix
DescriptionThere must be a heavy bug in the calculation of the inverse of a matrix.
Example:

m=App.Matrix(4.,2.,1.,0.,1.,1.,1.,0.,0.,0.,1.,0.,0.,0.,0.,1.)
i=m.inverse()
m.multiply(i) # this is not the unity matrix !!!

c=App.Matrix(0.5,-1.,0.5,0.,-0.5,2.,-1.5,0.,0.,0.,1.,0.,0.,0.,0.,1.)
m.multiply(c)
TagsNo tags attached.
FreeCAD Information

Activities

wmayer

2012-10-22 11:14

administrator   ~0002462

But:
m=App.Matrix(0.,0.,1.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,0.,1.)
m.determinant() # = 1.0
m.multiply(m.inverse()) # correct

So, it seems the algorithm only works if det(M)==1

wmayer

2012-10-22 11:38

administrator   ~0002463

According to source code Matrix::inverse() expects the 3x3 sub-matrix to be a rotation matrix. For a usual matrix inverseGauss() should be used.

After all the documentation doesn't clearly mention this and in the Python binding inverseGauss() should be used.

wmayer

2012-10-22 12:22

administrator   ~0002464

git show 642a3e5

Issue History

Date Modified Username Field Change
2012-10-22 11:11 wmayer New Issue
2012-10-22 11:14 wmayer Note Added: 0002462
2012-10-22 11:38 wmayer Note Added: 0002463
2012-10-22 12:22 wmayer Note Added: 0002464
2012-10-22 12:22 wmayer Status new => closed
2012-10-22 12:22 wmayer Resolution open => fixed
2012-10-22 12:22 wmayer Fixed in Version => 0.13