[PPL-devel] GenSys.cc: lines 247 and following
Roberto Bagnara
bagnara at cs.unipr.it
Mon Aug 12 21:14:57 CEST 2002
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());
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it
More information about the PPL-devel
mailing list