add ger and lu with partial pivoting in BTL

This commit is contained in:
Gael Guennebaud
2009-08-04 11:30:33 +02:00
parent 4bec101470
commit c2a92e92a6
23 changed files with 340 additions and 86 deletions

View File

@@ -32,7 +32,6 @@ double simple_function(int index_i, int index_j)
double pseudo_random(int index)
{
// INFOS("random="<<(std::rand()/double(RAND_MAX)));
return std::rand()/double(RAND_MAX);
}

View File

@@ -41,13 +41,24 @@ BTL_DONT_INLINE void init_row(Vector & X, int size, int row){
// [] operator for setting rows
template<double init_function(int,int),class Vector>
BTL_DONT_INLINE void init_matrix(Vector & A, int size){
A.resize(size);
for (int row=0; row<A.size() ; row++){
init_row<init_function>(A[row],size,row);
}
}
template<double init_function(int,int),class Matrix>
BTL_DONT_INLINE void init_matrix_symm(Matrix& A, int size){
A.resize(size);
for (int row=0; row<A.size() ; row++)
A[row].resize(size);
for (int row=0; row<A.size() ; row++){
A[row][row] = init_function(row,row);
for (int col=0; col<row ; col++){
double x = init_function(row,col);
A[row][col] = A[col][row] = x;
}
}
}
#endif