polylib: NormalForms.c File Reference

# NormalForms.c File Reference

`#include <stdlib.h>`
`#include <polylib/polylib.h>`

Go to the source code of this file.

## Functions
static void | moins_l (Value *a, int i, int n, int p)
static void | moins_c (Value *a, int i, int n, int p)
static void | echange_l (Value *a, int i, int j, int n, int p)
static void | echange_c (Value *a, int i, int j, int n, int p)
static void | ligne (Value *a, int i, int j, Value x, int n, int p)
static void | colonne (Value *a, int i, int j, Value x, int n, int p)
static int | petit_l (Value *a, int n, int p, int q)
static int | petit_c (Value *a, int n, int p, int q)
static void | identite (Value *a, int n, int p)
static void | transpose (Value *a, int n, int q)
static int | encore (Value *a, int n, int p, int q, Value val)
static void | smith (Value *a, Value *b, Value *c, Value *b_inverse, Value *c_inverse, int n, int p, int q)
static void | hermite (Value *a, Value *b, Value *d, int n, int p, int q)
static Value * | ConvertPolMattoDarMat (Matrix *A)
| Convert PolmattoDarmat : This function converts the matrix of a Polylib to a int * as necessary for the functions in Darte's implementation.
static Matrix * | ConvertDarMattoPolMat (Value *A, int NbRows, int NbCols)
| Convert DarmattoPolmat This function converts the matrix from Darte representation to a matrix in PolyLib.
void | Smith (Matrix *A, Matrix **U, Matrix **V, Matrix **Product)
| Smith : This function takes a Matrix A of dim n * l as its input and returns the three matrices U, V and Product such that A = U * Product * V, where U is an unimodular matrix of dimension n * n and V is an unimodular matrix of dimension l * l.
void | Hermite (Matrix *A, Matrix **H, Matrix **U)
| Hermite : This function takes a Matrix as its input and finds its HNF ( Left form ).

## Function Documentation

static void colonne | ( | Value * | a,
|  | int | i,
|  | int | j,
|  | Value | x,
|  | int | n,
|  | int | p |
| ) |  |  | `[static]`

Definition at line 146 of file NormalForms.c.

References value_addmul.

Referenced by hermite(), and smith().

static Matrix* ConvertDarMattoPolMat | ( | Value * | A,
|  | int | NbRows,
|  | int | NbCols |
| ) |  |  | `[static]`

Convert DarmattoPolmat This function converts the matrix from Darte representation to a matrix in PolyLib.

Input : The matrix (a pointer to it), number of Rows, number of columns Output : The matrix of the PolyLib

Definition at line 604 of file NormalForms.c.

References Matrix_Alloc(), matrix::p, and value_assign.

Referenced by Hermite().

static Value* ConvertPolMattoDarMat | ( | Matrix * | A | ) | `[static]`

Convert PolmattoDarmat : This function converts the matrix of a Polylib to a int * as necessary for the functions in Darte's implementation.

Input : A Polylib Matrix ( a pointer to it ); Output : An int * with the matrix copied into it

Definition at line 580 of file NormalForms.c.

References matrix::NbColumns, matrix::NbRows, matrix::p, value_assign, and value_init.

Referenced by Hermite().

static void echange_c | ( | Value * | a,
|  | int | i,
|  | int | j,
|  | int | n,
|  | int | p |
| ) |  |  | `[static]`

Definition at line 93 of file NormalForms.c.

References s, value_assign, value_clear, and value_init.

Referenced by hermite(), and smith().

static void echange_l | ( | Value * | a,
|  | int | i,
|  | int | j,
|  | int | n,
|  | int | p |
| ) |  |  | `[static]`

Definition at line 67 of file NormalForms.c.

References s, value_assign, value_clear, and value_init.

Referenced by hermite(), and smith().

static int encore | ( | Value * | a,
|  | int | n,
|  | int | p,
|  | int | q,
|  | Value | val |
| ) |  |  | `[static]`

Definition at line 329 of file NormalForms.c.

References value_absolute, value_clear, value_init, value_modulus, value_notzero_p, and value_zero_p.

Referenced by smith().

void Hermite | ( | Matrix * | A,
|  | Matrix ** | H,
|  | Matrix ** | U |
| ) |  |  |

Hermite : This function takes a Matrix as its input and finds its HNF ( Left form ).

Input : A Matrix A (The Matrix A is not necessarily a Polylib matrix. It is just a matrix as far as Hermite is concerned. It does not even check if the matrix is a Polylib matrix or not) Output : The Hnf matrix H and the Unimodular matrix U such that A = H * U.

