Main Page | Class List | File List | Class Members | File Members

matrix_addon.c File Reference

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

Go to the source code of this file.

Functions

MatrixconstraintsView (Polyhedron *P)
 Creates a view of the constraints of a polyhedron as a Matrix *.

void constraintsView_Free (Matrix *M)
 "Frees" a view of the constraints of a polyhedron

void split_constraints (Matrix const *M, Matrix **Eqs, Matrix **Ineqs)
 splits a matrix of constraints M into a matrix of equalities Eqs and a matrix of inequalities Ineqs allocs the new matrices.

MatrixIdentity_Matrix (unsigned int dim)
void Matrix_identity (unsigned int dim, Matrix **I)
 returns the dim-dimensional identity matrix.

void mtransformation_inverse (Matrix *transf, Matrix **inverse, Value *g)
 given a n x n integer transformation matrix transf, compute its inverse M/g, where M is a nxn integer matrix.

Matrixmtransformation_expand_left_to_dim (Matrix *M, int new_dim)
 takes a transformation matrix, and expands it to a higher dimension with the identity matrix regardless of it homogeneousness

void mpolyhedron_simplify (Matrix *polyh)
 simplify a matrix seen as a polyhedron, by dividing its rows by the gcd of their elements.

void mpolyhedron_inflate (Matrix *polyh, unsigned int nb_parms)
 inflates a polyhedron (represented as a matrix) P, so that the apx of its Ehrhart Polynomial is an upper bound of the Ehrhart polynomial of P WARNING: this inflation is supposed to be applied on full-dimensional polyhedra.

void mpolyhedron_deflate (Matrix *polyh, unsigned int nb_parms)
 deflates a polyhedron (represented as a matrix) P, so that the apx of its Ehrhart Polynomial is a lower bound of the Ehrhart polynomial of P WARNING: this deflation is supposed to be applied on full-dimensional polyhedra.

void eliminate_var_with_constr (Matrix *Eliminator, unsigned int eliminator_row, Matrix *Victim, unsigned int victim_row, unsigned int var_to_elim)
 use an eliminator row to eliminate a variable in a victim row (without changing the sign of the victim row -> important if it is an inequality).

void mpolyhedron_compress_last_vars (Matrix *M, Matrix *compression)
 compress the last vars/pars of the polyhedron M expressed as a polylib matrix - adresses the full-rank compressions only - modfies M

unsigned int mpolyhedron_eliminate_first_variables (Matrix *Eqs, Matrix *Ineqs)
 use a set of m equalities Eqs to eliminate m variables in the polyhedron Ineqs represented as a matrix eliminates the m first variables - assumes that Eqs allow to eliminate the m equalities - modifies Eqs and Ineqs

void Matrix_subMatrix (Matrix *M, unsigned int sr, unsigned int sc, unsigned int er, unsigned int ec, Matrix **sub)
 returns a contiguous submatrix of a matrix.

void Matrix_clone (Matrix *M, Matrix **Cl)
 Cloning funciton.

void Matrix_copySubMatrix (Matrix *M1, unsigned int sr1, unsigned int sc1, unsigned int nbR, unsigned int nbC, Matrix *M2, unsigned int sr2, unsigned int sc2)
 Copies a contiguous submatrix of M1 into M2, at the indicated position.

void Matrix_oppose (Matrix *M)
 given a matrix M into -M


Function Documentation

Matrix* constraintsView Polyhedron P  ) 
 

Creates a view of the constraints of a polyhedron as a Matrix *.

Definition at line 15 of file matrix_addon.c.

References polyhedron::Constraint, polyhedron::Dimension, Matrix, matrix::NbColumns, polyhedron::NbConstraints, matrix::NbRows, matrix::p, and Polyhedron.

void constraintsView_Free Matrix M  ) 
 

"Frees" a view of the constraints of a polyhedron

Definition at line 24 of file matrix_addon.c.

References Matrix.

