Ticket #9466: my2.patch

File my2.patch, 1.4 KB (added by ruckers, 10 years ago)

Fixes the code: sage: FiniteField?(next_prime(2100))(2).sqrt(extend = False, all = True)

  • sage/rings/finite_rings/integer_mod.pyx

    # HG changeset patch
    # User Math 480 Student
    # Date 1328669040 28800
    # Node ID 0e708303e1f4bbf514283db4842697f52412d58d
    # Parent  b0d1f17ebc8f2655146231b4379419a1762791b3
    Ticket #9466 when sqrt(all = true) raised an error has been changed to returning
    an empty list.
    
    diff --git a/sage/rings/finite_rings/integer_mod.pyx b/sage/rings/finite_rings/integer_mod.pyx
    a b  
    885885                    Q = R.quotient(modulus, names=(y,))
    886886                z = Q.gen()
    887887                if all:
    888                     # TODO
    889                     raise NotImplementedError
     888                    return []
    890889                return z
     890            if all:
     891                return []
    891892            raise ValueError, "self must be a square"
    892893           
    893894        F = self._parent.factored_order()
     
    26032604                    if (i*i) % n == self.ivalue:
    26042605                        return self._new_c(i)
    26052606                if not extend:
    2606                     raise ValueError, "self must be a square"
     2607                    if not all:
     2608                         raise ValueError, "self must be a square"
     2609                    else:
     2610                        return []
    26072611        # Either it failed but extend was True, or the generic algorithm is better
    26082612        return IntegerMod_abstract.sqrt(self, extend=extend, all=all)
    26092613