Igor Schein on Mon, 15 May 2006 20:52:10 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
need for a hash function |
Hi, Here's a scenario. I need to to check whether or not 2 polynomials are isomorphic. The polynomials are big, so the usual methods like nfisisom() and friends are computationally costly. But, I am able to compute relatively cheaply my own invariant and compare it for both polynomials. However, the value of the function which computes the invariant takes on huge vectors. I can still compare the value, but output to the screen is impossible. If F is my invariant, here's a trick I employ (could be bettered, I am sure, but I don't feel like playing with escaping special characters any longer than it took me to come up with the first draft): Hash(obj)=extern("echo '"obj"'|md5sum|cut -d\\ -f1|sed 's/^/_/'|sed 's/$/_/'|tr _ '\\042'") for example: F(pol)=Vec(pol) then ? Hash(F(polzagier(100,98))) "4fcfd176835438d4932007f33cda1e20" Nice and compact. Now if I replace F with the actual function, it enables me to compare polynomials not only logically, but also visually, e.g. if I have a vector V of such polynomials, I would do for(k=1,#V,print(k," ",Hash(F(V[k])))) Did I make a strong enough case for the need of internal hashing function? Can anyone think of other scenarions which would make adding such function more attractive? Thanks Igor