It's an interesting transpose, but BQN has a much more elegant solution: with multidimensional Join, the product of arrays is just ∾a×<b, or ∾×⟜< as a tacit function.
Code: https://mlochbaum.github.io/BQN/try.html#code=YSDihpAgMTArMuKAvzPipYrihpU2CmIg4oaQIDPigL804qWK4oaVMTIK4oi+YcOXPGI= Docs: https://mlochbaum.github.io/BQN/doc/join.html#join J's raze is just like Join for list arguments, but that implicit ravel means it's stuck doing 1-dimensional joins forever. I said in the previous podcast that I really didn't like J's implicit ravel and this is why (and I said I missed its multidimensional i. for example code only... also relevant). Even so, it's nice to know the connection between Join and Transpose. Thanks for the link—I've seen it but it didn't occur to me in this context. Marshall On Wed, Jun 15, 2022 at 09:00:13PM +0200, Jan-Pieter Jacobs wrote: > Hi, > > I'd like to thank the entire Arraycast crew for this excellent podcast, I'm > always looking forward to the next episode. I find it super informative, > with a healthy dose of humour. Great job; please continue ;). > > Since you didn't seem to find many applications of dyadic transpose, I'd > like to point out the Kronecker product page on the J wiki: > https://code.jsoftware.com/wiki/Essays/Kronecker_Product > > Conceptually, it multiplies each element of a left array with the entirity > of the right array. > One of the implementations (kp) uses dyadic transpose to zip together the > axes of the *"0 _ in alternating order. > > A while back, I coded up a generalised version for arbitrarily shaped > arrays (that is any but not scalar. see the "kpnd" verb, on the same page), > using the same approach. I hope this extension makes sense, because I could > not find any implementation or description of such generalisation. The "as" > verb calculates the required axis shuffle needed, to be later reshaped into > the final shape by the "cs" verb. > > As an aside (I didn't put it on the Kronecker product page since it's not > exactly a Kronecker product), in recent J (903 or up), one can define a > generic Kronecker-dyad forming adverb as the following tacit modifier: > > kd =: (("0 _) |:~ as) (]: ($,)~ cs) > > such that kpnd is equivalent to * kd. This way one could do Kronecker sums > (+kp) or Kronecker versions of whatever rank 0 dyad you'd like. > > Now to find an application for these verbs... Always nice to have a pretty > solution waiting to meet its corresponding problem :p. > > Best regards, > Jan-Pieter > > On Sat, 11 Jun 2022, 18:21 'robert therriault' via Programming, < > programm...@jsoftware.com> wrote: > > > Hi everyone, > > > > In this episode we explore monadic and dyadic transpose and the ways it is > > interpreted in APL, BQN and J. > > > > Host: Conor Hoekstra Panel: Marshall Lochbaum, Adám Brudzewsky, Stephen > > Taylor and Bob Therriault. > > > > https://www.arraycast.com/episodes/episode28-rank-and-leading-axis-gbbpe > > > > Cheers, bob > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm