Mercurial > viff
changeset 1038:ab4a8125d1d8
Moved doctests to where they will be found.
author | Martin Geisler <mg@daimi.au.dk> |
---|---|
date | Fri, 05 Dec 2008 11:15:11 +0100 |
parents | d47b8da68a23 |
children | e127af30cba4 |
files | viff/field.py |
diffstat | 1 files changed, 19 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/viff/field.py Fri Dec 05 11:13:29 2008 +0100 +++ b/viff/field.py Fri Dec 05 11:15:11 2008 +0100 @@ -515,31 +515,31 @@ return GFElement def FakeGF(modulus): - """Construct a fake field.""" + """Construct a fake field. + + These fields should only be used in benchmarking. They work like + any other field except that all computations will give ``-1`` as + the result: + + >>> F = FakeGF(1031) + >>> a = F(123) + >>> b = F(234) + >>> a + b + {{1030}} + >>> a * b + {{1030}} + >>> a.sqrt() + {{1030}} + >>> a.bit(100) + 1 + """ # Return value of all operations on FakeFieldElements. We choose # this value to maximize the communication complexity. return_value = modulus - 1 class FakeFieldElement(FieldElement): - """Fake field which does no computations. - - This class should only be used in benchmarking. It works like any - other :class:`FieldElement` except that all computations will give - ``-1`` as the result: - - >>> F = FakeGF(1031) - >>> a = F(123) - >>> b = F(234) - >>> a + b - {{1030}} - >>> a * b - {{1030}} - >>> a.sqrt() - {{1030}} - >>> a.bit(100) - 1 - """ + """Fake field which does no computations.""" def __init__(self, value): """Create a fake field element.