From: guido Date: Tue, 9 Oct 2001 16:52:46 +0000 (+0000) Subject: handle zero row length for quadratic matrics X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9462477277c16181da7df43faff05bd88e4bd1b;p=dealii-svn.git handle zero row length for quadratic matrics git-svn-id: https://svn.dealii.org/trunk@5136 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/solver_gmres.h b/deal.II/lac/include/lac/solver_gmres.h index b3bec4d7ab..48035f78b3 100644 --- a/deal.II/lac/include/lac/solver_gmres.h +++ b/deal.II/lac/include/lac/solver_gmres.h @@ -226,7 +226,6 @@ SolverGMRES::solve (const MATRIX &A, //TODO:[?] Allocate vectors only when needed. deallog.push("GMRES"); - const unsigned int n_tmp_vectors = additional_data.max_n_tmp_vectors; // allocate an array of n_tmp_vectors diff --git a/deal.II/lac/source/sparsity_pattern.cc b/deal.II/lac/source/sparsity_pattern.cc index cc0760cf88..5aeba9b8b3 100644 --- a/deal.II/lac/source/sparsity_pattern.cc +++ b/deal.II/lac/source/sparsity_pattern.cc @@ -270,18 +270,30 @@ SparsityPattern::reinit (const unsigned int m, return; }; - // find out how many entries we + // first, if the matrix is + // quadratic, we will have to make + // sure that each row has at least + // one entry for the diagonal + // element. make this more obvious + // by having a variable which we + // can query + const bool matrix_is_quadratic = (m == n ? true : false); + + // find out how many entries we // need in the @p{colnums} array. if // this number is larger than // @p{max_vec_len}, then we will need // to reallocate memory // // note that the number of elements - // is bounded by the number of - // columns + // per row is bounded by the number + // of columns unsigned int vec_len = 0; for (unsigned int i=0; i 1) + std::sort ((rows==cols) ? tmp_entries.begin()+1 : tmp_entries.begin(), + tmp_entries.begin()+row_length); + // insert column numbers // into the new field for (unsigned int j=0; j