benchmark.spectral-norm: take out unsafe sequence access since it doesn't make it faster, and replace tuck/2bi* with bi-curry bi*
parent
d79b6d590e
commit
8d83824bb8
|
@ -1,8 +1,7 @@
|
|||
! Factor port of
|
||||
! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
|
||||
USING: specialized-arrays kernel math math.functions
|
||||
math.vectors sequences sequences.private prettyprint words hints
|
||||
locals ;
|
||||
math.vectors sequences prettyprint words hints locals ;
|
||||
SPECIALIZED-ARRAY: double
|
||||
IN: benchmark.spectral-norm
|
||||
|
||||
|
@ -19,13 +18,13 @@ IN: benchmark.spectral-norm
|
|||
+ 1 + recip ; inline
|
||||
|
||||
: (eval-A-times-u) ( u i j -- x )
|
||||
tuck [ swap nth-unsafe ] [ eval-A ] 2bi* * ; inline
|
||||
[ swap nth ] [ eval-A ] bi-curry bi* * ; inline
|
||||
|
||||
: eval-A-times-u ( n u -- seq )
|
||||
[ (eval-A-times-u) ] inner-loop ; inline
|
||||
|
||||
: (eval-At-times-u) ( u i j -- x )
|
||||
tuck [ swap nth-unsafe ] [ swap eval-A ] 2bi* * ; inline
|
||||
[ swap nth ] [ swap eval-A ] bi-curry bi* * ; inline
|
||||
|
||||
: eval-At-times-u ( u n -- seq )
|
||||
[ (eval-At-times-u) ] inner-loop ; inline
|
||||
|
|
Loading…
Reference in New Issue