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