[Numpy-tickets] [NumPy] #601: function for computing powers of a matrix

NumPy numpy-tickets@scipy....
Thu Feb 14 15:34:25 CST 2008


#601: function for computing powers of a matrix
--------------------------+-------------------------------------------------
 Reporter:  LevGivon      |        Owner:  somebody
     Type:  enhancement   |       Status:  new     
 Priority:  normal        |    Milestone:  1.0.5   
Component:  numpy.linalg  |      Version:  devel   
 Severity:  normal        |   Resolution:          
 Keywords:                |  
--------------------------+-------------------------------------------------
Comment (by stefan):

 The approach used in numpy.matlib is a binary decomposition.  If the SVD
 can't be used for some reason, it would be useful to have this exposed to
 numpy in general.

 The equivalent code looks something like:

 {{{
 def mpower(A,n):
     B = A
     p = int(np.floor(np.log(n)/np.log(2))) # 2^? is n
     for i in range(p):
         B = np.dot(B,B)

     for i in range(n-2**p):
         B = np.dot(B,A)

     return B
 }}}

 See defmatrix.py:215.

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/601#comment:6>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list