26 #ifndef OPENF4_MATRIX_H
27 #define OPENF4_MATRIX_H
43 #ifdef HAVE_FFLAS_FFPACK
44 #include <givaro/modular-balanced.h>
45 #include <fflas-ffpack/ffpack/ffpack.h>
46 #include <fflas-ffpack/fflas/fflas.h>
47 #endif // HAVE_FFLAS_FFPACK
59 #include <emmintrin.h>
63 #include <smmintrin.h>
67 #include <nmmintrin.h>
79 template <
typename Element>
96 Matrix(
int height,
int width);
102 Matrix(std::string
const & filename);
157 void setElement (
int row,
int col, Element
const & element);
163 Element *
getRow (
int row);
228 void setInfo(
int nbPiv,
int *tau,
int *sigma,
int * startTail,
int * endCol);
241 void printMatrix (std::string
const & filename)
const;
260 bool isZero(
int row,
int col)
const;
293 void multRow(Element * row, Element
const & element,
int start,
int end);
302 void multRowPrime(Element * row, Element
const & element,
int start,
int end);
321 void addMultRow(Element * row1, Element * row2, Element element,
int start,
int end);
331 void addMultRowPrime(Element * row1, Element * row2, Element element,
int start,
int end);
367 void tripleAddMultRowGF2Extension(Element * dest1, Element * dest2, Element * dest3, Element mult1, Element mult2, Element mult3, Element * vec,
int start,
int end);
383 void quadAddMultRowGF2Extension(Element * dest1, Element * dest2, Element * dest3, Element * dest4, Element mult1, Element mult2, Element mult3, Element mult4, Element * vec,
int start,
int end);
407 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);
425 void swapRow(
int numRow1,
int numRow2);
434 void swapCol(
int numCol1,
int numCol2,
int start,
int end);
440 int echelonizeRight (chrono::duration<int,milli> & tmp_ech_db, chrono::duration<int,milli> & tmp_ech_dh);
497 template <
typename Element>
498 std::ostream & operator<<(std::ostream & stream, Matrix<Element>
const & matrix);
502 #include "../src/matrix.inl"
505 #endif // OPENF4_MATRIX_H
void printMatrix(std::ostream &stream) const
Print the matrix.
int getWidth() const
Get the width of the matrix (number of columns).
int * getSigma()
Get the permutation _sigma.
void normalizeRowPrime(Element *row, int start, int end)
Specialisation of normalizeRow for ElementPrime type.
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.
int echelonize()
Echelonize the matrix using the shape of the F4 matrix.
void normalizeRowGF2Extension(Element *row, int start, int end)
Specialisation of normalizeRow for ElementGF2Extension type.
void setSigma(int *sigma)
Specify the permutation _sigma.
Declaration of class ElementPrime.
Wrapper for config.h in order to avoid multiple definitions.
void normalizeRow(Element *row, int start, int end)
Normalize a slice of the row-th row.
int getHeight() const
Get the height of the matrix (number of rows).
Element getElement(int row, int col) const
Get matrix element.
Declaration of class ElementGF2.
bool isZero(int row, int col) const
Test if _matrix(row,col) is zero.
void multRowPrime(Element *row, Element const &element, int start, int end)
Specialisation of multRow for ElementPrime type.
void printMatrixTxt(std::string const &filename) const
Print the matrix in a format readable by constructor.
void swapRow(int numRow1, int numRow2)
Swap a slice of the row1-th row with a slice of the row2-th row.
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.
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.
Matrix & operator=(Matrix const &matrix)
Overload the operator =.
void printMatrixSage(std::string const &filename) const
Print the matrix in a format readable by sage.
void addMultRowGF2Extension(Element *row1, Element *row2, Element element, int start, int end)
Specialisation of addMultRow for ElementGF2Extension type.
void addMultRowPrime(Element *row1, Element *row2, Element element, int start, int end)
Specialisation of addMultRow for ElementPrime type.
Element * getRow(int row)
Get the row-th row of this.
int * getStartTail()
Get the array _startTail.
int getNbPiv() const
Get the number of pivots.
void setInfo(int nbPiv, int *tau, int *sigma, int *startTail, int *endCol)
Set the informations required by echelonize.
Declaration of class ElementGivaro.
void multRow(Element *row, Element const &element, int start, int end)
Multiply a slice of the row-th row by element.
void doubleAddMultRowGF2Extension(Element *dest1, Element *dest2, Element mult1, Element mult2, Element *vec, int start, int end)
dest1 += mult1 * vec, dest2 += mult2 * vec.
void setNbPiv(int nbPiv)
Specify the number of pivots.
int * getEndCol()
Get the array _endCol.
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...
void setElement(int row, int col, Element const &element)
Modify matrix element.
void setTau(int *tau)
Specify the permutation _tau.
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...
void multRowGF2Extension(Element *row, Element const &element, int start, int end)
Specialisation of multRow for ElementGF2Extension type.
void setStartTail(int *startTail)
Specify the array _startTail.
void setEndCol(int *encCol)
Specify the array _endCol.
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.
int echelonizeGF2Extension()
Specialisation of echelonize for ElementGF2Extension Type.
Element & operator()(int row, int col)
Modify matrix element.
Declaration of class ElementGF2Extension.
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.
int * getTau()
Get the permutation _tau.
int echelonizePrime()
Specialisation of echelonize for ElementPrime Type, use lazy arithmetic.