mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Aliquot Sequences (https://www.mersenneforum.org/forumdisplay.php?f=90)
-   -   Aliqueit.exe discussion (https://www.mersenneforum.org/showthread.php?t=11618)

bsquared 2009-03-17 14:31

Aliqueit.exe discussion
 
[quote=mklasson;165739]I've made a little home for aliqueit as well that will always have the latest version: [URL]http://mklasson.com/aliquot.php[/URL] (similar to the ubasic program except it's C++ and created this millenium :razz:)[/quote]

Thanks, this is working good for me. Good enough that I might consider doing some work on these fancy aliquot-thingamagigs.

I had actually started to code an aliquot sequence, err, computer, in YAFU because I refused to work with the UBASIC thing. But I can abandon that now. If anyone wants a chuckle, try running aliquot(N) in yafu, where N is the starting number. Its an undocumented feature, which will become an undocumented non-feature in the next version. It uses only yafu routines, so will start to choke around 95+ digits, can't parse anything, so can only start from scratch, and doesn't output anything useful either. And may produce bad results... heh... told you it's only good for a laugh.

- ben.

bsquared 2009-03-17 16:25

[quote=bsquared;165756]told you it's only good for a laugh.

- ben.[/quote]

It is faster though, for the starting values. Just (re)did the first 1225 iterations of 10212 in less than 2 minutes. But all the sequences are already past that point anyway, right?

p.s.
feel free to delete this and the preceeding posts - they are just clutter.

mklasson 2009-03-17 22:54

[QUOTE=bsquared;165772]It is faster though, for the starting values. Just (re)did the first 1225 iterations of 10212 in less than 2 minutes.[/QUOTE]

Aliqueit could probably gain a good bit of overall speed from better ecm limits for all sizes of inputs. The current limits are basically a few half-decent guesses extrapolated to increasingly worse guesses.

I considered emulating the behaviour of aliquot.ub, but as that source code says "These are VERY wild guesses" I'm not sure that would be much better. :smile:

I don't know how optimal msieve's choices are. Maybe approximating that behaviour is a better start. Anyone with more knowledge of the matter care to chime in?

bsquared 2009-03-18 03:14

[quote=mklasson;165817]Aliqueit could probably gain a good bit of overall speed from better ecm limits for all sizes of inputs. The current limits are basically a few half-decent guesses extrapolated to increasingly worse guesses. I don't know how optimal msieve's choices are. Maybe approximating that behaviour is a better start. Anyone with more knowledge of the matter care to chime in?

[/quote]
For smaller inputs, say less than 50 or 60 digits you could try just using msieve/yafu more. Msieve has good ecm choices for getting rid of small factors as does yafu, and the QS routines will quickly take care of the rest. For anything less than 60 digits you shouldn't be doing much ecm at all, IMO, assuming you first do trial division and pollard rho for a few hundred milliseconds. In yafu use the 'factor' function to automatically do this or something more customizable like siqs(rho(trial(N))).

For larger inputs say > 85 digits I'd start with the table in the GMP-ECM readme file and target doing ECM to, say, the 2/9*N digit level if the input is QSable or 1/3*N digit level if the input would otherwise need NFS.

In between 60 and 85 some ecm would be good to do. You may be able to get away with just calling msieve and letting it deal with the ecm'ing, but that assumes the user's msieve has that capability which it may not if home-built. Yafu's ecm is probably sufficiently slower at this point that gmp-ecm would be a good idea before QS.

Anyway, my $0.02.

- ben.

henryzz 2009-03-18 07:34

[quote=mklasson;165817]Aliqueit could probably gain a good bit of overall speed from better ecm limits for all sizes of inputs. The current limits are basically a few half-decent guesses extrapolated to increasingly worse guesses.

I considered emulating the behaviour of aliquot.ub, but as that source code says "These are VERY wild guesses" I'm not sure that would be much better. :smile:

I don't know how optimal msieve's choices are. Maybe approximating that behaviour is a better start. Anyone with more knowledge of the matter care to chime in?[/quote]
what version of aliquot.ub are you using?

mklasson 2009-03-18 11:22

[QUOTE=bsquared;165836]Anyway, my $0.02.[/QUOTE]

A bankable $0.02. :)

