require'grid'
tst=: _99&".;._2 (0 : 0)
0 0 0 1 0 0
0 0 0 0 0 0
3 0 0 0 0 0
0 0 0 2 0 0
0 0 0 0 0 0
1 0 0 0 0 0
0 1 0 5 0 1
)
a=:8$.$.tst
a
0 3 | 1
2 0 | 3
3 3 | 2
5 0 | 1
6 1 | 1
6 3 | 5
6 5 | 1
grid a
I am wondering why grid a shows me tst and not a
2008/6/12 Don Guinn <[EMAIL PROTECTED]>:
> How about?
> 4$.$.tst
> 0 3
> 2 0
> 3 3
> 5 0
>
> On Wed, Jun 11, 2008 at 6:34 PM, Sherlock, Ric <[EMAIL PROTECTED]>
> wrote:
>
> > Thanks Roger & Henry,
> > They are much simpler than the other way I just realised I had already
> > created in the other thread.
> >
> > ind0=: (1 , {:@$) *"1 [: (<. ,. 1&|) {:@$ %~ [: I. , NB. RS
> > ind1=: [:;(i.@:# ,.&.> <@I.) NB. RS
> > ind2=: $ #: I.@, NB. RH & HR
> > ind3=: , # (#: i.@(*/))@$ NB. HR
> >
> > Interestingly ind0 is actually very competitive with ind2, but would need
> > more work to sort out tolerance (and is specific to matrices).
> > tmp=: 0.0000001>1e6 [EMAIL PROTECTED]
> > +/+/tmp
> > 9
> > ts=: 6!:2 , 7!:[EMAIL PROTECTED]
> >
> > ts 'ind0 tmp'
> > 0.264977043172 134218688
> > ts 'ind1 tmp'
> > 3.26141171573 221066560
> > ts 'ind2 tmp'
> > 0.2667722434 134218688
> > ts 'ind3 tmp'
> > |out of memory: ind3
> > | ind3 tmp
> >
> > ---Roger Hui wrote:
> > > ($tst) #: I. , tst
> > >
> > > Works for any rank array, not just matrices.
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Fornustekkum II, 781 Hornafirði
Po Box 127,801 Selfoss ,
t-póst: [EMAIL PROTECTED]
gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=)
`. )----' (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm