Mpz functions

dvarrazzo edited this page Mar 24, 2011 · 9 revisions
Clone this wiki locally

List of functions to be wrapped

Classified by argument types. Basic operators to be included.

They are a lot! With a lot of different signatures...

mpz -> mpz

  • neg (done)
  • abs (done)
  • sqrt (done in mk8/mpz_wrapper)
  • root (done in mk8/mpz_wrapper)
  • nextprime (done in mk8/mpz_wrapper)
  • com (done)
mpz -> mpz, mpz
  • sqrtrem (done in mk8/mpz_wrapper)
  • rootrem (done in mk8/mpz_wrapper)
mpz -> bool
  • perfect_power (done in mk8/mpz_wrapper)
  • perfect_square (done in mk8/mpz_wrapper)

mpz, mpz -> mpz

  • cdiv_q (done)
  • cdiv_r (done)
  • fdiv_q (done)
  • fdiv_r (done)
  • tdiv_q (done)
  • tdiv_r (done)
  • mod # looks like abs(tdiv_r)
  • divexact (done)
  • gcd (done)
  • lcm (done)
  • invert (done)
  • and (done)
  • ior (done)
  • xor (done)

mpz, mpz -> mpz, mpz

  • cdiv_qr; (q, r) -> (n, d) (done)
  • fdiv_qr; (q, r) -> (n, d) (done)
  • tdiv_qr; (q, r) -> (n, d) (done)

mpz, long -> mpz

note: those also return a long value: what is it?

  • cdiv_q_ui
  • cdiv_r_ui
  • cdiv_q_2exp (done) # arg 2 is a bitcount
  • cdiv_r_2exp (done)
  • fdiv_q_ui
  • fdiv_r_ui
  • fdiv_q_2exp (done)
  • fdiv_r_2exp (done)
  • tdiv_q_ui
  • tdiv_r_ui
  • tdiv_q_2exp (done)
  • tdiv_r_2exp (done)
  • mod_ui # identical to fdiv_r_ui
  • divexact_ui
  • pow_ui (done)
  • gcd_ui # return fits in a long
  • lcm_ui
  • bin_ui

long -> mpz

  • fac_ui (done)

long, long -> mpz

  • ui_pow_ui # probably can't be wrapped overloading ^
  • bin_uiui

mpz, long -> mpz, mpz

This also return a long: what is it? (seems a copy of the reminder, in abs value).

  • cdiv_qr_ui
  • fdiv_qr_ui
  • tdiv_qr_ui
  • rootrem (done)

mpz, long -> long

What's the difference with the cdiv_r_ui above? the doc say this only returns the remainder

  • cdiv_ui
  • fdiv_ui
  • tdiv_ui

mpz, mpz -> bool

  • divisible_p (done)

mpz, long -> bool

  • divisible_ui_p
  • divisible_2exp_p (done)

mpz, mpz, mpz -> bool

  • congruent (done)

mpz, long, long -> bool

  • congruent_ui

mpz, mpz, long -> bool

  • congruent_2exp (done)

mpz, mpz, mpz -> mpz

  • powm (done)
  • powm_sec - not available in GMP 3 and probably not useful on a server

mpz, long, mpz -> mpz

  • powm_ui

mpz, long -> mpz, bool

  • root (done but without the bool value)

mpz -> mpz, mpz

  • sqrtrem (done)

mpz -> bool

  • even (done)
  • odd (done)
  • perfect_power_p (done)
  • perfect_square_p (done)

mpz, int -> bool

  • probab_prime_p (done)

mpz, mpz -> mpz, mpz, mpz

  • gcdext (done)

mpz, mpz -> int

  • jacobi (done)
  • legendre (done)
  • kronecker (done, basic) # with a mix of other types

mpz, mpz -> mpz, ulong

  • remove (done)

long -> mpz

  • fib_ui
  • lucnum_ui

long -> mpz, mpz

  • fib2_ui
  • lucnum2_ui

mpz -> int

  • sgn (done)

mpz -> ulong

  • popcount (done)
  • hamdist (done)

mpz, ulong -> ulong

  • scan0 (done)
  • scan1 (done)