void eliminate_var_with_constr Matrix Eliminator,
unsigned int  eliminator_row,
Matrix Victim,
unsigned int  victim_row,
unsigned int  var_to_elim
 

use an eliminator row to eliminate a variable in a victim row (without changing the sign of the victim row -> important if it is an inequality).

Parameters:
Eliminator the matrix containing the eliminator row
eliminator_row the index of the eliminator row in Eliminator
Victim the matrix containing the row to be eliminated
victim_row the row to be eliminated in Victim
var_to_elim the variable to be eliminated.

Definition at line 227 of file matrix_addon.c.

References Lcm3(), Matrix, matrix::NbColumns, matrix::p, value_addto, value_clear, value_division, value_init, value_multiply, value_notzero_p, value_oppose, and value_pos_p.

Referenced by Constraints_Remove_parm_eqs(), and mpolyhedron_eliminate_first_variables().

Matrix* Identity_Matrix unsigned int  dim  ) 
 

Definition at line 63 of file matrix_addon.c.

References Matrix, Matrix_Alloc(), matrix::p, and value_set_si.

Referenced by full_dimensionize(), Matrix_identity(), and mtransformation_expand_left_to_dim().

void Matrix_clone Matrix M,
Matrix **  Cl
 

Cloning funciton.

Similar to Matrix_Copy() but allocates the target matrix if it is set to NULL

Definition at line 363 of file matrix_addon.c.

References Matrix, Matrix_subMatrix(), matrix::NbColumns, and matrix::NbRows.

Referenced by Constraints_removeElimCols().

void Matrix_copySubMatrix Matrix M1,
unsigned int  sr1,
unsigned int  sc1,
unsigned int  nbR,
unsigned int  nbC,
Matrix M2,
unsigned int  sr2,
unsigned int  sc2
 

Copies a contiguous submatrix of M1 into M2, at the indicated position.

M1 and M2 are assumed t be allocated already.

Parameters:
M1 the source matrix
sr1 the starting source row
sc1 the starting source column
nbR the number of rows
nbC the number of columns
M2 the target matrix
sr2 the starting target row
sc2 the starting target column

Definition at line 380 of file matrix_addon.c.

References Matrix, matrix::p, and Vector_Copy().

Referenced by Equalities_intModBasis(), Equalities_validityLattice(), Lattice_extractSubLattice(), and linearInter().

void Matrix_identity unsigned int  dim,
Matrix **  I
 

returns the dim-dimensional identity matrix.

If I is set to NULL, allocates it first. Else, assumes an existing, allocated Matrix.

Definition at line 82 of file matrix_addon.c.

References assert, Identity_Matrix(), Matrix, and value_set_si.

Referenced by Constraints_fullDimensionize().

void Matrix_oppose Matrix M  ) 
 

given a matrix M into -M

Definition at line 395 of file matrix_addon.c.

References Matrix, matrix::NbColumns, matrix::NbRows, matrix::p, and value_oppose.

Referenced by Equalities_integerSolution().

void Matrix_subMatrix Matrix M,
unsigned int  sr,
unsigned int  sc,
unsigned int  er,
unsigned int  ec,
Matrix **  sub
 

returns a contiguous submatrix of a matrix.

Parameters:
M the input matrix
sr the index of the starting row
sc the index of the starting column
er the index ofthe ending row (excluded)
ec the ined of the ending colummn (excluded)
sub (returned), the submatrix. Allocated if set to NULL, assumed to be already allocated else.

Definition at line 343 of file matrix_addon.c.

References assert, Matrix, Matrix_Alloc(), matrix::p, and Vector_Copy().

Referenced by Equalities_integerSolution(), Equalities_validityLattice(), int_ker(), Lattice_extractSubLattice(), linearInter(), and Matrix_clone().

void mpolyhedron_compress_last_vars Matrix M,
Matrix compression
 

compress the last vars/pars of the polyhedron M expressed as a polylib matrix - adresses the full-rank compressions only - modfies M

