My solutions usually are from a beginner's attach  on the problem, but
sometimes this may be helpful.

   ]A=:3 3$0
0 0 0
0 0 0
0 0 0
   ]B=: 0 1 3 2 {"1 A(,"1) 1
0 0 1 0
0 0 1 0
0 0 1 0
   
  
   ]C=:0 1 3 2{"2 B(,"2) 1
0 0 1 0
0 0 1 0
1 1 1 1
0 0 1 0
   
   
   ]D=:0 1 3{"2 C
0 0 1 0
0 0 1 0
0 0 1 0
  
   ]E=:0 1 3{"1 D
0 0 0
0 0 0
0 0 0
  

Linda 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Hui
Sent: Thursday, September 11, 2014 10:08 AM
To: Programming forum
Subject: Re: [Jprogramming] Extend/reduce matrix dimensions

Fractional axes specs are an abomination.  Don't bother trying to model it.

,: and ,:"r are far superior.


On Thu, Sep 11, 2014 at 7:00 AM, Dan Bron <[email protected]> wrote:

> Ben Gorte wrote:
> > I use an adverb called ins that behaves like } , except that it inserts
> :)
>
> In the argument to the adverb, does 1 ins refer to the item at index 1 in
> the argument, or the empty space between item 1 and item 2, or the empty
> space between item 0 and item 1, or what?
>
> If I recall correctly, in APL, you can use fractional indices to specify
> inserting along a new axis, so 'hello' ,[0.5] '-' would be equivalent to
> J's 'hello' ,: '-' and 'hello' ,[1.5] '-' would be 'hello' ,. '-'
> (assuming []IO<-1 in the APL).
>
> Maybe it's worth including an ins-like adverb in the stdlib which follows
> this convention (fractional indices refer to the lacunae between items)?
>
> -Dan
>
> PS:  Looks like Dyalog, at least, supports fraction axes; see p. 236 of
> their user guide (Chapter 4, "Catenate/Laminate", Section 2.15.2
> "Lamination with Fractional Axis Specification"):
>
>
>
http://docs.dyalog.com/13.1/Dyalog%20APL%20Programmer's%20Guide%20&%20Langua
ge%20Reference.pdf
>
>
> Lamination with Fractional Axis Specification
> ---------------------------------------------
>
> The arrays X and Y are joined along a new axis created before
> the {ceil}Kth axis.  The new axis has a length of 2.  K must exceed
> []IO (the index origin) minus 1, and K must be less than []IO plus
> the greater of the ranks of X and Y.  A scalar or unit vector argument
> is extended to the shape of the other argument.  Otherwise X and Y
> must have the same shape. The rank of R is one plus the greater of
> the ranks of X and Y.
>
>
> ----------------------------------------------------------------------
> 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

Reply via email to