| ▲ | ivansavz a day ago | |||||||
The result of `Y @ X` has shape (3,), so the next line (concatenate as columns) fails. To make `Z` a column vector, we would need something like `Z = (Y @ X)[:,np.newaxis]`. Although, I'm not sure why the author is using `concatenate` when the more idiomatic function would be stack, so the change you suggest works and is pretty clean:
with convention that vectors are shape (3,) instead of (3,1). | ||||||||
| ▲ | dgfl a day ago | parent | next [-] | |||||||
You do realize how many arbitrary words and concepts that are nowhere to be found in “conventional” math there are here, right? I know what all of these do, but I just can’t shake the feeling that I’m constantly fighting with an actual python. Very aptly named. I also think it’s more to do with the libraries than with the language, which I actually like the syntax of. But numpy tries to be this highly unopinionated tool that can do everything, and ends up annoying to use anywhere. Matplotlib is even worse, possibly the worst API I’ve ever used. | ||||||||
| ▲ | Aerolfos a day ago | parent | prev [-] | |||||||
> To make `Z` a column vector, we would need something like `Z = (Y @ X)[:,np.newaxis]`. Doesn't just (Y @ X)[None] work? None adding an extra dimension works in practice but I don't know if you're "supposed" to do that | ||||||||
| ||||||||