First time here? Check out the FAQ!

Ask Your Question
0

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

asked 11 years ago

Shashank gravatar image

updated 10 years ago

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)
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 11 years ago

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))
Preview: (hide)
link

Comments

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

kcrisman gravatar imagekcrisman ( 11 years ago )

Thanks a lot!

Shashank gravatar imageShashank ( 11 years ago )

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

kcrisman gravatar imagekcrisman ( 11 years ago )

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: 11 years ago

Seen: 477 times

Last updated: Nov 09 '13