Opened 8 years ago

# primary decomposition: provide a descriptive error message for illegal algorithm choice

Reported by: Owned by: jakobkroeker trivial commutative algebra primary decomposition error message ncohen, gh-tom111 N/A

### Description

```sage: R.<x,y>=QQ[]
sage: I = R.ideal(x)
sage: I.primary_decomposition("elephants")
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-3-640b8340fda6> in <module>()
----> 1 I.primary_decomposition("elephants")

/home/kroeker/Projects/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in __call__(self, *args, **kwds)
603         if not R.base_ring().is_field():
604             raise ValueError("Coefficient ring must be a field for function '%s'."%(self.f.__name__))
--> 605         return self.f(self._instance, *args, **kwds)
606
607 require_field = RequireField

/home/kroeker/Projects/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in primary_decomposition(self, algorithm)
1159           York 1993.
1160         """
-> 1161         return [I for I, _ in self.complete_primary_decomposition(algorithm)]
1162
1163     @require_field

/home/kroeker/Projects/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in __call__(self, *args, **kwds)
603         if not R.base_ring().is_field():
604             raise ValueError("Coefficient ring must be a field for function '%s'."%(self.f.__name__))
--> 605         return self.f(self._instance, *args, **kwds)
606
607 require_field = RequireField

/home/kroeker/Projects/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in wrapper(*args, **kwds)
503         """
504         with LibSingularDefaultContext():
--> 505             return func(*args, **kwds)
506     return wrapper
507

/home/kroeker/Projects/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in complete_primary_decomposition(self, algorithm)
1086
1087         R = self.ring()
-> 1088         V = [(R.ideal(X[0]), R.ideal(X[1])) for X in P]
1089         V = Sequence(V)
1090         self.__complete_primary_decomposition[algorithm] = V

UnboundLocalError: local variable 'P' referenced before assignment
```