[GiNaC-devel] Erasing-inserting exhashmap

Vladimir V. Kisil kisilv at maths.leeds.ac.uk
Thu Sep 19 17:06:19 CEST 2019


	Dear All,

	I have an issue with exhashmap, namely repeated
  erasing-insertion of elements eventually become trapped in an infinite
  loop in lines 487-491 of hash_map.h. Here is a sample code:

#include <ginac/ginac.h>
using namespace GiNaC;

int main()
{
	exhashmap<ex> M;

	M[realsymbol("x")] =1;
	int N= 30;
	
	for (int i =0; i < N; ++i ) {
		realsymbol a("a");
		M[a]=numeric(i);
		M.erase(a);
	}
	return 0;
}

  With this value of N the infinite loop appears on my computer with a
  probability around 40%. With larger values of N an infinite loop is
  almost certain.

  Did I miss something?

  Best wishes,
  Vladimir

  PS Also just to check that my patch for archiving empty lists from Sep
  10 is not lost. 
-- 
Vladimir V. Kisil                 http://www.maths.leeds.ac.uk/~kisilv/
  Book:     Geometry of Mobius Transformations     http://goo.gl/EaG2Vu
  Software: Geometry of cycles          http://moebinv.sourceforge.net/
  Jupyter (Colab):         https://github.com/vvkisil/MoebInv-notebooks
  Jupyter (CodeOcean):            http://doi.org/10.24433/CO.9934595.v3


More information about the GiNaC-devel mailing list