On Wed, Aug 27, 2008 at 10:04 AM, Martin Albrecht
<[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> Robert wrote at
>
>  http://trac.sagemath.org/sage_trac/ticket/3956#comment:7
>
> """
>  Matrix hashes are specifically designed to be compatible with each other:
>
>  {{{
>  sage: M = random_matrix(GF(2), 10, 10)
>  sage: M.set_immutable()
>  sage: hash(M)
>  561
>  sage: MZ = M.change_ring(ZZ)
>  sage: MZ.set_immutable()
>  sage: hash(MZ)
>  561
>  sage: MS = M.spa
>  M.sparse_columns  M.sparse_matrix   M.sparse_rows
>  sage: MS = M.sparse_matrix()
>  sage: MS.set_immutable()
>  sage: hash(MS)
>  561
>  }}}
>
>  This patch seems to break that. At a minimum, it seems sparse and dense
>  should hash to the same thing. If we want to change this policy, we should
>  at least ask on sage-devel.
> """
>
> I supplied a new patch for that ticket which fixes the issue in question.
>
> However, over at
>
>  http://trac.sagemath.org/sage_trac/ticket/3724
>
> there is a similar situation. Obeying Sage's hashing rules for GF(2) isn't as
> straight forward as it is for #3956. Basically, we would have to decide
> whether we want very fast hashs or consistent hashs.
>
> To feel the difference:
>
> sage: A = random_matrix(GF(3),8000,8000)
> sage: A.set_immutable()
> sage: %time hash(A)
> CPU times: user 0.13 s, sys: 0.00 s, total: 0.13 s
> Wall time: 0.14 s
> 85210014
>
> sage: A = random_matrix(GF(2),8000,8000)
> sage: A.set_immutable()
> sage: %time hash(A)
> CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
> Wall time: 0.00 s
> -7158142340691380618
>
> sage: %timeit hash(A)
> 100 loops, best of 3: 2 ms per loop
>
>
> Thoughts?

I vote for fast.

william

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to