Also, here is a generic verb which makes
a sparse from indices and values
(isn't there a better way ?)

   sp=: ]`(<"[EMAIL PROTECTED])`(1: $. 1: + >./@[) }

   (,.~&i. ; 1:) 5
+---+-+
|0 0|1|
|1 1| |
|2 2| |
|3 3| |
|4 4| |
+---+-+

   (,.~&i. sp 1:) 5
0 0 | 1
1 1 | 1
2 2 | 1
3 3 | 1
4 4 | 1


--- "R.E. Boss" <[EMAIL PROTECTED]> wrote:

> Sparse is not used yet:
>  I34=: 1: ([`(] ;/@,[EMAIL PROTECTED]@#)`])} 1:$.,~
> 
> 
> 
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Namens Roger Hui
> Verzonden: donderdag 23 maart 2006 17:59
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] monad e.
> 
> Efficiency is usually not the main concern when generating 
> the identity matrix.  You'd run out of space well before 
> the time would matter.
> 
> I myself prefer the really short methods, for example, [EMAIL PROTECTED]
> 
> 
> 
> ----- Original Message ----- 
> From: "R.E. Boss" <[EMAIL PROTECTED]>
> To: "'Programming forum'" <[email protected]>
> Sent: Thursday, March 23, 2006 8:23 AM
> Subject: RE: [Jprogramming] monad e.
> 
> Your method seems to be equivalent to I3a in
> http://www.jsoftware.com/jwiki/Essays/Identity_Matrix but nothing is said
> there about performance. 
> 
> R.E. Boss
> 
> 
> 
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Namens Devon McCormick
> Verzonden: donderdag 23 maart 2006 17:05
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] monad e.
> 
> I use the following to produce an identity matrix because it's faster:
> idMat=: 2&$ $ ([: >: ]) {. 1"_
> which is a tacit version of
> idMat=: 3 : '(2$y.)$(>:y.){.1'
> 
> Can't say I've ever used monadic e. but I like Oleg's pictures.
> 
> On 3/22/06, Henry Rich <[EMAIL PROTECTED]> wrote:
> >
> > Except for e. i. n to produce an identity matrix, has anybody
> > ever used monad e. ?
> >
> > Henry Rich
> 
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to