gmp_lib.mpz_remove Method

GMP Native Interface for .NET

gmp_libmpz_remove Method
Remove all occurrences of the factor f from op and store the result in rop.

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 mp_bitcnt_t mpz_remove(
	mpz_t rop,
	mpz_t op,
	mpz_t f
)
Public Shared Function mpz_remove ( 
	rop As mpz_t,
	op As mpz_t,
	f As mpz_t
) As mp_bitcnt_t
public:
static mp_bitcnt_t mpz_remove(
	mpz_t^ rop, 
	mpz_t^ op, 
	mpz_t^ f
)
static member mpz_remove : 
        rop : mpz_t * 
        op : mpz_t * 
        f : mpz_t -> mp_bitcnt_t 

Parameters

rop
Type: Math.Gmp.Nativempz_t
The result integer.
op
Type: Math.Gmp.Nativempz_t
The operand integer.
f
Type: Math.Gmp.Nativempz_t
The factor operand integer.

Return Value

Type: mp_bitcnt_t
The return value is how many such occurrences were removed.
Examples
// Create, initialize, and set the value of op to 45.
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_ui(op, 45U);

// Create, initialize, and set the value of f to 3.
mpz_t f = new mpz_t();
gmp_lib.mpz_init_set_ui(f, 3U);

// Create, initialize, and set the value of rop to 0.
mpz_t rop = new mpz_t();
gmp_lib.mpz_init(rop);

// Set rop = op / f^n, and return n, the largest integer greater than or equal to 0, such that f^n divides op.
Assert.IsTrue(gmp_lib.mpz_remove(rop, op, f) == 2);

// Assert that rop is 5.
Assert.IsTrue(gmp_lib.mpz_get_si(rop) == 5);

// Release unmanaged memory allocated for rop, op, and f.
gmp_lib.mpz_clears(rop, op, f, null);
' Create, initialize, and set the value of op to 45.
Dim op As New mpz_t()
gmp_lib.mpz_init_set_ui(op, 45UI)

' Create, initialize, and set the value of f to 3.
Dim f As New mpz_t()
gmp_lib.mpz_init_set_ui(f, 3UI)

' Create, initialize, and set the value of rop to 0.
Dim rop As New mpz_t()
gmp_lib.mpz_init(rop)

' Set rop = op / f^n, and return n, the largest integer greater than or equal to 0, such that f^n divides op.
Assert.IsTrue(gmp_lib.mpz_remove(rop, op, f) = 2)

' Assert that rop is 5.
Assert.IsTrue(gmp_lib.mpz_get_si(rop) = 5)

' Release unmanaged memory allocated for rop, op, and f.
gmp_lib.mpz_clears(rop, op, f, 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