gmp_libmpz_powm_ui Method |
Set rop to (base^exp) modulo mod.
Namespace:
Math.Gmp.Native
Assembly:
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static void mpz_powm_ui(
mpz_t rop,
mpz_t base,
uint exp,
mpz_t mod
)
Public Shared Sub mpz_powm_ui (
rop As mpz_t,
base As mpz_t,
exp As UInteger,
mod As mpz_t
)
public:
static void mpz_powm_ui(
mpz_t^ rop,
mpz_t^ base,
unsigned int exp,
mpz_t^ mod
)
static member mpz_powm_ui :
rop : mpz_t *
base : mpz_t *
exp : uint32 *
mod : mpz_t -> unit
Parameters
- rop
- Type: Math.Gmp.Nativempz_t
The result integer. - base
- Type: Math.Gmp.Nativempz_t
The base integer. - exp
- Type: SystemUInt32
The exponent integer. - mod
- Type: Math.Gmp.Nativempz_t
The modulo integer.
Remarks
Negative exp is supported if an inverse base^-1 modulo mod exists (see mpz_invert).
If an inverse doesn’t exist then a divide by zero is raised.
Examples
mpz_t @base = new mpz_t();
gmp_lib.mpz_init_set_ui(@base, 2U);
mpz_t mod = new mpz_t();
gmp_lib.mpz_init_set_ui(mod, 3U);
mpz_t rop = new mpz_t();
gmp_lib.mpz_init(rop);
gmp_lib.mpz_powm_ui(rop, @base, 4U, mod);
Assert.IsTrue(gmp_lib.mpz_get_si(rop) == 1);
gmp_lib.mpz_clears(rop, @base, mod, null);
Dim base As New mpz_t()
gmp_lib.mpz_init_set_ui(base, 2UI)
Dim[mod] As New mpz_t()
gmp_lib.mpz_init_set_ui([mod], 3UI)
Dim rop As New mpz_t()
gmp_lib.mpz_init(rop)
gmp_lib.mpz_powm_ui(rop, base, 4UI, [mod])
Assert.IsTrue(gmp_lib.mpz_get_si(rop) = 1)
gmp_lib.mpz_clears(rop, base, [mod], Nothing)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also