Skip to content

hashCode for polynomial does not work #410

@rklaehn

Description

@rklaehn
scala> Polynomial("(1)").##
res1: Int = -135076863

scala> Polynomial("(1)").##
res2: Int = 776699639

scala> Polynomial("(1)").##
res3: Int = 797295762

scala> Polynomial("(1)").##
res4: Int = 639834089

Both PolyDense and PolySparse use arrays internally. So the hashCode method generated for case classes is not sufficient. Also, hashCode would have to be implemented in such a way that both PolyDense and PolySparse representations of the same polynomial return the same hash code.

At the very least, hashCode needs to be implemented to be 0 to fulfill the equals/hashCode contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions