Commit Graph

11 Commits

Author SHA1 Message Date
Daira Hopwood 56945c09e0 Import sys explicitly rather than relying on sage to do it.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-30 13:28:25 +00:00
Daira Hopwood bda5810e46 Python 2 compatibility.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-30 10:42:55 +00:00
Daira Hopwood a8b6b48b91 Include the cost of checking the result in the squaring cost.
(The algorithm will return a nonsense result for non-squares if we don't do this check.)

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:47:58 +00:00
Daira Hopwood 223b60825c Save one squaring.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:38:58 +00:00
Daira Hopwood d45dd14238 Make squareroot.sage more similar to squareroottab.sage to facilitate comparison.
(This is actually a slight pessimisation, but we're not going to use the non-table-based variant.)

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:35:36 +00:00
Daira Hopwood e7f9d2cef6 squareroot.sage: turn off VERBOSE and EXPENSIVE.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:04:14 +00:00
Daira Hopwood b26d051c59 Slightly optimize addition chain for Fq.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:03:25 +00:00
Daira Hopwood fbd6f3b1bb squareroot.sage: improve debugging.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 18:42:33 +00:00
Daira Hopwood 6d9e412d8d squareroot.sage: do expensive assertions only if DEBUG is set.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-28 15:34:45 +00:00
Daira Hopwood 1d2c5d0826 squareroot.sage: optimize precomputation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-28 15:33:54 +00:00
Daira Hopwood 77524ce1a6 Prototype implementation of square roots on the Pasta fields (addition chains and Sarkar's algorithm).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-28 14:37:56 +00:00