Somi,

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 <seesomi@gmail.com>:

Från: somi <seesomi@gmail.com>
Ämne: [Vxl-users] Bug in VNL vnl_rnpoly_solve ?
Till: vxl-users@lists.sourceforge.net
Datum: onsdag 1 september 2010 22:29

Hi,
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 
   4.5546e+04
   4.4576e+04
  -4.5546e+04
  -4.4576e+04

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:
  -4554.6
  -4457.6
   4554.6
   4457.6

Which is what I get using VNL.


I have included a test program. 

Thanks,
Somi

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

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd

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

_______________________________________________
Vxl-users mailing list
Vxl-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vxl-users