Averest


ZFnum Type

SchoenhageStrassen works on the ring ZF[2^{2^n}+1] having elements 0,...,2^{2^n}. We represent its elements as records with a number num and the information about the ring they belong to (the algorithm makes recursive calls to smaller rings ZF[2^{2^k}+1] so to avoid confusion about the rings we are currently working with, the numbers carry the information about the ring they belong to.

Record fields

Record Field Description

FermatNum

Full Usage: FermatNum

Field type: BigInteger
Field type: BigInteger

n

Full Usage: n

Field type: int
Field type: int

num

Full Usage: num

Field type: BigInteger
Field type: BigInteger

Instance members

Instance member Description

this.Negate

Full Usage: this.Negate

Returns: ZFnum

negate a number (compute its additive inverse)

Returns: ZFnum

this.Shift

Full Usage: this.Shift

Parameters:
    k : int

Returns: ZFnum

shift a number by k bits, i.e., multiply by 2^k

k : int
Returns: ZFnum

this.ToBinary

Full Usage: this.ToBinary

Returns: string

convert the number to its binary representation using 2^n bits where bytes are separated by : and the more significant ones are printed on the left hand side

Returns: string

Static members

Static member Description

x * y

Full Usage: x * y

Parameters:
Returns: ZFnum

Multiplication of numbers in ZF[2^{2^n}+1]

x : ZFnum
y : ZFnum
Returns: ZFnum

x + y

Full Usage: x + y

Parameters:
Returns: ZFnum

addition of numbers in ZF[2^{2^n}+1]

x : ZFnum
y : ZFnum
Returns: ZFnum

x - y

Full Usage: x - y

Parameters:
Returns: ZFnum

subtraction of numbers in ZF[2^{2^n}+1]

x : ZFnum
y : ZFnum
Returns: ZFnum

ZFnum.FromBigInteger(n, b)

Full Usage: ZFnum.FromBigInteger(n, b)

Parameters:
Returns: ZFnum

convert a BigInteger to a ZFnum

n : int
b : BigInteger
Returns: ZFnum

ZFnum.FromInteger(n, i)

Full Usage: ZFnum.FromInteger(n, i)

Parameters:
    n : int
    i : int

Returns: ZFnum

convert an integer to a ZFnum

n : int
i : int
Returns: ZFnum

ZFnum.PowerOf2(n) (k)

Full Usage: ZFnum.PowerOf2(n) (k)

Parameters:
    n : int
    k : int

Returns: ZFnum

generate the k-th power of 2

n : int
k : int
Returns: ZFnum