frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Why did not numpy copy the J rank concept?

14•jrank•22h ago
Recently there was a post [1] about numpy being not easy to work with when using arrays of shape greater than 2.

  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

Comments

tester89•20h ago
The question you're asking seems interesting, but I don't understand J code so I don't know what you're talking about. Expanding the explanation would be helpful!
jrank•16h ago
If you have a a Numpy function that takes for example two arguments, my proposal is to add a optional argument that allows that function to be applied to cells of dimensions i and j by function_name(a,b,range=(i,j)) so that the function is applied to subarrays of dimension i of a and subarrays of dimension j of b to create a new array. The broadcast operation and the axis arguments are not a general solution. I J you have such mechanism as the example shows.

The 1 cell of a matrix are the rows, etc.

gus_massa•4h ago
I'm still confused. Can you type the complete slow python code?

We had a weird multiplication last year and the solution in python was to use @guvectorize https://numba.pydata.org/numba-doc/dev/user/vectorize.html and broadcasting. I don't know if that's possible with your problem.

Pompidou•18h ago
Maybe the internal broadcasting mecanism in numpy don't allow this nativelly ?
jrank•15h ago
The post I referenced before shows that broadcast is not a general solution.

Ask HN: How did Soham Parekh get so many jobs?

251•jshchnz•3d ago•356 comments

Ask HN: Advice for Starting a Hacker Space?

20•pkdpic•7h ago•12 comments

Ask HN: Worth leaving position over push to adopt vibe coding?

68•NotAnOtter•1d ago•81 comments

Tell HN: A fake, highly obfuscated Solidity VSCode plugin found on marketplace

11•navad•12h ago•1 comments

Ask HN: How many communities HN it devs in C language?

4•FerkiHN•15h ago•7 comments

Why did not numpy copy the J rank concept?

14•jrank•22h ago•5 comments

Ask HN: How do you sell to B2B in current state of AI?

4•salesdo•11h ago•4 comments

Ask HN: What Are You Working On? (June 2025)

435•david927•6d ago•1370 comments

Ask HN: Freelancer? Seeking freelancer? (July 2025)

84•whoishiring•4d ago•200 comments

Ask HN: Who is hiring? (July 2025)

268•whoishiring•4d ago•377 comments

Ask HN: Who wants to be hired? (July 2025)

128•whoishiring•4d ago•361 comments

Ask HN: What clever tools/scripts do you use to manage development environments?

8•sebst•23h ago•11 comments

Ask HN: Requests for Software – have something you want built?

8•NewUser76312•16h ago•3 comments

Looking for Early Testers for a AI Assistant Inside Zotero

10•jie6•1d ago•1 comments

Ask HN: What's the 2025 stack for a self-hosted photo library with local AI?

224•jamesxv7•5d ago•120 comments

Ask HN: Can't Figure Out Where to Go Next Career Wise

4•OulaX•20h ago•3 comments

Ask HN: Is there a business for extracting US tech talent?

27•Arubis•2d ago•36 comments

Ask HN: Are there any good WASM-based sites for learning Bash, Linux and CLI?

7•brightbeige•1d ago•2 comments

Super Simple "Hallucination Traps" to detect interview cheaters

28•EliotHerbst•3d ago•36 comments

OT Devices Exposed Online Without Authentication – Research Disclosure

3•hacker_might•1d ago•0 comments

Ask HN: What are non-social media ways to share photography/art

6•rPlayer6554•1d ago•9 comments

Ask HN: What are the best resources to help with health insurance denials?

10•cigna•2d ago•11 comments

1KB JavaScript Demoscene Challenge Just Launched

114•babakode•4d ago•31 comments

Ask HN: Why there is no demand for my SaaS when competition is killing it?

33•drvroom•3d ago•32 comments

Ask HN: How do companies like OpenAI, Perplexity fine tune rich output?

6•agaase19•2d ago•3 comments

A client wants to buy old SaaS app – smart move or risk?

6•AbbeyRoadRunner•1d ago•6 comments

Ask HN: What are good questions to ask in a remote round in post GPT era?

7•ashu1461•2d ago•17 comments

Ask HN: What codebase would you like to see rewritten, updated, or modernized?

6•globnomulous•1d ago•7 comments

Ask HN: Ideas to acquire "good taste" in programming?

9•danielciocirlan•2d ago•10 comments

Ask HN: I give in, what are the resources for picking up AI-assisted coding?

4•dhosek•2d ago•7 comments