Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> use a bizarre notation (either @ or .dot look very ugly in formulas).

If you use the numpy.matrix type instead of numpy.array, the * operator becomes matrix multiplicaton.



hmmm, I thought the matrix class was deprecated? At least it says so in the official numpy documentation:

https://numpy.org/doc/stable/reference/generated/numpy.matri...

Anyhow, the * operator does not work with sparse matrices, and you really don't want to maintain two versions of your formulas. Thus, you are unfortunately stuck with @ or .dot

I guess there might be a much more math-friendly library than numpy, but I have never found it.


> hmmm, I thought the matrix class was deprecated? At least it says so in the official numpy documentation:

Huh, you're right. Bummer, I hadn't noticed that yet. I agree that an ergonomic matrix class is sorely missing in the Python ecosystem. It shouldn't even be that hard to implement, since all the plumbing is already there.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: