Tarmo Veskioja-2 wrote:
> 
> I would like to find a faster way of computing a similarity distance
> matrix.
> My current solution is the following:
> 
>    time=: 6!:2
>    9!:3(5)    NB. set system for linear display of verbs
> 
>    $ t2 =: 5000 40 $ ?.200000#5        NB. data table of integers, 40
> variables, 5000 records
> 
>    find_similarity_distance_matrix =: 13 : '+/@:="1/~ y'
> 
>    time '$ find_similarity_distance_matrix t2'
>     NB. 6.73964
> 
> Is there a way to improve it, with special code perhaps?
> 
> -Tarmo
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> 
One way to speed it up:

   t2 =: 5000 40 $ ?.200000#5
   
   f =: +/@:="1/~   NB. your code
   
   h =: +/"1@:(="1/~)  NB. faster
   
   time 'y1=.f t2'
4.72867
   time 'y2=.h t2'
2.87618
   y1-:y2
1

-- 
View this message in context: 
http://old.nabble.com/Any-faster-way-of-computing-a-similarity-distance-matrix---tp33864384s24193p33864768.html
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to