0

How can I calculate exp([[1,2,3]]) like in python numpy. Is there any in tensorflow or any other library?

print(np.exp(np.array([[1,2,3,4],[2,3,4,66]])) )

I need a c++ solution.

actual result(math)

https://www.symbolab.com/solver/matrix-exponential-calculator/e%5E%7B%5Cbegin%7Bpmatrix%7D1%260%260%5C%5C0%261%260%5C%5C0%260%261%5Cend%7Bpmatrix%7D%7D?or=ex

hipativ414
  • 19
  • 5
  • Beware, C++ standard library has no containers for multi-dimensional matrixes, but only for linear vectors. And a vector or vectors is not a 2D matrix, so you must first say what is your data container. – Serge Ballesta Jun 25 '20 at 06:36

1 Answers1

0

Possibly duplicate. see Complex matrix exponential in C++

Careful here, the matrix exponential is actually very difficult and a current topic of research for the general case! See https://en.wikipedia.org/wiki/Matrix_exponential. What Tortellini is describing is an element wise exponentiation, which is not the same thing.

The numpy library does the element wise exponent, the math you linked seems to be the matrix exponent. For a diagonal matrix they are the same.

But the two don't correspond in general (See for example: https://www.wolframalpha.com/input/?i=exp%28%7B%7B1%2C0%2C1%7D%2C%7B0%2C1%2C0%7D%2C%7B0%2C0%2C1%7D%7D%29), so please make sure which one you need.

sgillen
  • 596
  • 2
  • 7