I have the impression that this has to do with the precision and size of your coefficients,
and more precisely of the magnitude difference between them.
Your constant coefficient is around 4e18.
If I scale the solutions by a factor 10, by dividing coefficient 3 by 100 and coefficient 5 by 10000, I obtain the correct result (to be interpreted 10x larger):
VNL roots are
    4554.6     +i     4.62223e-32
    -4457.61     +i     -1.44445e-34
    -4554.6     +i     -4.62223e-32
    4457.61     +i     1.44445e-34

So try reducing too extreme values first (e.g. by dividing coefficient n by 10^n) before calling the solver.

I presume that the original algorithm (by Kriegman and Ponce) has this same instability.

Not sure whether this scaling solution should be introduced into the VNL interface layer, or whether this should better be left to the user who calls the method. Suggestions welcome, of course.

-- Peter.


--- Den ons 2010-09-01 skrev somi <>:

Från: somi <>
Ämne: [Vxl-users] Bug in VNL vnl_rnpoly_solve ?
Datum: onsdag 1 september 2010 22:29

I am getting incorrect solution when I try to solve a polynomial using the method "vnl_rnpoly_solve",
that is provided in ITK.

a) Polynomial coefficients (buggy case )
1.0000e+00   0.0000e+00  -4.0615e+09   4.0000e-06   4.1220e+18

The roots of the polynomial should be 

But vnl_rnpoly_solve , doesn't return any root.

b) Polynomial coefficients (test case)

1.0000e+00   0.0000e+00  -4.0615e+07   0.0000e+00   4.1220e+14

For this the roots should be:

Which is what I get using VNL.

I have included a test program. 


-----Infogad bilaga följer-----

This Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.

-----Infogad bilaga följer-----

Vxl-users mailing list