38 void swapRows( ublas::matrix< value_type >& mat,
unsigned int r1,
unsigned int r2)
40 ublas::vector<value_type> temp( mat.size2() );
41 for (
size_t i = 0; i < mat.size2(); i++)
43 temp[i] = mat(r1, i );
44 mat(r1, i ) = mat(r2, i );
47 for (
size_t i = 0; i < mat.size2(); i++)
52 int reorderRows( ublas::matrix< value_type >& U,
int start,
int leftCol )
54 int leftMostRow = start;
55 int numReacs = U.size2() - U.size1();
56 int newLeftCol = numReacs;
57 for (
size_t i = start; i < U.size1(); ++i )
59 for (
int j = leftCol; j < numReacs; ++j )
73 if ( leftMostRow != start )
81 int numMols = U.size1();
82 double pivot = U( start, leftCol );
83 assert( fabs( pivot ) >
EPSILON );
84 for (
int i = start + 1; i < numMols; ++i )
86 double factor = U(i, leftCol);
89 factor = factor / pivot;
90 for (
size_t j = leftCol + 1; j < U.size2(); ++j )
93 double y = U( start, j );
106 int numMols = U.size1();
107 int numReacs = U.size2() - numMols;
112 for ( i = 0; i < numMols - 1; ++i )
116 if ( leftCol == numReacs )
void swapRows(ublas::matrix< double > &mat, unsigned int r1, unsigned int r2)
Swap row r1 and r2.
void eliminateRowsBelow(ublas::matrix< double > &U, int start, int leftCol)
int reorderRows(ublas::matrix< double > &U, int start, int leftCol)
unsigned int rankUsingBoost(ublas::matrix< double > &U)