Comment by actinium226
7 hours ago
For the first example:
import numpy as np
A = np.random.random((100, 5, 5))
b = np.random.random((100, 5, 1))
x = np.linalg.solve(A, b)
Admittedly the documentation is a little hard to read if you just look at 'type' for b, but then it says "Returned shape is (..., M) if b is shape (M,) and (..., M, K) if b is (..., M, K) where ... is broadcasted between a and b"
So you have to make sure your b vector is actually a matrix and not a vector (if K=1 for your case).
No comments yet
Contribute on Hacker News ↗