[QUOTE=henryzz;165853]what version of aliquot.ub are you using?[/QUOTE]

None at all. I tried it once but the bundled interpreter complained about 64-bit windows and refused to start. That quote was from v1.25 though (from Sander's site).

bsquared 2009-03-18 13:33

[quote=mklasson;165739]I've made a little home for aliqueit as well that will always have the latest version: [URL]http://mklasson.com/aliquot.php[/URL] (similar to the ubasic program except it's C++ and created this millenium :razz:)[/quote]

I'm having some trouble compiling this under linux. Is that supported at all? I would also not rule out me doing something stoopid during compiling, as I haven't used c++ much.

[CODE]
[EMAIL="buhrow@barista:~/aliquot$"]buhrow@barista:~/aliquot$[/EMAIL] g++ aliqueit.cc -l /user/buhrow/gmp/install4.2.3/lib/libgmp.a
aliqueit.cc:14:20: error: direct.h: No such file or directory
aliqueit.cc:109: error: âmpz_classâ was not declared in this scope
aliqueit.cc:109: error: template argument 1 is invalid
aliqueit.cc:109: error: template argument 3 is invalid
aliqueit.cc:109: error: template argument 4 is invalid
aliqueit.cc:109: error: invalid type in declaration before â;â token
aliqueit.cc:112: error: variable or field âfactorâ declared void
aliqueit.cc:112: error: âmpz_classâ was not declared in this scope
aliqueit.cc:112: error: âmpz_classâ was not declared in this scope
aliqueit.cc:112: error: template argument 1 is invalid
aliqueit.cc:112: error: template argument 1 is invalid
aliqueit.cc:112: error: template argument 2 is invalid
aliqueit.cc:112: error: âfactorsâ was not declared in this scope
aliqueit.cc:112: error: âmpz_classâ was not declared in this scope
aliqueit.cc:112: error: template argument 1 is invalid
aliqueit.cc:112: error: template argument 2 is invalid
aliqueit.cc:112: error: ânew_factorsâ was not declared in this scope
aliqueit.cc:112: error: expected primary-expression before âboolâ
aliqueit.cc:128: error: âmpz_classâ has not been declared
aliqueit.cc: In function âvoid add_and_check_cycle(unsigned int, int&)â:
aliqueit.cc:129: error: request for member âcountâ in âseq_valuesâ, which is of non-class type âintâ
aliqueit.cc:130: error: invalid types âint[int]â for array subscript
aliqueit.cc:133: error: invalid types âint[int]â for array subscript
aliqueit.cc: In function âvoid precalc_trial_primes()â:
aliqueit.cc:138: error: âmpz_classâ was not declared in this scope
aliqueit.cc:138: error: expected `;' before âpâ
aliqueit.cc:139: error: âpâ was not declared in this scope
aliqueit.cc: At global scope:
aliqueit.cc:272: error: âmpz_classâ was not declared in this scope
aliqueit.cc:272: error: template argument 1 is invalid
aliqueit.cc:272: error: template argument 2 is invalid
aliqueit.cc: In function âint find_log_factors(std::string, std::string, std::string, std::string, int&)â:
aliqueit.cc:285: error: request for member âpush_backâ in âfactorsâ, which is of non-class type âintâ
aliqueit.cc:285: error: âmpz_classâ was not declared in this scope
aliqueit.cc: At global scope:
aliqueit.cc:298: error: âmpz_classâ was not declared in this scope
aliqueit.cc:298: error: template argument 1 is invalid
aliqueit.cc:298: error: template argument 1 is invalid
aliqueit.cc:298: error: template argument 2 is invalid
aliqueit.cc: In function âvoid merge_factors(int&)â:
aliqueit.cc:299: error: request for member âbeginâ in âfactorsâ, which is of non-class type âintâ
aliqueit.cc:299: error: request for member âendâ in âfactorsâ, which is of non-class type âintâ
aliqueit.cc:300: error: request for member âsizeâ in âfactorsâ, which is of non-class type âintâ
aliqueit.cc:301: error: invalid types âint[size_t]â for array subscript
aliqueit.cc:301: error: invalid types âint[long unsigned int]â for array subscript
aliqueit.cc:302: error: invalid types âint[long unsigned int]â for array subscript
aliqueit.cc:302: error: invalid types âint[size_t]â for array subscript
aliqueit.cc:303: error: request for member âeraseâ in âfactorsâ, which is of non-class type âintâ
aliqueit.cc:303: error: request for member âbeginâ in âfactorsâ, which is of non-class type âintâ
aliqueit.cc: At global scope:
aliqueit.cc:310: error: âmpz_classâ was not declared in this scope
aliqueit.cc:310: error: template argument 1 is invalid
aliqueit.cc:310: error: template argument 2 is invalid
aliqueit.cc: In function âint run_ecm(std::string, int&)â:
aliqueit.cc:311: error: â_unlinkâ was not declared in this scope
aliqueit.cc: At global scope:
aliqueit.cc:331: error: âmpz_classâ was not declared in this scope
aliqueit.cc:331: error: template argument 1 is invalid
aliqueit.cc:331: error: template argument 2 is invalid
aliqueit.cc: In function âint run_yafu(std::string, std::string, int&)â:
aliqueit.cc:332: error: â_unlinkâ was not declared in this scope
aliqueit.cc: At global scope:
aliqueit.cc:341: error: âmpz_classâ was not declared in this scope
aliqueit.cc:341: error: template argument 1 is invalid
aliqueit.cc:341: error: template argument 2 is invalid
aliqueit.cc: In function âint run_msieve(std::string, int&)â:
aliqueit.cc:342: error: â_unlinkâ was not declared in this scope
aliqueit.cc: At global scope:
aliqueit.cc:351: error: âmpz_classâ was not declared in this scope
aliqueit.cc:351: error: template argument 1 is invalid
aliqueit.cc:351: error: template argument 2 is invalid
aliqueit.cc: In function âint run_ggnfs(std::string, int&)â:
aliqueit.cc:354: error: â_chdirâ was not declared in this scope
aliqueit.cc: At global scope:
aliqueit.cc:373: error: variable or field âfound_factorâ declared void
aliqueit.cc:373: error: âmpz_classâ was not declared in this scope
aliqueit.cc:373: error: âfactorâ was not declared in this scope
aliqueit.cc:373: error: âmpz_classâ was not declared in this scope
aliqueit.cc:373: error: template argument 1 is invalid
aliqueit.cc:373: error: template argument 1 is invalid
aliqueit.cc:373: error: template argument 2 is invalid
aliqueit.cc:373: error: âfactorsâ was not declared in this scope
aliqueit.cc:379: error: variable or field âadd_factorsâ declared void
aliqueit.cc:379: error: âmpz_classâ was not declared in this scope
aliqueit.cc:379: error: ânâ was not declared in this scope
aliqueit.cc:379: error: âmpz_classâ was not declared in this scope
aliqueit.cc:379: error: template argument 1 is invalid
aliqueit.cc:379: error: template argument 1 is invalid
aliqueit.cc:379: error: template argument 2 is invalid
aliqueit.cc:379: error: âfactorsâ was not declared in this scope
aliqueit.cc:379: error: âmpz_classâ was not declared in this scope
aliqueit.cc:379: error: template argument 1 is invalid
aliqueit.cc:379: error: template argument 2 is invalid
aliqueit.cc:379: error: ânew_factorsâ was not declared in this scope
[/CODE]

Maybe this is helpful to know:
[CODE]
[EMAIL="buhrow@barista:~/aliquot$"]buhrow@barista:~/aliquot$[/EMAIL] g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --disable-libmudflap --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.2.3 (Debian 4.2.3-5)
[/CODE]

mklasson 2009-03-18 13:41

[QUOTE=bsquared;165873]I'm having some trouble compiling this under linux. Is that supported at all?[/QUOTE]

I haven't tried it, but there's no reason it shouldn't work.

I'm using GMP's C++ class mpz_class, so try including gmpxx.lib. It's strangely not needed when compiling with MSVC though (gmp.lib is sufficient).

bsquared 2009-03-18 13:50

ok, that helped. But it still can't find direct.h for the file manipulation stuff.

[code]
buhrow@barista:~/aliquot$ g++ aliqueit.cc -I /user/buhrow/gmp/gmp-4.2.3/ -l /user/buhrow/gmp/install4.2.3/lib/libgmp.a
aliqueit.cc:14:20: error: direct.h: No such file or directory
aliqueit.cc: In function âint run_ecm(std::string, std::vector<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, std::allocator<__gmp_expr<__mpz_struct [1], __mpz_struct [1]> > >&)â:
aliqueit.cc:311: error: â_unlinkâ was not declared in this scope
aliqueit.cc: In function âint run_yafu(std::string, std::string, std::vector<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, std::allocator<__gmp_expr<__mpz_struct [1], __mpz_struct [1]> > >&)â:
aliqueit.cc:332: error: â_unlinkâ was not declared in this scope
aliqueit.cc: In function âint run_msieve(std::string, std::vector<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, std::allocator<__gmp_expr<__mpz_struct [1], __mpz_struct [1]> > >&)â:
aliqueit.cc:342: error: â_unlinkâ was not declared in this scope
aliqueit.cc: In function âint run_ggnfs(std::string, std::vector<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, std::allocator<__gmp_expr<__mpz_struct [1], __mpz_struct [1]> > >&)â:
aliqueit.cc:354: error: â_chdirâ was not declared in this scope
aliqueit.cc: In function âvoid factor(mpz_class, std::vector<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>, std::allocator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int> > >&, std::vector<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, std::allocator<__gmp_expr<__mpz_struct [1], __mpz_struct [1]> > >&, bool)â:
aliqueit.cc:408: error: invalid initialization of non-const reference of type âmpz_class&â from a temporary of type âmpz_classâ
aliqueit.cc:373: error: in passing argument 1 of âvoid found_factor(mpz_class&, std::vector<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>, std::allocator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int> > >&)â
[/code]

Edit:
Ahhh, that's because it's a MS specific header file. I'll see if there's a linux substitute.

mklasson 2009-03-18 13:57

Yeah, appears to be ms-specific. unistd.h -> unlink() and chdir() for linux.

bsquared 2009-03-18 14:05

[quote=mklasson;165877]Yeah, appears to be ms-specific. unistd.h -> unlink() and chdir() for linux.[/quote]

yep. A couple of #ifdef's and that problem is gone. Here's the last hurdle:

[CODE]
[EMAIL="buhrow@barista:~/aliquot$"]buhrow@barista:~/aliquot$[/EMAIL] g++ aliqueit.cc -I /user/buhrow/gmp/gmp-4.2.3/ -l /user/buhrow/gmp/install4.2.3/lib/libgmp.a
aliqueit.cc: In function âvoid factor(mpz_class, std::vector<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>, std::allocator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int> > >&, std::vector<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, std::allocator<__gmp_expr<__mpz_struct [1], __mpz_struct [1]> > >&, bool)â:
aliqueit.cc:433: error: invalid initialization of non-const reference of type âmpz_class&â from a temporary of type âmpz_classâ
aliqueit.cc:398: error: in passing argument 1 of âvoid found_factor(mpz_class&, std::vector<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>, std::allocator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int> > >&)â
[/CODE]


All times are UTC. The time now is 18:30.

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