1

I'm reading someone else's code and I don't understand what is the use of @z here:

x = np.linalg.inv(P)@z

and when i Google @z (here), it seems that the search engine ignores the @, how come?

BrokenBenchmark
  • 18,126
  • 7
  • 21
  • 33
  • 2
    Perhaps you weren't aware of the name of the @ symbol ('at'), although that seems unlikely in an age where even the homeless have e-mail addresses, but in general it's a good idea to try searching for the name of a symbol if a search including the symbol doesn't turn up anything. – Grismar Feb 19 '22 at 22:42
  • 1
    You can also search for “python [@] symbol” – zvi Feb 19 '22 at 22:43

1 Answers1

1

@ refers to the matrix multiplication operator.

From the numpy docs:

The @ operator can be used as a shorthand for np.matmul on ndarrays.

x1 = np.array([2j, 3j])
x2 = np.array([2j, 3j])
x1 @ x2
(-13+0j)
BrokenBenchmark
  • 18,126
  • 7
  • 21
  • 33