Good news.
Thanks to the superb solution of Groeneveld (see
http://www.jsoftware.com/jwiki/RE Boss/J-blog/RUT ), ProjModel2 could be
improved considerably.
[sc=:scores(":,.3 4 5 6 7)<@,"1 ' test 55'
0.036046215 12541760
0.023910321 16624512
0.025729425 10494272
0.023315829 10456192
0.016015942 8414976
('ProjOutf';'ProjModel1';'ProjModel1a';'ProjModel2';'ProjModel21')dspl
rn=:rnkng sc
+-----------+----+-------+------+------+
|verb |rank|rlt_prf|rlt_et|rlt_sz|
+-----------+----+-------+------+------+
|ProjOutf | 4 |3.35 |2.25 |1.49 |
+-----------+----+-------+------+------+
|ProjModel1 | 3 |2.95 |1.49 |1.98 |
+-----------+----+-------+------+------+
|ProjModel1a| 2 |2.00 |1.61 |1.25 |
+-----------+----+-------+------+------+
|ProjModel2 | 1 |1.81 |1.46 |1.24 |
+-----------+----+-------+------+------+
|ProjModel21| 0 |1.00 |1.00 |1.00 |
+-----------+----+-------+------+------+
2-:/\(3 4 5 6 7) test"0[ 55 NB. outputs match
1 1 1 1
ProjModel21=: 3 : 0
'pop new srv'=.y
b=. 1 #~ (1 j.~ |....@i.) c=. 1 { $pop
pop=. (0 -.~ ,@|:)"2 pop
srv=. (0 -.~ ,@}:@|:@}:)"2 srv
new=. 1 0 2 |: new
z=. ,: a=. pop
for_t. new do.
z=. z, a=. t ,"1 srv * b #"1 a
end.
1 0 2 3|: (>:@(+/\)@(# , ])@}:\...@i.@- c) ({0&,)"_ 1 z
)
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Robert Cyr
> Verzonden: dinsdag 14 april 2009 16:56
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Oblique can be slow
>
> On my pc, Model2 is best, even if it takes 3% longer to complete than
> model
> 1.
>
> jpm confirms that attention to the data structure is an important part of
> the solution. In Model2, it takes more than twice as long to reformat
> the
> results as to make the actual calculation.
>
> Thanks again. There is still some verification before I really can use
> the
> routines I have written, this leaves me still in the development stage,
> and
> I will revise my solution and try to incorporate your recommendations.
>
> Presently my timing is at 1.06 overall. With a drastic cut in this timing
> and a bit of graphics I would consider putting this thing online for a few
> selected users.
>
> Robert Cyr
>
> On Sun, Apr 5, 2009 at 3:59 PM, R.E. Boss <[email protected]> wrote:
>
> > Stripping the structure gives better performance.
> >
> > [sc=:scores(":,.3 4 5 6)<@,"1 ' test 55'
> > 0.036677156 12541376
> > 0.023493124 16624128
> > 0.025254491 12589888
> > 0.023507607 10455808
> >
> > ('ProjOutf';'ProjModel1';'ProjModel1a';'ProjModel2')dspl rn=:rnkng sc
> > +-----------+----+-------+------+------+
> > |verb |rank|rlt_prf|rlt_et|rlt_sz|
> > +-----------+----+-------+------+------+
> > |ProjOutf | 3 |1.87 |1.56 |1.20 |
> > +-----------+----+-------+------+------+
> > |ProjModel1 | 2 |1.59 |1.00 |1.59 |
> > +-----------+----+-------+------+------+
> > |ProjModel1a| 1 |1.29 |1.07 |1.20 |
> > +-----------+----+-------+------+------+
> > |ProjModel2 | 0 |1.00 |1.00 |1.00 |
> > +-----------+----+-------+------+------+
> >
> > ProjModel2 is 30%, 60% and 90% more efficient.
> >
> > ProjModel2=: 3 : 0
> > 'pop new srv'=.y
> > b=.1#~(1 j.~|....@i.) c=.1{$pop
> > pop=.(0-.~,@|:)"2 pop
> > srv=.(0-.~ ,@}:@|:@}:)"2 srv
> > new=.1 0 2|: new
> > z=. ,: a=.pop
> > for_t. new do.
> > z=.z, a=.t ,"1 srv * b #"1 a
> > end.
> > 1 0 3 2|:(2#c) $"1(1#~((1&|.j.~|.@:>:)@i.)c)#^:_1"1 z
> > )
> >
> > It seems rather important how the input is delivered an how the output
> is
> > to
> > be presented. Simplifications in one or both could result in
> considerable
> > performance improvements.
> >
> >
> > R.E. Boss
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm