pontifikas's picture

Matrix inversion function correctness issue

Project:The Open Toolkit library
Version:1.0.0-rc1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:confirmed
Description

Matrix "Invert" method returns incorrect results.
The matrix referenced below is Singular. However, Invert method returns a result.
Matrix "sumC" is of type "dnAnalytics.LinearAlgebra.SparseMatrix" of the dnAnalytics library and correctly recognizes the matrix as Singular.
The data were alse checked with Matlab and again the Matrix was found to be singular.

                                                                                                                        //Values
                        Matrix4d Mat = new Matrix4d(sumC[0, 0], sumC[0, 1], sumC[0, 2], sumC[0, 3], //(2.37972721044496, 0, -0.0993767007536986, -0.745316262570544)
                                                    sumC[1, 0], sumC[1, 1], sumC[1, 2], sumC[1, 3],//(0, 0, 0, 0)
                                                    sumC[2, 0], sumC[2, 1], sumC[2, 2], sumC[2, 3],//(-1.76508718476331, 0, 1.0137436046165, 0.895168793026055)
                                                    sumC[3, 0], sumC[3, 1], sumC[3, 2], sumC[3, 3]);//(0, 0, 0, 1)
 
                        Mat.Invert();//Passes and returns:
                                                        //(0.42021623134402, 0, -0.0417597026741217, 0.313193991016804)
                                                        //(0, 0, 0, 0)
                                                        //(0.741718284774864, 0, 0.94003408858688, -0.342354093137419)
                                                        //(0, 0, 0, 1)
 
                        sumCInv = (SparseMatrix)sumC.Inverse();//Throws Singularity exception

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Status:open» confirmed