question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matrixexponential: "expm(0) == nan"

See original GitHub issue

I have noticed that feeding an array of only zeros into jax.scipy.linalg.expm results in a purely np.nan array. It should be the unit matrix, e.g. expm(zeros) == np.eye(*zeros.shape)

Minimal reproducer:

import jax.numpy as np
from jax.version import __version__
from jax.scipy.linalg import expm

print(f'jax version: {__version__}')
#  jax version: 0.1.58

zero = np.zeros([2, 2], dtype=np.float32)
exp_zero = expm(zero)
print(f'exp(zero) == \n{exp_zero}')
#  exp(zero) == 
#  [[nan nan]
#  [nan nan]]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
shoyercommented, Feb 7, 2020
0reactions
shoyercommented, Feb 9, 2020

Should be fixed now by #2192

Read more comments on GitHub >

github_iconTop Results From Across the Web

Matrix exponential error in scipy.linalg with python
I wanted make rotation of 2pi around y axis (m_13) but linalg.expm cannot calculate for angle around pi or 2pi only small amounts...
Read more >
expm: Matrix Exponential, Log, 'etc' - R Project
This function computes the exponential of a square matrix A, defined as the sum from r = 0 to infinity of Ar/r!. Several...
Read more >
How to calculate expm of a badly scaled matrix? - MathWorks
I'm using expm for a matrix with big and small coefficients and I get NaN in the result. Is there a method to...
Read more >
Matrix exponential properties - YouTube
Showing that exp (A+B) doesn't equal exp (A) exp (B), but showing that it's the case when AB = BACheck out my Eigenvalues...
Read more >
Differential Equations | The Matrix Exponential e^{tA}. - YouTube
We outline a strategy for finding the matrix exponential e^{tA}, including an example when A is 2x2 and not diagonalizable.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found