public static MPZ operator %(MPZ lhs, uint rhs) { MPZ result = new MPZ(); gmp_lib.mpz_mod_ui(result.Value, lhs.Value, rhs); return(result); }
public static MPZ operator /(MPZ lhs, mpz_t rhs) { MPZ result = new MPZ(); gmp_lib.mpz_tdiv_q(result.Value, lhs.Value, rhs); return(result); }
public static MPZ operator %(mpz_t lhs, MPZ rhs) { MPZ result = new MPZ(); gmp_lib.mpz_mod(result.Value, lhs, rhs.Value); return(result); }
public static MPZ operator ~(MPZ value) { MPZ result = new MPZ(); gmp_lib.mpz_com(result.Value, value.Value); return(result); }
public static MPZ operator *(uint lhs, MPZ rhs) { MPZ result = new MPZ(); gmp_lib.mpz_mul_ui(result.Value, rhs.Value, lhs); return(result); }
public static MPZ operator >>(MPZ lhs, int rhs) { MPZ result = new MPZ(); gmp_lib.mpz_tdiv_q_2exp(result.Value, lhs.Value, (mp_bitcnt_t)rhs); return(result); }
public static MPZ operator -(uint lhs, MPZ rhs) { MPZ result = new MPZ(); gmp_lib.mpz_ui_sub(result.Value, lhs, rhs.Value); return(result); }
public static MPZ Sqrt(MPZ value) { MPZ result = new MPZ(); gmp_lib.mpz_sqrt(result.Value, value.Value); return(result); }
public static MPZ BRandom(MPZ count) { MPZ result = new MPZ(); gmp_lib.mpz_urandomb(result.Value, MPZ.RandomState.Value, (mp_bitcnt_t)(ulong)count); return(result); }
public static MPZ Cb(MPZ value) { MPZ result = new MPZ(); gmp_lib.mpz_pow_ui(result.Value, value.Value, 3U); return(result); }
public static MPZ Pow(MPZ a, MPZ b) { MPZ result = new MPZ(); gmp_lib.mpz_pow_ui(result.Value, a.Value, b); return(result); }
public static MPZ Abs(MPZ value) { MPZ result = new MPZ(); gmp_lib.mpz_abs(result.Value, value.Value); return(result); }
public static MPZ operator ^(MPZ lhs, MPZ rhs) { MPZ result = new MPZ(); gmp_lib.mpz_xor(result.Value, lhs.Value, rhs.Value); return(result); }
public static MPZ operator +(MPZ value) { MPZ result = new MPZ(); gmp_lib.mpz_abs(result.Value, value.Value); return(value); }
public static MPZ Neg2(MPZ value) { if (value <= 0) { return(new MPZ(value)); } return(Neg(value)); }
public static MPZ URandom(MPZ max, bool inclusive = false) { MPZ result = new MPZ(); if (inclusive) { mpz_t tmp = new mpz_t(); gmp_lib.mpz_init(tmp); gmp_lib.mpz_add_ui(tmp, max.Value, 1U); gmp_lib.mpz_urandomm(result.Value, MPZ.RandomState.Value, tmp); gmp_lib.mpz_clear(tmp); } else { gmp_lib.mpz_urandomm(result.Value, MPZ.RandomState.Value, max.Value); } return(result); }
public static MPZ Max(params MPZ[] values) { if (values.Length == 0) { throw new System.ArgumentException(); } MPZ result = values[0]; for (int i = 1; i < values.Length; i++) { if (values[i] > result) { result = values[i]; } } return(new MPZ(result)); }
public static MPZ RightShift(MPZ lhs, MPZ rhs) { return(lhs >> rhs); }
public static MPZ LeftShift(MPZ lhs, MPZ rhs) { return(lhs << rhs); }