Opened 9 months ago

Closed 9 months ago

#29249 closed enhancement (fixed)

Fixing determinant for the zero matrix over the p-adics

Reported by: edgarcosta Owned by:
Priority: major Milestone: sage-9.1
Component: padics Keywords:
Cc: Merged in:
Authors: Edgar Costa Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: d5d16fe (Commits) Commit: d5d16fe20afb77c96b521b64a50fd1eae8757e88
Dependencies: Stopgaps:

Description

This fixes the bug below:

sage: matrix(Qp(37),[0]).determinant()
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-323-f9ac4bb66315> in <module>()
----> 1 matrix(Zp(Integer(37)),[Integer(0)]).determinant()

/Applications/sage-dev/local/lib/python3.7/site-packages/sage/matrix/matrix2.pyx in sage.matrix.matrix2.Matrix.determinant (build/cythonized/sage/matrix/matrix2.c:14548)()
   1640         R = self._base_ring
   1641         if hasattr(R, '_matrix_determinant'):
-> 1642             d = R._matrix_determinant(self)
   1643             self.cache('det', d)
   1644             return d

/Applications/sage-dev/local/lib/python3.7/site-packages/sage/rings/padics/local_generic.py in _matrix_determinant(self, M)
   1587                 break
   1588             val = curval
-> 1589             if S[pivi,pivj] == 0:
   1590                 if track_precision:
   1591                     return R(0, valdet + (n-piv)*val - shift)

UnboundLocalError: local variable 'pivi' referenced before assignment

Change History (5)

comment:1 Changed 9 months ago by git

  • Commit changed from 268f41a1791a63ab7528a7af0f05eafe1d4b1fab to 6befbbeff257ff9b39c83e9aadf8084e352afad7

Branch pushed to git repo; I updated commit sha1. New commits:

6befbbefixing determinant for the zero matrix

comment:2 Changed 9 months ago by git

  • Commit changed from 6befbbeff257ff9b39c83e9aadf8084e352afad7 to d5d16fe20afb77c96b521b64a50fd1eae8757e88

Branch pushed to git repo; I updated commit sha1. New commits:

d5d16fefixing pivi, pivj

comment:3 Changed 9 months ago by edgarcosta

  • Authors set to Edgar Costa
  • Status changed from new to needs_review

New commits:

d5d16fefixing pivi, pivj

comment:4 Changed 9 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:5 Changed 9 months ago by vbraun

  • Branch changed from u/edgarcosta/padicdet to d5d16fe20afb77c96b521b64a50fd1eae8757e88
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.