Hi, this should be a simple affair.
I have a polynomial object that keeps track of its coefficients, it is
defined as follows:
immutable Poly1
coef :: Array{Float64}
end
I would like to make a dictionary with keys that are Poly1 type, like
follows:
# creation
r_dict1 = [Poly1([1.0, 2.0]) => 1]
# access
r_dict1[Poly1([1.0, 2.0])]
However currently it gives the arrow "key not found"
By looking at the hash we can see why, the has is not identical even for
equal polynomials:
hash(Poly1([1.0, 2.0])) # gives an arbitrary hex string
hash(Poly1([1.0, 2.0])) # gives a different hex string
How would I implement my own hash so the same polynomials (by same I mean
the coefficients are same, i.e. the coef::Array{Float64} part of the two
polynomials are the same?
Much thanks!!
--evan