
CVSROOT: /cvs/ppl Module name: ppl Changes by: zaffanella@cs.unipr.it 2002-08-12 20:57:41
Modified files: src : GenSys.cc
Log message: Patched the method insert(const Generator&), which was doing nasty things when trying to insert a generator into an empty generator system that was declared to be NNC.
Patches: http://www.cs.unipr.it/cgi-bin/cvsweb.cgi/ppl/src/GenSys.cc.diff?cvsroot=ppl...

Enea Zaffanella wrote:
Patched the method insert(const Generator&), which was doing nasty things when trying to insert a generator into an empty generator system that was declared to be NNC.
These lines now read as follows:
// The generator system is NOT necessarily closed: // copy the generator, adding the missing dimensions // and the epsilon coefficient. // NOTE: computing `gs_size = num_columns()' would provide // a wrong result if the matrix has no rows. size_t new_size = (g.space_dimension() > space_dimension()) ? g.space_dimension() + 2 : space_dimension() + 2; Generator tmp_g(g, new_size); // If it was a point, set the epsilon coordinate to 1 // (i.e., set the coefficient equal to the divisor). // Note: normalization is preserved. if (tmp_g[0] != 0) tmp_g[new_size - 1] = tmp_g[0]; tmp_g.set_not_necessarily_closed(); // Inserting the new generator. Matrix::insert(tmp_g);
There is an inconsistent comment about a variable no longer being used (`gs_size') and a possibly repeated evaluation of g.space_dimension(). I suggest replacing the three lines above with something like
size_t new_size = 2 + std::max(g.space_dimension(), space_dimension());
participants (2)
-
Enea Zaffanella
-
Roberto Bagnara