Definition at line 279 of file matrix_addon.c.

References assert, Matrix, Matrix_Alloc(), Matrix_Free(), matrix::NbColumns, matrix::NbRows, matrix::p, value_addmul, value_assign, and value_set_si.

Referenced by Ehrhart_Quick_Apx(), and full_dimensionize().

void mpolyhedron_deflate Matrix polyh,
unsigned int  nb_parms
 

deflates a polyhedron (represented as a matrix) P, so that the apx of its Ehrhart Polynomial is a lower bound of the Ehrhart polynomial of P WARNING: this deflation is supposed to be applied on full-dimensional polyhedra.

Definition at line 199 of file matrix_addon.c.

References Matrix, matrix::NbColumns, matrix::NbRows, matrix::p, value_addto, value_clear, value_init, value_pos_p, value_set_si, and value_subtract.

Referenced by main().

unsigned int mpolyhedron_eliminate_first_variables Matrix Eqs,
Matrix Ineqs
 

use a set of m equalities Eqs to eliminate m variables in the polyhedron Ineqs represented as a matrix eliminates the m first variables - assumes that Eqs allow to eliminate the m equalities - modifies Eqs and Ineqs

Definition at line 307 of file matrix_addon.c.

References eliminate_var_with_constr(), Matrix, matrix::NbRows, matrix::p, value_cmp_si, and value_set_si.

Referenced by full_dimensionize().

void mpolyhedron_inflate Matrix polyh,
unsigned int  nb_parms
 

inflates a polyhedron (represented as a matrix) P, so that the apx of its Ehrhart Polynomial is an upper bound of the Ehrhart polynomial of P WARNING: this inflation is supposed to be applied on full-dimensional polyhedra.

Definition at line 176 of file matrix_addon.c.

References Matrix, matrix::NbColumns, matrix::NbRows, matrix::p, value_addto, value_clear, value_init, value_neg_p, value_set_si, and value_subtract.

Referenced by main().

void mpolyhedron_simplify Matrix polyh  ) 
 

simplify a matrix seen as a polyhedron, by dividing its rows by the gcd of their elements.

Definition at line 155 of file matrix_addon.c.

References Gcd(), Matrix, matrix::NbColumns, matrix::NbRows, matrix::p, value_clear, value_division, value_init, value_print, and value_set_si.

Matrix* mtransformation_expand_left_to_dim Matrix M,
int  new_dim
 

takes a transformation matrix, and expands it to a higher dimension with the identity matrix regardless of it homogeneousness

Definition at line 138 of file matrix_addon.c.

References assert, Identity_Matrix(), Matrix, matrix::NbColumns, matrix::NbRows, matrix::p, and value_assign.

void mtransformation_inverse Matrix transf,
Matrix **  inverse,
Value *  g
 

given a n x n integer transformation matrix transf, compute its inverse M/g, where M is a nxn integer matrix.

g is a common denominator for elements of (transf^{-1})

Definition at line 106 of file matrix_addon.c.

References Lcm3(), MatInverse(), Matrix, Matrix_Alloc(), Matrix_Copy(), Matrix_Free(), matrix::NbColumns, matrix::NbRows, matrix::p, value_clear, value_division, value_init, value_multiply, and value_set_si.

void split_constraints Matrix const *  M,
Matrix **  Eqs,
Matrix **  Ineqs
 

splits a matrix of constraints M into a matrix of equalities Eqs and a matrix of inequalities Ineqs allocs the new matrices.

Allocates Eqs and Ineqs.

Definition at line 33 of file matrix_addon.c.

References Matrix, Matrix_Alloc(), matrix::NbColumns, matrix::NbRows, matrix::p, value_assign, and value_zero_p.

Referenced by Constraints_fullDimensionize(), and full_dimensionize().


Generated on Mon Apr 23 19:23:54 2007 for polylib by doxygen 1.3.5