# IntegralBasisTools(R, UP, F)¶

This package contains functions used in the packages FunctionFieldIntegralBasis and NumberFieldIntegralBasis.

diagonalProduct: Matrix R -> R

`diagonalProduct(m)` returns the product of the elements on the diagonal of the matrix `m`

divideIfCan!: (Matrix R, Matrix R, R, Integer) -> R

`divideIfCan!(matrix, matrixOut, prime, n)` attempts to divide the entries of `matrix` by `prime` and store the result in `matrixOut`. If it is successful, 1 is returned and if not, `prime` is returned. Here both `matrix` and `matrixOut` are `n`-by-`n` upper triangular matrices.

idealiser: (Matrix R, Matrix R) -> Matrix R

`idealiser(m1, m2)` computes the order of an ideal defined by `m1` and `m2`

idealiser: (Matrix R, Matrix R, R) -> Matrix R

`idealiser(m1, m2, d)` computes the order of an ideal defined by `m1` and `m2` where `d` is the known part of the denominator

idealiserMatrix: (Matrix R, Matrix R) -> Matrix R

`idealiserMatrix(m1, m2)` returns the matrix representing the linear conditions on the Ring associated with an ideal defined by `m1` and `m2`.

leastPower: (NonNegativeInteger, NonNegativeInteger) -> NonNegativeInteger

`leastPower(p, n)` returns `e`, where `e` is the smallest integer such that `p ^e >= n`

matrixGcd: (Matrix R, R, NonNegativeInteger) -> R

`matrixGcd(mat, sing, n)` is `gcd(sing, g)` where `g` is the `gcd` of the entries of the `n`-by-`n` upper-triangular matrix `mat`.

moduleSum: (Record(basis: Matrix R, basisDen: R, basisInv: Matrix R), Record(basis: Matrix R, basisDen: R, basisInv: Matrix R)) -> Record(basis: Matrix R, basisDen: R, basisInv: Matrix R)

`moduleSum(m1, m2)` returns the sum of two modules in the framed algebra `F`. Each module `mi` is represented as follows: `F` is a framed algebra with `R`-module basis `w1, w2, ..., wn` and `mi` is a record `[basis, basisDen, basisInv]`. If `basis` is the matrix `(aij, i = 1..n, j = 1..n)`, then a basis `v1, ..., vn` for `mi` is given by `vi = (1/basisDen) * sum(aij * wj, j = 1..n)`, i.e. the `i`th row of ‘basis’ contains the coordinates of the `i`th basis vector. Similarly, the `i`th row of the matrix `basisInv` contains the coordinates of `wi` with respect to the basis `v1, ..., vn`: if `basisInv` is the matrix `(bij, i = 1..n, j = 1..n)`, then `wi = sum(bij * vj, j = 1..n)`.