OPENF4
Library for Gröebner basis computations over finite fields.
|
Represent a matrix. More...
#include <matrix.h>
Public Member Functions | |
Matrix () | |
Constructor. | |
Matrix (int height, int width) | |
Constructor. More... | |
Matrix (std::string const &filename) | |
Constructor. More... | |
Matrix (Matrix const &matrix) | |
Copy constructor. More... | |
Matrix (Matrix &&matrix) | |
Move constructor. More... | |
~Matrix () | |
Destructor. | |
Element & | operator() (int row, int col) |
Modify matrix element. More... | |
Element | operator() (int row, int col) const |
Get matrix element. More... | |
Element | getElement (int row, int col) const |
Get matrix element. More... | |
void | setElement (int row, int col, Element const &element) |
Modify matrix element. More... | |
Element * | getRow (int row) |
Get the row-th row of this. More... | |
int | getHeight () const |
Get the height of the matrix (number of rows). | |
int | getWidth () const |
Get the width of the matrix (number of columns). | |
void | setNbPiv (int nbPiv) |
Specify the number of pivots. | |
int | getNbPiv () const |
Get the number of pivots. | |
void | setTau (int *tau) |
Specify the permutation _tau. | |
int * | getTau () |
Get the permutation _tau. | |
void | setSigma (int *sigma) |
Specify the permutation _sigma. | |
int * | getSigma () |
Get the permutation _sigma. | |
void | setStartTail (int *startTail) |
Specify the array _startTail. | |
int * | getStartTail () |
Get the array _startTail. | |
void | setEndCol (int *encCol) |
Specify the array _endCol. | |
int * | getEndCol () |
Get the array _endCol. | |
void | setInfo (int nbPiv, int *tau, int *sigma, int *startTail, int *endCol) |
Set the informations required by echelonize. | |
void | printMatrix (std::ostream &stream) const |
Print the matrix. | |
void | printMatrix (std::string const &filename) const |
Print the matrix. | |
void | printMatrixTxt (std::string const &filename) const |
Print the matrix in a format readable by constructor. | |
void | printMatrixSage (std::string const &filename) const |
Print the matrix in a format readable by sage. | |
bool | isZero (int row, int col) const |
Test if _matrix(row,col) is zero. More... | |
void | normalizeRow (Element *row, int start, int end) |
Normalize a slice of the row-th row. More... | |
void | normalizeRowPrime (Element *row, int start, int end) |
Specialisation of normalizeRow for ElementPrime type. More... | |
void | normalizeRowGF2Extension (Element *row, int start, int end) |
Specialisation of normalizeRow for ElementGF2Extension type. More... | |
void | multRow (Element *row, Element const &element, int start, int end) |
Multiply a slice of the row-th row by element. More... | |
void | multRowPrime (Element *row, Element const &element, int start, int end) |
Specialisation of multRow for ElementPrime type. More... | |
void | multRowGF2Extension (Element *row, Element const &element, int start, int end) |
Specialisation of multRow for ElementGF2Extension type. More... | |
void | addMultRow (Element *row1, Element *row2, Element element, int start, int end) |
Multiply a slice of the row1-th row by element and add a slice of the row2-th row. More... | |
void | addMultRowPrime (Element *row1, Element *row2, Element element, int start, int end) |
Specialisation of addMultRow for ElementPrime type. More... | |
void | addMultRowGF2Extension (Element *row1, Element *row2, Element element, int start, int end) |
Specialisation of addMultRow for ElementGF2Extension type. More... | |
void | doubleAddMultRowGF2Extension (Element *dest1, Element *dest2, Element mult1, Element mult2, Element *vec, int start, int end) |
dest1 += mult1 * vec, dest2 += mult2 * vec. More... | |
void | tripleAddMultRowGF2Extension (Element *dest1, Element *dest2, Element *dest3, Element mult1, Element mult2, Element mult3, Element *vec, int start, int end) |
dest1 += mult1 * vec, dest2 += mult2 * vec, dest3 += mult3 * vec. More... | |
void | quadAddMultRowGF2Extension (Element *dest1, Element *dest2, Element *dest3, Element *dest4, Element mult1, Element mult2, Element mult3, Element mult4, Element *vec, int start, int end) |
dest1 += mult1 * vec, dest2 += mult2 * vec, dest3 += mult3 * vec, dest4 += mult4 * vec. More... | |
void | octAddMultRowGF2Extension (Element *dest1, Element *dest2, Element *dest3, Element *dest4, Element *dest5, Element *dest6, Element *dest7, Element *dest8, Element mult1, Element mult2, Element mult3, Element mult4, Element mult5, Element mult6, Element mult7, Element mult8, Element *vec, int start, int end) |
dest1 += mult1 * vec, dest2 += mult2 * vec, dest3 += mult3 * vec, dest4 += mult4 * vec, dest5 += mult5 * vec, dest6 += mult6 * vec, dest7 += mult7 * vec, dest8 += mult8 * vec. More... | |
void | groupAddMultRowGF2Extension (int ll, int dec, int startL2, int endL2, int start, int end) |
Use octAddMultRowGF2Extension, quadAddMultRowGF2Extension, tripleAddMultRowGF2Extension, doubleAddMultRowGF2Extension and addMultRowGF2Extension to suppress elements in column ll+dec from row startL2 to row endL2 using multiple of row ll. More... | |
void | swapRow (int numRow1, int numRow2) |
Swap a slice of the row1-th row with a slice of the row2-th row. More... | |
void | swapCol (int numCol1, int numCol2, int start, int end) |
Swap a slice of the row1-th row with a slice of the row2-th row. More... | |
int | echelonizeRight (chrono::duration< int, milli > &tmp_ech_db, chrono::duration< int, milli > &tmp_ech_dh) |
Echelonize the left slice of the matrix using FFLAS-FFPACK routines. More... | |
int | echelonize () |
Echelonize the matrix using the shape of the F4 matrix. More... | |
int | echelonizePrime () |
Specialisation of echelonize for ElementPrime Type, use lazy arithmetic. More... | |
int | echelonizeGF2Extension () |
Specialisation of echelonize for ElementGF2Extension Type. More... | |
Matrix & | operator= (Matrix const &matrix) |
Overload the operator =. More... | |
Matrix & | operator= (Matrix &&matrix) |
Overload the operator = (move assignment). Used when mon is unnamed (only copy the pointer). More... | |
Private Attributes | |
Element ** | _matrix |
int | _height |
int | _width |
int | _nbPiv |
int * | _tau |
int * | _sigma |
int * | _startTail |
int * | _endCol |
Represent a matrix.
F4::Matrix< Element >::Matrix | ( | int | height, |
int | width | ||
) |
Constructor.
height | Height of _matrix. |
width | Width of _matrix. |
F4::Matrix< Element >::Matrix | ( | std::string const & | filename | ) |
Constructor.
filename | Name of a matrix file. |
F4::Matrix< Element >::Matrix | ( | Matrix< Element > const & | matrix | ) |
Copy constructor.
matrix | Matrix. |
F4::Matrix< Element >::Matrix | ( | Matrix< Element > && | matrix | ) |
Move constructor.
matrix | Matrix. |
void F4::Matrix< Element >::addMultRow | ( | Element * | row1, |
Element * | row2, | ||
Element | element, | ||
int | start, | ||
int | end | ||
) |
Multiply a slice of the row1-th row by element and add a slice of the row2-th row.
row1 | Row of the matrix. The one to modify. |
row2 | Row of the matrix. |
element | Element used to multiply each element of the slice. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::addMultRowGF2Extension | ( | Element * | row1, |
Element * | row2, | ||
Element | element, | ||
int | start, | ||
int | end | ||
) |
Specialisation of addMultRow for ElementGF2Extension type.
row1 | Row of the matrix. The one to modify. |
row2 | Row of the matrix. |
element | Element used to multiply each element of the slice. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::addMultRowPrime | ( | Element * | row1, |
Element * | row2, | ||
Element | element, | ||
int | start, | ||
int | end | ||
) |
Specialisation of addMultRow for ElementPrime type.
row1 | Row of the matrix. The one to modify. |
row2 | Row of the matrix. |
element | Element used to multiply each element of the slice. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::doubleAddMultRowGF2Extension | ( | Element * | dest1, |
Element * | dest2, | ||
Element | mult1, | ||
Element | mult2, | ||
Element * | vec, | ||
int | start, | ||
int | end | ||
) |
dest1 += mult1 * vec, dest2 += mult2 * vec.
dest1 | Row of the matrix to modify. |
dest2 | Row of the matrix to modify. |
mult1 | Element used to multiply each element of the slice. |
mult2 | Element used to multiply each element of the slice. |
vec | Row of the matrix to add. |
start | Beginning of the slice. |
end | End of the slice. |
int F4::Matrix< Element >::echelonize | ( | ) |
Echelonize the matrix using the shape of the F4 matrix.
int F4::Matrix< Element >::echelonizeGF2Extension | ( | ) |
Specialisation of echelonize for ElementGF2Extension Type.
int F4::Matrix< Element >::echelonizePrime | ( | ) |
Specialisation of echelonize for ElementPrime Type, use lazy arithmetic.
int F4::Matrix< Element >::echelonizeRight | ( | chrono::duration< int, milli > & | tmp_ech_db, |
chrono::duration< int, milli > & | tmp_ech_dh | ||
) |
Echelonize the left slice of the matrix using FFLAS-FFPACK routines.
Element F4::Matrix< Element >::getElement | ( | int | row, |
int | col | ||
) | const |
Get matrix element.
row | Row of the element. |
col | Column of the element. |
Element* F4::Matrix< Element >::getRow | ( | int | row | ) |
Get the row-th row of this.
row | Index of the row. |
void F4::Matrix< Element >::groupAddMultRowGF2Extension | ( | int | ll, |
int | dec, | ||
int | startL2, | ||
int | endL2, | ||
int | start, | ||
int | end | ||
) |
Use octAddMultRowGF2Extension, quadAddMultRowGF2Extension, tripleAddMultRowGF2Extension, doubleAddMultRowGF2Extension and addMultRowGF2Extension to suppress elements in column ll+dec from row startL2 to row endL2 using multiple of row ll.
ll | Pivot row. |
dec | Gap between ll and modified column. |
startL2 | First row to modify (set 0 in _matrix[startL2][ll+dec]). |
endL2 | Last row to modify is endL2-1 (set 0 in _matrix[endL2-1][ll+dec]). |
start | Beginning of the slice to modify. |
end | End of the slice. |
bool F4::Matrix< Element >::isZero | ( | int | row, |
int | col | ||
) | const |
Test if _matrix(row,col) is zero.
row | Row of the element. |
col | Column of the element. |
void F4::Matrix< Element >::multRow | ( | Element * | row, |
Element const & | element, | ||
int | start, | ||
int | end | ||
) |
Multiply a slice of the row-th row by element.
row | Row of the matrix. |
element | Element used to multiply each element of the slice. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::multRowGF2Extension | ( | Element * | row, |
Element const & | element, | ||
int | start, | ||
int | end | ||
) |
Specialisation of multRow for ElementGF2Extension type.
row | Row of the matrix. |
element | Element used to multiply each element of the slice. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::multRowPrime | ( | Element * | row, |
Element const & | element, | ||
int | start, | ||
int | end | ||
) |
Specialisation of multRow for ElementPrime type.
row | Row of the matrix. |
element | Element used to multiply each element of the slice. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::normalizeRow | ( | Element * | row, |
int | start, | ||
int | end | ||
) |
Normalize a slice of the row-th row.
row | Row to normalize. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::normalizeRowGF2Extension | ( | Element * | row, |
int | start, | ||
int | end | ||
) |
Specialisation of normalizeRow for ElementGF2Extension type.
row | Row to normalize. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::normalizeRowPrime | ( | Element * | row, |
int | start, | ||
int | end | ||
) |
Specialisation of normalizeRow for ElementPrime type.
row | Row to normalize. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::octAddMultRowGF2Extension | ( | Element * | dest1, |
Element * | dest2, | ||
Element * | dest3, | ||
Element * | dest4, | ||
Element * | dest5, | ||
Element * | dest6, | ||
Element * | dest7, | ||
Element * | dest8, | ||
Element | mult1, | ||
Element | mult2, | ||
Element | mult3, | ||
Element | mult4, | ||
Element | mult5, | ||
Element | mult6, | ||
Element | mult7, | ||
Element | mult8, | ||
Element * | vec, | ||
int | start, | ||
int | end | ||
) |
dest1 += mult1 * vec, dest2 += mult2 * vec, dest3 += mult3 * vec, dest4 += mult4 * vec, dest5 += mult5 * vec, dest6 += mult6 * vec, dest7 += mult7 * vec, dest8 += mult8 * vec.
dest1 | Row of the matrix to modify. |
dest2 | Row of the matrix to modify. |
dest3 | Row of the matrix to modify. |
dest4 | Row of the matrix to modify. |
dest5 | Row of the matrix to modify. |
dest6 | Row of the matrix to modify. |
dest7 | Row of the matrix to modify. |
dest8 | Row of the matrix to modify. |
mult1 | Element used to multiply each element of the slice. |
mult2 | Element used to multiply each element of the slice. |
mult3 | Element used to multiply each element of the slice. |
mult4 | Element used to multiply each element of the slice. |
mult5 | Element used to multiply each element of the slice. |
mult6 | Element used to multiply each element of the slice. |
mult7 | Element used to multiply each element of the slice. |
mult8 | Element used to multiply each element of the slice. |
vec | Row of the matrix to add. |
start | Beginning of the slice. |
end | End of the slice. |
Element& F4::Matrix< Element >::operator() | ( | int | row, |
int | col | ||
) |
Modify matrix element.
row | Row of the element. |
col | Column of the element. |
Element F4::Matrix< Element >::operator() | ( | int | row, |
int | col | ||
) | const |
Get matrix element.
row | Row of the element. |
col | Column of the element. |
Matrix& F4::Matrix< Element >::operator= | ( | Matrix< Element > const & | matrix | ) |
Overload the operator =.
matrix | Matrix to copy. |
Matrix& F4::Matrix< Element >::operator= | ( | Matrix< Element > && | matrix | ) |
Overload the operator = (move assignment). Used when mon is unnamed (only copy the pointer).
matrix | Matrix to copy. |
void F4::Matrix< Element >::quadAddMultRowGF2Extension | ( | Element * | dest1, |
Element * | dest2, | ||
Element * | dest3, | ||
Element * | dest4, | ||
Element | mult1, | ||
Element | mult2, | ||
Element | mult3, | ||
Element | mult4, | ||
Element * | vec, | ||
int | start, | ||
int | end | ||
) |
dest1 += mult1 * vec, dest2 += mult2 * vec, dest3 += mult3 * vec, dest4 += mult4 * vec.
dest1 | Row of the matrix to modify. |
dest2 | Row of the matrix to modify. |
dest3 | Row of the matrix to modify. |
dest4 | Row of the matrix to modify. |
mult1 | Element used to multiply each element of the slice. |
mult2 | Element used to multiply each element of the slice. |
mult3 | Element used to multiply each element of the slice. |
mult4 | Element used to multiply each element of the slice. |
vec | Row of the matrix to add. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::setElement | ( | int | row, |
int | col, | ||
Element const & | element | ||
) |
Modify matrix element.
row | Row of the element. |
col | Column of the element. |
element | Element. |
void F4::Matrix< Element >::swapCol | ( | int | numCol1, |
int | numCol2, | ||
int | start, | ||
int | end | ||
) |
Swap a slice of the row1-th row with a slice of the row2-th row.
numCol1 | Number of the column. |
numCol2 | Number of the column. |
start | Beginning of the slice. |
end | End of the slice. |
void F4::Matrix< Element >::swapRow | ( | int | numRow1, |
int | numRow2 | ||
) |
Swap a slice of the row1-th row with a slice of the row2-th row.
numRow1 | Number of the row. |
numRow2 | Number of the row. |
void F4::Matrix< Element >::tripleAddMultRowGF2Extension | ( | Element * | dest1, |
Element * | dest2, | ||
Element * | dest3, | ||
Element | mult1, | ||
Element | mult2, | ||
Element | mult3, | ||
Element * | vec, | ||
int | start, | ||
int | end | ||
) |
dest1 += mult1 * vec, dest2 += mult2 * vec, dest3 += mult3 * vec.
dest1 | Row of the matrix to modify. |
dest2 | Row of the matrix to modify. |
dest3 | Row of the matrix to modify. |
mult1 | Element used to multiply each element of the slice. |
mult2 | Element used to multiply each element of the slice. |
mult3 | Element used to multiply each element of the slice. |
vec | Row of the matrix to add. |
start | Beginning of the slice. |
end | End of the slice. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |