Ask Your Question
0

Why can't I find exponential of a "complex256" matrix?

asked 2013-11-09 17:47:13 +0100

Shashank gravatar image

updated 2015-01-17 22:30:12 +0100

FrédéricC gravatar image

The following script gives me a error - ValueError: invalid type: complex256. However, this works with complex128. Is there a way to make expm work with complex256?

import scipy
a=scipy.matrix([[1,0],[0,1]],dtype='complex256')
scipy.linalg.expm(a)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2013-11-09 21:10:40 +0100

kcrisman gravatar image

This is really not a Sage question...

Nonetheless, a quick glance at the source reveals that it just isn't implemented.

if A.dtype == 'float64' or A.dtype == 'complex128':
    if A_L1 < 1.495585217958292e-002:
        U,V = _pade3(A, ident)
    elif A_L1 < 2.539398330063230e-001:
        U,V = _pade5(A, ident)
    elif A_L1 < 9.504178996162932e-001:
        U,V = _pade7(A, ident)
    elif A_L1 < 2.097847961257068e+000:
        U,V = _pade9(A, ident)
    else:
        maxnorm = 5.371920351148152
        n_squarings = max(0, int(ceil(log2(A_L1 / maxnorm))))
        A = A / 2**n_squarings
        U,V = _pade13(A, ident)
elif A.dtype == 'float32' or A.dtype == 'complex64':
    if A_L1 < 4.258730016922831e-001:
        U,V = _pade3(A, ident)
    elif A_L1 < 1.880152677804762e+000:
        U,V = _pade5(A, ident)
    else:
        maxnorm = 3.925724783138660
        n_squarings = max(0, int(ceil(log2(A_L1 / maxnorm))))
        A = A / 2**n_squarings
        U,V = _pade7(A, ident)
else:
    raise ValueError("invalid type: "+str(A.dtype))
edit flag offensive delete link more

Comments

I've opened https://github.com/scipy/scipy/issues/3051 as an enhancement request for this.

kcrisman gravatar imagekcrisman ( 2013-11-09 21:15:43 +0100 )edit

Thanks a lot!

Shashank gravatar imageShashank ( 2013-11-09 23:12:38 +0100 )edit

Scipy has passed it on to Numpy... https://github.com/numpy/numpy/issues/4035

kcrisman gravatar imagekcrisman ( 2013-11-11 08:51:17 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-11-09 17:47:13 +0100

Seen: 453 times

Last updated: Nov 09 '13