Changeset 7524:1107ab67d0c3


Ignore:
Timestamp:
12/02/07 15:16:43 (5 years ago)
Author:
Carl Witty <cwitty@…>
Branch:
default
Message:

Fix coercion from scalar to matrix_modn_dense (#1374)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/matrix/matrix_modn_dense.pyx

    r7515 r7524  
    7474    sage: A = M([1,0,0,1]) 
    7575    sage: A - int(-1) 
    76     [1 0] 
    77     [0 1] 
     76    [2 0] 
     77    [0 2] 
    7878    sage: B = M([4,0,0,1]) 
    7979    sage: B - int(-1) 
    80     [4 0] 
    81     [0 1] 
     80    [0 0] 
     81    [0 2] 
    8282""" 
    8383 
     
    193193        p = self._base_ring.characteristic() 
    194194 
     195        R = self.base_ring() 
     196 
    195197        # scalar? 
    196198        if not isinstance(entries, list): 
     
    203205                pass 
    204206            else: 
    205                 e = entries   # coerce to an unsigned int 
    206                 e %= p 
     207                e = R(entries) 
    207208                if e != 0: 
    208209                    for i from 0 <= i < self._nrows: 
     
    216217        k = 0 
    217218        cdef mod_int n 
    218         R = self.base_ring() 
    219219 
    220220        if coerce:  
Note: See TracChangeset for help on using the changeset viewer.