(0 0;1 1)}&(2 2$0)"1 (arr1 ,. arr2)

On Sat, 08 Aug 2020 10:13:08 +0200
Thomas Bulka <[email protected]> wrote:

> Hello everyone,
> 
> I'm stuck with a problem, which (I think) should be really easy to solve 
> in J, but I somehow am not able to do it. This is what I want to do:
> 
> Let's assume I have two arrays:
> 
> arr1 =: 1 2 3
> arr2 =: 4 5 6
> 
> Now I do imagine some kind of "template" for a matrix which looks like 
> this:
> 
> X 0
> 0 Y
> 
> What I want to do now is to construct a rank-3 array (shape 3 2 2), in 
> which in each consecutive plane X has been replaced by one element of 
> arr1 and Y has been replaced with one element of arr2. The final array 
> should therefore be:
> 
> finalarr =: 3 2 2 $ 1 0 0 4 2 0 0 5 3 0 0 6
> 
> I'm looking for a sentence/function, that constructs an array of shape n 
> 2 2 (in the example given above) where n equals # arr1 (we can assume 
> that (# arr1) = # arr2). As I said - I've got the feeling that this 
> should be not too hard to do in J, but somehow I'm stuck.
> 
> Thank you very much for your help!
> 
> Regards,
> 
> Thomas
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to