hermann on Mon, 19 Jun 2023 01:02:08 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
void mpz_set_GEN(mpz_ptr z, GEN x) and GEN mpz_get_GEN(mpz_srcptr z) |
Until now I wrote GP scripts. Now I did write my first C++ with libgmpxx and PARI code.I did need to convert between t_INT GEN and libgmpxx mpz_t in both directions.
I found subject functions in this posting ... https://mersenneforum.org/showpost.php?s=1b4a66ceb4c359463161f3d6451771c4&p=626367&postcount=13 and made use of them to create GEN ... https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/c%2B%2B/sqrtm1.smallest_known_1million_digit_prime.cc#L105-L106 and copy from GEN: https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/c%2B%2B/sqrtm1.smallest_known_1million_digit_prime.cc#L120-L121Those functions are not part of PARI, has one to use such self-coded functions for the job?
Regards, Hermann. c++$ g++ $f.cc -lgmp -lgmpxx -O3 -o $f -lpari -DPARI c++$ ./sqrtm1.smallest_known_1million_digit_prime a = y^(-1) (mod p) [powm]; a *= x; a %= x 0.252741s [M,V] = halfgcdii(sqrtm1, p) 0.268554s [x,y] = [V[2], M[2,1]] 3.4e-05s done c++$