# ModularFactorizationOperations(PA, MMT, MD, PMD)ΒΆ

This category specifies operations needed by univariate factorization over finite fields

add_poly: (PA, PA, MD) -> PA

`add_poly(pol1, pol2, md)` add polynomials `pol1` and `pol2`.

copy_mat_part: (MMT, Integer) -> MMT

`copy_mat_part(man, nr)` creates copy of modular composition matrix stored in first `nr` rows of mat.

copy_poly: (PA, Integer, MD) -> PA

`copy_poly(pol, d, m)` creates copy of `pol` with enough space to represent polynomials of degree smaller than `d`. Error if degree of `pol` is bigger or equal than `d`.

degree: PA -> Integer

`degree(pol)` returns degree of the polynomial `pol`.

divide!: (PA, PA, MD) -> PA

`divide!(pol1, pol2, md)` performs division with remainder of `pol1` by `pol2`. `pol1` is modified in place to contain remainder. Quotient is return value.

empty_mat?: MMT -> Boolean

`empty_mat?(mat)` returns `true` if matrix is empty, `false` otherwise.

empty_mat: () -> MMT

`empty_mat()` returns empty (that is of dimensions 0) matrix.

empty_poly: () -> PA

`empty_poly()` returns empty (that is 0) polynomial.

gcd: (PA, PA, MD) -> PA

`gcd(pol1, pol2, md)` computes `gcd` of `pol1` and `pol2`.

get_char: MD -> Integer

`get_char(md)` returns characteristic of the field described by info `md`.

get_extension_degree: MD -> Integer

`get_extension_degree(md)` returns degree of the field described by info `md` over its prime subfield.

get_mod: PMD -> MD

`get_mod(pmd)` extracts field info from reduction data.

ini_rdata: (PA, MD) -> PMD

`ini_rdata(pv, p)` generates data allowing faster computation of remainders from division by `pv` modulo `p`. Result is used by other functions in this package, in particular `red_pol!`.

mod_exp: (PA, Integer, PMD) -> PA

`mod_exp(pv, d, rd)` computes `pv^d` modulo reduction data in `rd`.

modular_compose: (PA, MMT, PA, NonNegativeInteger, PMD) -> PA

`modular_compose(pol, pm, p1, l1, rd)` computes composion of `pol` with `p0` modulo reduction data `rd`. `pm` and `p1` are as from call to `power_matrix(p0, l1, rd)`.

monomial1: MD -> PA

`monomial1(md)` returns monomial of degree 1 with coefficient 1.

power_matrix: (PA, NonNegativeInteger, PMD) -> Record(matr: MMT, poly: PA)

`power_matrix(s, l, rd)` computes [`m`, `p`] such that `p = s^l` modulo reduction data `rd` and column `j` of `m` contain `s^j` modulo reduction data `rd`. Note that lowest column index is `j = 0` and highest index is `j=l-1`. `rd` should be obtained by earlier call to `ini_rdata`.

random_poly: (Integer, MD) -> PA

`random_poly(n, md)` generated random polynomial of degree `n`.

red_pol!: (PA, PMD) -> PA

`red_pol!(pv, rd)` computes remainder of `pv` using reduction data `rd` produced by earlier call to `ini_rdata`.

shift_mat!: (MMT, Integer, Integer) -> Void

`shift_mat!(mat, sa, nr)` moves modular composition matrix stored in `nr` rows of `mat` starting at `sa` to first `nr` rows of `mat`. This is designed to work on output of split_mat!.

split_mat!: (MMT, Integer, Integer, Integer, PMD, PMD) -> Void

`split_mat!(mat, nr0, nr1, nr2, pmod1, pmod2)` splits modular composition matrix `mat` into two matrices, first modulo `pmod1`, second modulo `pmod2`. To save space first result replaces first `nr1` rows of `mat`, second result is stored in next `nr2` rows of `mat`. `nr0` is number of rows used in argument.

sub1!: (PA, MD) -> PA

`sub1!(pol, md)` subtracts 1 from the polynomial `pol`.

sub_poly: (PA, PA, MD) -> PA

`sub_poly(pol1, pol2, md)` subtracts polynomials `pol2` from `pol1`.

trim_mat!: (MMT, Integer, Integer, PMD) -> Void

`trim_mat!(mat, nr0, nc1, pmod)` reduces modular composition matrix `mat` modulo reduction data pmod. `nr0` is number of rows used in argument, `nr1` is number of rows used in the result. `mat` is is modified in place.