Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Kronecker Product

by choroba (Archbishop)
on Jun 21, 2022 at 12:56 UTC ( #11144902=note: print w/replies, xml ) Need Help??


in reply to Re: Kronecker Product
in thread Kronecker Product

Thanks, that's exactly the reply I was waiting for.

I see no difference between your solution and mine in the benchmark, but I definitely understand your points and see the improvement in the code.

Are you aware of any reading on "array languages" that would be understandable to tyros? I understand your solution but I can't imagine how to get to it (to get mine, I used trial and error repeatedly).

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^3: Kronecker Product
by etj (Chaplain) on Jun 21, 2022 at 17:26 UTC
    A nice intro to the concepts of array programming is https://en.wikipedia.org/wiki/Array_programming.

    Don't feel bad about trial and error; my first go at this (and I have the dubious privilege of being current PDL maintainer) assumed (wrongly) that dupN would be suitable for both sides of the multiplication; furthermore, it took me a little while to figure out inflateN, even though, annoyingly, it is nearly identical to dupN except for swapping the two parts of the slice argument.

Re^3: Kronecker Product
by vr (Curate) on Jun 21, 2022 at 16:39 UTC

    But it's same trial and error on my part. I think if anything can count as systematic approach, as true textbooks, from very basics and up, -- that, for me, have been Learning J and J for C Programmers, books designed to teach "tyros" the "array language", their authors using a bit different perspectives.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11144902]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2022-09-28 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (124 votes). Check out past polls.

    Notices?