Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: Kronecker Product

by etj (Chaplain)
on Jun 22, 2022 at 23:30 UTC ( #11144963=note: print w/replies, xml ) Need Help??


in reply to Re^3: Kronecker Product
in thread Kronecker Product

your approach really physicalizes arrays from 2D to 4D
No, it does not. It uses clump and slice, both of which are affine transformations (as shown by the P2Child=>1 in https://github.com/PDLPorters/pdl/blob/master/Basic/Slices/slices.pd for the relevant operations). Physicalising only happens on output or use in calculations, and when loop fusion comes in, not even then. I'd love to hear of an approach that Kronecker-products m1,n1 and m2,n2 matrices without producing a m1*m2,n1*n2 in-memory object. While you're pondering that, please show some numbers demonstrating these "grave consequences" :-)
Is this a bug in PDL::NiceSlice, documentation flaw, or just me reading it incorrectly?
You're going to need to show some code that you're saying is behaving unexpectedly. This worked as described (with output):
pdl> p sequence(2)->(*1) [ [0] [1] ] pdl> p sequence(2)->(*) [ [0] [1] ] pdl> p sequence(2)->(*,*) [ [ [0] ] [ [1] ] ]
Naturally, you need to make sure a use PDL::NiceSlice is in scope. You will have noticed that generally I avoid using it in core PDL code, because it both slows down module-loading, and has limitations; see PDL::LinearAlgebra, where I had to remove a lot of it in favour of building arguments to slice that took account of adding optional parts for PDL::Complex.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2022-08-08 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?