FFLASMatrix.h
Go to the documentation of this file.00001 #pragma once
00002
00003
00004 #include <iostream>
00005 #include <string>
00006
00007 #include <vector>
00008 #include <assert.h>
00009 #include <cassert>
00010
00011 #include "modular-balanced.h"
00012 #include "ffpack.h"
00013
00020
00022 using namespace std;
00023
00029 template <class Field >
00030 class FFpackMatrix
00031 {
00032
00033 public:
00034
00035 typedef typename Field::Element ElementType;
00036 private:
00037
00038 int characteristic_m;
00039
00040 const Field* F;
00041
00042 int rows_m;
00043 int cols_m;
00044
00045 int blocksPerRow;
00046
00047
00048 typename Field::Element * data_m;
00049
00050 string name;
00051
00052
00053 protected:
00054
00057
00058
00059 FFpackMatrix(typename Field::Element *data_m,int _rows, int _cols, int characteristic, string name);
00062 public:
00063
00064
00067 FFpackMatrix(int _rows,int _cols, int characteristic, string name="unnamedFFPACKMatrix");
00068
00069
00070
00071
00072
00073
00074
00075 template <class TMatrix>
00076 FFpackMatrix(const TMatrix &mat, int characteristic, bool transpose=false);
00077
00078 ~FFpackMatrix();
00079
00086 void checkBounds(int row, int col) const;
00087 inline void checkDimensions() const;
00093 typename Field::Element getVal(int row, int col) const;
00094 void setVal(int row, int col, typename Field::Element elem);
00100 string getName() const { return name; };
00101
00102 inline int getColNum() const { return cols_m; };
00103 inline int getRowNum() const { return rows_m; };
00104
00105 const Field* getField() const { return F; };
00106
00107 bool isZero() const;
00114 bool operator==(const FFpackMatrix& mat) const;
00115
00116 FFpackMatrix* getRightKernel(int &Rkdim);
00117
00118 unsigned int getRank();
00119 FFpackMatrix* getLeftInverse();
00120
00121 typename Field::Element* solveLGS(const typename Field::Element* rightHandSide,int & rankRef);
00122
00128 void printValue(std::ostream & os) const;
00130 };
00131
00132
00133 #include "FFLASMatrix.cpp"
00134
00135
00136
00137
00138