We use Alan Darte's implementation of Hermite to compute the HNF. Alan Darte's implementation computes the Upper Triangular HNF. So We work on the fact that if A = H * U then A (transpose) = U(transpose) * H (transpose) There are a set of interface functions written in Interface.c which convert a matrix from Polylib representationt to that of Alan Darte's and vice versa.

This Function Does the Following Step 1 : Given the matrix A it finds its Transpose. Step 2 : Finds the HNF (Right Form) using Alan Darte's Algorithm. Step 3 : The H1 and U1 obtained in Step2 are both Transposed to get the actual H and U such that A = HU.

Definition at line 670 of file NormalForms.c.

References ConvertDarMattoPolMat(), ConvertPolMattoDarMat(), hermite(), identite(), Matrix_Copy(), Matrix_Free(), matrix::NbColumns, matrix::NbRows, Transpose(), transpose(), value_clear, and value_init.

Referenced by AffineHermite(), findHermiteBasis(), isfulldim(), RearrangeMatforSolveDio(), and SolveDiophantine().

static void hermite | ( | Value * | a,
|  | Value * | b,
|  | Value * | d,
|  | int | n,
|  | int | p,
|  | int | q |
| ) |  |  | `[static]`

Definition at line 492 of file NormalForms.c.

References colonne(), echange_c(), echange_l(), ligne(), moins_c(), moins_l(), petit_c(), value_assign, value_clear, value_decrement, value_division, value_init, value_modulus, value_neg_p, value_notzero_p, and value_oppose.

Referenced by Hermite().

static void identite | ( | Value * | a,
|  | int | n,
|  | int | p |
| ) |  |  | `[static]`

Definition at line 272 of file NormalForms.c.

References value_set_si.

Referenced by Hermite().

static void ligne | ( | Value * | a,
|  | int | i,
|  | int | j,
|  | Value | x,
|  | int | n,
|  | int | p |
| ) |  |  | `[static]`

Definition at line 121 of file NormalForms.c.

References value_addmul.

Referenced by hermite(), and smith().

static void moins_c | ( | Value * | a,
|  | int | i,
|  | int | n,
|  | int | p |
| ) |  |  | `[static]`

Definition at line 48 of file NormalForms.c.

References value_oppose.

Referenced by hermite(), and smith().

static void moins_l | ( | Value * | a,
|  | int | i,
|  | int | n,
|  | int | p |
| ) |  |  | `[static]`

Definition at line 29 of file NormalForms.c.

References value_oppose.

Referenced by hermite(), and smith().

static int petit_c | ( | Value * | a,
|  | int | n,
|  | int | p,
|  | int | q |
| ) |  |  | `[static]`

Definition at line 225 of file NormalForms.c.

References value_absolute, value_assign, value_clear, value_ge, value_init, and value_notzero_p.

Referenced by hermite(), and smith().

static int petit_l | ( | Value * | a,
|  | int | n,
|  | int | p,
|  | int | q |
| ) |  |  | `[static]`

Definition at line 173 of file NormalForms.c.

References value_absolute, value_assign, value_clear, value_ge, value_init, and value_notzero_p.

Referenced by smith().

void Smith | ( | Matrix * | A,
|  | Matrix ** | U,
|  | Matrix ** | V,
|  | Matrix ** | Product |
| ) |  |  |

Smith : This function takes a Matrix A of dim n * l as its input and returns the three matrices U, V and Product such that A = U * Product * V, where U is an unimodular matrix of dimension n * n and V is an unimodular matrix of dimension l * l.

Product is a diagonal matrix of dimension n * l.

We use Alan Darte's implementation of Smith for computing the Smith Normal Form

Definition at line 627 of file NormalForms.c.

References Identity(), Matrix_Copy(), Matrix_Free(), matrix::NbColumns, matrix::NbRows, matrix::p_Init, and smith().

Referenced by AffineSmith(), and Lattice2LatticeUnion().

static void smith | ( | Value * | a,
|  | Value * | b,
|  | Value * | c,
|  | Value * | b_inverse,
|  | Value * | c_inverse,
|  | int | n,
|  | int | p,
|  | int | q |
| ) |  |  | `[static]`

Definition at line 383 of file NormalForms.c.

References colonne(), echange_c(), echange_l(), encore(), ligne(), moins_c(), moins_l(), petit_c(), petit_l(), value_assign, value_clear, value_decrement, value_division, value_init, value_modulus, value_neg_p, value_notzero_p, value_oppose, and value_set_si.

Referenced by Smith().

static void transpose | ( | Value * | a,
|  | int | n,
|  | int | q |
| ) |  |  | `[static]`

Definition at line 297 of file NormalForms.c.

References value_assign, value_clear, and value_init.

Referenced by Hermite(), and Transpose().