@np.deprecate(new_name='expm')
def expm3(A, q=20):
 A = _asarray_square(A)
 n = A.shape[0]
 t = A.dtype.char
 if (t not in ['f', 'F', 'd', 'D']):
  A = A.astype('d')
  t = 'd'
 eA = np.identity(n, dtype=t)
 trm = np.identity(n, dtype=t)
 castfunc = cast[t]
 for k in range(1, q):
  trm[:] = (trm.dot(A) / castfunc(k))
  eA += trm
 return eA

@ np . deprecate ( new_name = 'expm' ) def expm3 ( A , q = 20 ) : A = _asarray_square ( A ) n = A . shape [ 0 ] t = A . dtype . char if ( t not in [ 'f' , 'F' , 'd' , 'D' ] ) : A = A . astype ( 'd' ) t = 'd' eA = np . identity ( n , dtype = t ) trm = np . identity ( n , dtype = t ) castfunc = cast [ t ] for k in range ( 1 , q ) : trm [ : ] = ( trm . dot ( A ) / castfunc ( k ) ) eA += trm return eA
compute the matrix exponential using taylor series .