Multi precision Integer

Introduced properties

fun abs(res: NativeMPZ)

gmp :: NativeMPZ :: abs

fun add(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: add

fun add_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: add_ui

fun cmp(op: NativeMPZ): Int

gmp :: NativeMPZ :: cmp

fun cmp_si(op: Int): Int

gmp :: NativeMPZ :: cmp_si

fun finalize

gmp :: NativeMPZ :: finalize

Delete this NativeMPZ
fun gcd(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: gcd

fun gcd_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: gcd_ui

fun get_d: Float

gmp :: NativeMPZ :: get_d

fun get_si: Int

gmp :: NativeMPZ :: get_si

fun get_str(base: Int32): CString

gmp :: NativeMPZ :: get_str

fun mod(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: mod

fun mod_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: mod_ui

fun mul(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: mul

fun mul_si(res: NativeMPZ, op: Int)

gmp :: NativeMPZ :: mul_si

fun neg(res: NativeMPZ)

gmp :: NativeMPZ :: neg

init new: NativeMPZ

gmp :: NativeMPZ :: new

fun pow_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: pow_ui

fun set(op: NativeMPZ)

gmp :: NativeMPZ :: set

fun set_d(op: Float)

gmp :: NativeMPZ :: set_d

fun set_q(op: NativeMPQ)

gmp :: NativeMPZ :: set_q

fun set_si(op: Int)

gmp :: NativeMPZ :: set_si

fun set_str(str: CString, base: Int32)

gmp :: NativeMPZ :: set_str

fun sub(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: sub

fun sub_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: sub_ui

fun swap(op: NativeMPZ)

gmp :: NativeMPZ :: swap

fun tdiv_q(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: tdiv_q

Redefined properties

redef type SELF: NativeMPZ

gmp $ NativeMPZ :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun abs(res: NativeMPZ)

gmp :: NativeMPZ :: abs

fun add(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: add

fun add_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: add_ui

fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun cmp(op: NativeMPZ): Int

gmp :: NativeMPZ :: cmp

fun cmp_si(op: Int): Int

gmp :: NativeMPZ :: cmp_si

fun finalize

gmp :: NativeMPZ :: finalize

Delete this NativeMPZ
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
fun gcd(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: gcd

fun gcd_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: gcd_ui

fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun get_d: Float

gmp :: NativeMPZ :: get_d

fun get_si: Int

gmp :: NativeMPZ :: get_si

fun get_str(base: Int32): CString

gmp :: NativeMPZ :: get_str

fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun mod(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: mod

fun mod_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: mod_ui

fun mul(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: mul

fun mul_si(res: NativeMPZ, op: Int)

gmp :: NativeMPZ :: mul_si

fun neg(res: NativeMPZ)

gmp :: NativeMPZ :: neg

init new: NativeMPZ

gmp :: NativeMPZ :: new

init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun pow_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: pow_ui

fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun set(op: NativeMPZ)

gmp :: NativeMPZ :: set

fun set_d(op: Float)

gmp :: NativeMPZ :: set_d

fun set_q(op: NativeMPQ)

gmp :: NativeMPZ :: set_q

fun set_si(op: Int)

gmp :: NativeMPZ :: set_si

fun set_str(str: CString, base: Int32)

gmp :: NativeMPZ :: set_str

fun sub(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: sub

fun sub_ui(res: NativeMPZ, op: UInt64)

gmp :: NativeMPZ :: sub_ui

fun swap(op: NativeMPZ)

gmp :: NativeMPZ :: swap

intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun tdiv_q(res: NativeMPZ, op: NativeMPZ)

gmp :: NativeMPZ :: tdiv_q

abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram gmp::NativeMPZ NativeMPZ core::Pointer Pointer gmp::NativeMPZ->core::Pointer core::Object Object core::Pointer->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Class definitions

gmp $ NativeMPZ
# Multi precision Integer
extern class NativeMPZ `{mpz_ptr`}

    # Initializing

    new `{
        mpz_ptr self =  (mpz_ptr)malloc(sizeof(mpz_t));
        mpz_init(self);
        return self;
    `}

    # Arithmetic Functions

    fun add(res, op: NativeMPZ) `{
        mpz_add(res, self, op);
    `}

    fun add_ui(res: NativeMPZ, op: UInt64) `{
        mpz_add_ui(res, self, *op);
    `}

    fun sub(res, op: NativeMPZ) `{
        mpz_sub(res, self, op);
    `}

    fun sub_ui(res: NativeMPZ, op: UInt64) `{
        mpz_sub_ui(res, self, *op);
    `}

    fun mul(res, op: NativeMPZ) `{
        mpz_mul(res, self, op);
    `}

    fun mul_si(res: NativeMPZ, op: Int) `{
        mpz_mul_si(res, self, op);
    `}

    fun neg(res: NativeMPZ) `{
        mpz_neg(res, self);
    `}

    fun abs(res: NativeMPZ) `{
        mpz_abs(res, self);
    `}

    fun tdiv_q(res, op: NativeMPZ) `{
        mpz_tdiv_q(res, self, op);
    `}

    fun tdiv_q_ui(res: NativeMPZ, op: UInt64) `{
        mpz_tdiv_q_ui(res, self, *op);
    `}

    fun mod(res, op: NativeMPZ) `{
        mpz_mod(res, self, op);
    `}

    fun mod_ui(res: NativeMPZ, op: UInt64) `{
        mpz_mod_ui(res, self, *op);
    `}

    fun pow_ui(res: NativeMPZ, op: UInt64) `{
        mpz_pow_ui(res, self, *op);
    `}

    #Number Theoretic Functions

    fun probab_prime_p(reps: Int32): Int `{
        return mpz_probab_prime_p(self, reps);
    `}

    fun nextprime(res: NativeMPZ) `{
        mpz_nextprime(res, self);
    `}

    fun gcd(res, op: NativeMPZ) `{
        mpz_gcd(res, self, op);
    `}

    fun gcd_ui(res: NativeMPZ, op: UInt64) `{
        mpz_gcd_ui(res, self, *op);
    `}

    # Comparison Functions

    fun cmp(op: NativeMPZ): Int `{
        return mpz_cmp(self, op);
    `}

    fun cmp_si(op: Int): Int `{
        return mpz_cmp_si(self, op);
    `}

    # Assignment

    fun set(op: NativeMPZ) `{ mpz_set(self, op); `}

    fun set_si(op: Int) `{ mpz_set_si(self, op); `}

    fun set_d(op: Float) `{ mpz_set_d(self, op); `}

    fun set_q(op: NativeMPQ) `{ mpz_set_q(self, op); `}

    fun set_str(str: CString, base: Int32) `{
        mpz_set_str(self, str, base);
    `}

    fun swap(op: NativeMPZ) `{ mpz_swap(self, op); `}

    # Conversion Functions

    fun get_si: Int `{ return mpz_get_si(self); `}

    fun get_d: Float `{ return mpz_get_d(self); `}

    fun get_str(base: Int32): CString `{
        return mpz_get_str(NULL, base, self);
    `}

    # Delete this NativeMPZ
    fun finalize `{
        mpz_clear(self);
        free(self);
    `}
end
lib/gmp/native_gmp.nit:22,1--146,3