exceptions.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. """
  2. Module to define exceptions to be used in sympy.polys.matrices modules and
  3. classes.
  4. Ideally all exceptions raised in these modules would be defined and documented
  5. here and not e.g. imported from matrices. Also ideally generic exceptions like
  6. ValueError/TypeError would not be raised anywhere.
  7. """
  8. class DMError(Exception):
  9. """Base class for errors raised by DomainMatrix"""
  10. pass
  11. class DMBadInputError(DMError):
  12. """list of lists is inconsistent with shape"""
  13. pass
  14. class DMDomainError(DMError):
  15. """domains do not match"""
  16. pass
  17. class DMNotAField(DMDomainError):
  18. """domain is not a field"""
  19. pass
  20. class DMFormatError(DMError):
  21. """mixed dense/sparse not supported"""
  22. pass
  23. class DMNonInvertibleMatrixError(DMError):
  24. """The matrix in not invertible"""
  25. pass
  26. class DMRankError(DMError):
  27. """matrix does not have expected rank"""
  28. pass
  29. class DMShapeError(DMError):
  30. """shapes are inconsistent"""
  31. pass
  32. class DMNonSquareMatrixError(DMShapeError):
  33. """The matrix is not square"""
  34. pass
  35. __all__ = [
  36. 'DMError', 'DMBadInputError', 'DMDomainError', 'DMFormatError',
  37. 'DMRankError', 'DMShapeError', 'DMNotAField',
  38. 'DMNonInvertibleMatrixError', 'DMNonSquareMatrixError',
  39. ]