Posted by jrank 10 hours ago
Why did not numpy copy the J rank concept?
One of the problems mentioned in [1] is that you can not use python loops because they are slow. In J you can solve for example 100 equations using the rank concept, this is a simple example:
a=: 2 2 $ 1 1 1 _1
b=: 10 2 $ ? 20 # 10
solutions =: b %. "(1 _) a
That code solve the systems a * v_i = b_i for ten random vectors. I think a similar concept could be developed in numpy. The syntax "(1 _)" indicates to take the rows from the left operator and all (_ is infinite) of a apply solve (that is %. in J). In this case the system is x+y=y0, x-y=y1.So I would suggest somthing like numpy.linalg.solve(a,b,rank=(1,inf))
[1] https://news.ycombinator.com/item?id=43996431
The 1 cell of a matrix are the rows, etc.