mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Msieve

Reply
 
Thread Tools
Old 2009-04-07, 22:07   #45
Brian Gladman
 
Brian Gladman's Avatar
 
May 2008
Worcester, United Kingdom

22·7·19 Posts
Default

Quote:
Originally Posted by jasonp View Post
10metreh: I was insufficiently precise; the first thing the NFS code tries is rating the polynomial

The 'integration failed' messages don't have anything to do with these crashes. The crash occurs because you have to find the (floating point) roots of the algebraic polynomial in order to set up the numerical integration, and unfortunately it's impossible to build a polynomial rootfinder that is simultaneously

- capable of finding complex roots
- bulletproof regardless of the polynomial coefficients
- less than 1000 lines of code that started life as a crappy Fortran program

The code in the library uses Laguerre's method from Numerical Recipes and is pretty simple, but fails once in a while and produces nonsensical roots, which cause the integrator to crash. It seems to fail more often for SNFS polynomials. For bulletproof rootfinders, the best choice is the Jenkins-Traub model, which is 1000 lines of horrible C.
I don't claim that it is pretty but it did start off as Fortran :-)

Would double precision Jenkins-Traub followed by multiple precision root refinement be likely to work? Or are the distinct (non-multiple) roots too close together to be resolved in double precision?
Brian Gladman is offline   Reply With Quote
Old 2009-04-08, 03:38   #46
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

67258 Posts
Default

Quote:
Originally Posted by Brian Gladman View Post
I don't claim that it is pretty but it did start off as Fortran :-)

Would double precision Jenkins-Traub followed by multiple precision root refinement be likely to work? Or are the distinct (non-multiple) roots too close together to be resolved in double precision?
The roots are well separated, it's just that the iteration diverges (very fast!) for some input polynomials.

I didn't mean to disparage the work you did porting that terrible Fortran code, and even cleaned it up a little bit before giving up trying to make it better. It's just that I don't want to resort to something I can't understand if I can possibly help it.
jasonp is offline   Reply With Quote
Old 2009-04-08, 04:16   #47
FactorEyes
 
FactorEyes's Avatar
 
Oct 2006
vomit_frame_pointer

23×32×5 Posts
Default

Quote:
Originally Posted by jasonp View Post
I don't either, so the rootfinder needs a bulletproof method for approximating complex roots to enough accuracy that Laguerre's method is guaranteed to converge. Perhaps a continuation algorithm is needed.
I'll look into Jenkins-Traub, but I can't find my resource for it -- I moved last year, and some stuff is still buried deep in boxes.

But the problem still remains: if I muddle my way through an implementation, will it be understandable enough that it won't be a black box to other developers (i.e.: you)? Another black box would defeat the purpose of having maintainable, comprehensible code.
FactorEyes is offline   Reply With Quote
Old 2009-04-08, 07:06   #48
Brian Gladman
 
Brian Gladman's Avatar
 
May 2008
Worcester, United Kingdom

22·7·19 Posts
Default

Quote:
Originally Posted by jasonp View Post
The roots are well separated, it's just that the iteration diverges (very fast!) for some input polynomials.

I didn't mean to disparage the work you did porting that terrible Fortran code, and even cleaned it up a little bit before giving up trying to make it better. It's just that I don't want to resort to something I can't understand if I can possibly help it.
I didn't take any offence Jason - I agree that the code is terrible. If it was in a better state making it multiple precision would be relatively easy.

I didn't publish this code but if anyone wants to use it as a starting point for something better I will be happy to lete them have it.
Brian Gladman is offline   Reply With Quote
Old 2009-04-08, 23:32   #49
schickel
 
schickel's Avatar
 
"Frank <^>"
Dec 2004
CDP Janesville

41128 Posts
Default

Quote:
Originally Posted by Brian Gladman View Post
I didn't take any offence Jason - I agree that the code is terrible. If it was in a better state making it multiple precision would be relatively easy.

I didn't publish this code but if anyone wants to use it as a starting point for something better I will be happy to lete them have it.
If it won't blind me just by looking at, I'd like to at least take a look at it. I can't guarantee anything will happen.....
schickel is offline   Reply With Quote
Old 2009-04-09, 06:56   #50
Brian Gladman
 
Brian Gladman's Avatar
 
May 2008
Worcester, United Kingdom

22×7×19 Posts
Default

Here it is for those who are brave enough to take a look at it. It is supposed to be a translation of CACM algorithm 493 from Fortran to C but it may well contain conversion errors and really needs checking against the original Fortran. I would appreciate reports if anyone does find any such errors.

There is one subroutine where the logic is difficult to translate into structured code so I have left the original Fortran gotos in place. This is a challenge for those who feel that all gotos should be replaced by structured, transparent and efficient code!

Brian Gladman
Attached Files
File Type: zip jenkins_traub.zip (6.2 KB, 110 views)
Brian Gladman is offline   Reply With Quote
Old 2009-04-09, 17:14   #51
miklin
 
miklin's Avatar
 
Nov 2007

3×52 Posts
Default Internet Resources for the Jenkins-Traub Method

At the link below is posted a C++ translation of the FORTRAN routine RPOLY.FOR, which is posted off the NETLIB site as TOMS/493.

http://www.akiti.ca/rpoly_ak1_Intro.html

http://math.fullerton.edu/mathews/n2...Bib_lnk_1.html

http://www.hvks.com/Numerical/winsolve.htm

Last fiddled with by miklin on 2009-04-09 at 17:45
miklin is offline   Reply With Quote
Old 2009-04-09, 22:16   #52
Robert Holmes
 
Robert Holmes's Avatar
 
Oct 2007

2·53 Posts
Default

Quote:
Originally Posted by miklin View Post
At the link below is posted a C++ translation of the FORTRAN routine RPOLY.FOR, which is posted off the NETLIB site as TOMS/493.

http://www.akiti.ca/rpoly_ak1_Intro.html

http://math.fullerton.edu/mathews/n2...Bib_lnk_1.html

http://www.hvks.com/Numerical/winsolve.htm
For the sake of diversity, here's another:

http://www.crbond.com/download/misc/rpoly.cpp
Robert Holmes is offline   Reply With Quote
Old 2009-04-10, 01:45   #53
WraithX
 
WraithX's Avatar
 
Mar 2006

1DF16 Posts
Default

Question... Jason mentioned needing a polynomial solver that can handle polynomials with complex roots. But the algorithm that Brian converted is 493. All the references I've seen online say that 493 is for polys with real coefficients and algorithm 419 is for polys with complex coefficients. And the links recently posted point to the rpoly (real polynomial) fortran code, and not the cpoly (complex polynomial) fortran code. Am I mixing these up? Will either of these work for Jason, or does he need specifically one or the other?
WraithX is offline   Reply With Quote
Old 2009-04-10, 03:42   #54
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

1101110101012 Posts
Default

The specialization in these methods is for polynomials whose coefficients are real numbers, but all the methods (Jenkins-Traub included) can find the complex roots of these polynomials that the code needs.

Some of these rewritings of TOMS493 are actually quite nice.
jasonp is offline   Reply With Quote
Old 2009-04-11, 07:04   #55
Brian Gladman
 
Brian Gladman's Avatar
 
May 2008
Worcester, United Kingdom

53210 Posts
Default

Quote:
Originally Posted by jasonp View Post
The specialization in these methods is for polynomials whose coefficients are real numbers, but all the methods (Jenkins-Traub included) can find the complex roots of these polynomials that the code needs.

Some of these rewritings of TOMS493 are actually quite nice.
I have tried several of these (and my own) on both the original test data set and on ill conditioned data sets and compared the results with those given by the original Fortran code. So far the results only agree to five or six decimal digits and are all different beyond this point even when compiled and run on the same machine using the same underlying FP processor. This is disappointing to say the least

The original Fortran code used quad precision but all the conversions I have tried use only double precision. So I am now in the process of reconverting the original Fortran in a way that sllows MPFR to be used to obtain multiple precision FP operations in C.
Brian Gladman is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Msieve 1.53 feedback xilman Msieve 149 2018-11-12 06:37
Msieve 1.50 feedback firejuggler Msieve 99 2013-02-17 11:53
Msieve v1.48 feedback Jeff Gilchrist Msieve 48 2011-06-10 18:18
Msieve 1.43 feedback Jeff Gilchrist Msieve 47 2009-11-24 15:53
Msieve 1.42 feedback Andi47 Msieve 167 2009-10-18 19:37

All times are UTC. The time now is 01:06.


Sat Jul 17 01:06:17 UTC 2021 up 49 days, 22:53, 1 user, load averages: 2.40, 1.93, 1.61

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.