diff --git a/extra/benchmark/dispatch2/dispatch2.factor b/extra/benchmark/dispatch2/dispatch2.factor index 93b42c3e6c..c9d4f9ffa2 100644 --- a/extra/benchmark/dispatch2/dispatch2.factor +++ b/extra/benchmark/dispatch2/dispatch2.factor @@ -1,5 +1,5 @@ USING: make math sequences splitting grouping -kernel columns float-arrays bit-arrays ; +kernel columns specialized-arrays.double bit-arrays ; IN: benchmark.dispatch2 : sequences ( -- seq ) @@ -10,7 +10,7 @@ IN: benchmark.dispatch2 "hello world" , SBUF" sbuf world" , V{ "a" "b" "c" } , - F{ 1.0 2.0 3.0 } , + double-array{ 1.0 2.0 3.0 } , "hello world" 4 tail-slice , 10 f , 100 2 , diff --git a/extra/benchmark/dispatch3/dispatch3.factor b/extra/benchmark/dispatch3/dispatch3.factor index aa3d11e2fb..94925f0d79 100644 --- a/extra/benchmark/dispatch3/dispatch3.factor +++ b/extra/benchmark/dispatch3/dispatch3.factor @@ -1,6 +1,6 @@ USING: sequences math mirrors splitting grouping kernel make assocs alien.syntax columns -float-arrays bit-arrays ; +specialized-arrays.double bit-arrays ; IN: benchmark.dispatch3 GENERIC: g ( obj -- str ) @@ -26,7 +26,7 @@ M: object g drop "object" ; "hello world" , SBUF" sbuf world" , V{ "a" "b" "c" } , - F{ 1.0 2.0 3.0 } , + double-array{ 1.0 2.0 3.0 } , "hello world" 4 tail-slice , 10 f , 100 2 , diff --git a/extra/benchmark/fasta/fasta.factor b/extra/benchmark/fasta/fasta.factor index 015f762c7b..32d3534920 100755 --- a/extra/benchmark/fasta/fasta.factor +++ b/extra/benchmark/fasta/fasta.factor @@ -1,7 +1,7 @@ ! Based on http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=java&id=2 USING: math kernel io io.files locals multiline assocs sequences sequences.private benchmark.reverse-complement hints io.encodings.ascii -byte-arrays float-arrays ; +byte-arrays specialized-arrays.double ; IN: benchmark.fasta : IM 139968 ; inline @@ -49,7 +49,7 @@ HINTS: random fixnum ; : make-cumulative ( freq -- chars floats ) dup keys >byte-array - swap values >float-array unclip [ + ] accumulate swap suffix ; + swap values >double-array unclip [ + ] accumulate swap suffix ; :: select-random ( seed chars floats -- seed elt ) floats seed random -rot diff --git a/extra/benchmark/nbody/nbody.factor b/extra/benchmark/nbody/nbody.factor index 7b20edaadb..305fc2e33b 100644 --- a/extra/benchmark/nbody/nbody.factor +++ b/extra/benchmark/nbody/nbody.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors float-arrays fry kernel locals make math +USING: accessors specialized-arrays.double fry kernel locals make math math.constants math.functions math.vectors prettyprint sequences hints arrays ; IN: benchmark.nbody @@ -9,39 +9,39 @@ IN: benchmark.nbody : days-per-year 365.24 ; inline TUPLE: body -{ location float-array } -{ velocity float-array } +{ location double-array } +{ velocity double-array } { mass float read-only } ; : ( location velocity mass -- body ) [ days-per-year v*n ] [ solar-mass * ] bi* body boa ; inline : ( -- body ) - F{ 4.84143144246472090e+00 -1.16032004402742839e+00 -1.03622044471123109e-01 } - F{ 1.66007664274403694e-03 7.69901118419740425e-03 -6.90460016972063023e-05 } + double-array{ 4.84143144246472090e+00 -1.16032004402742839e+00 -1.03622044471123109e-01 } + double-array{ 1.66007664274403694e-03 7.69901118419740425e-03 -6.90460016972063023e-05 } 9.54791938424326609e-04 ; : ( -- body ) - F{ 8.34336671824457987e+00 4.12479856412430479e+00 -4.03523417114321381e-01 } - F{ -2.76742510726862411e-03 4.99852801234917238e-03 2.30417297573763929e-05 } + double-array{ 8.34336671824457987e+00 4.12479856412430479e+00 -4.03523417114321381e-01 } + double-array{ -2.76742510726862411e-03 4.99852801234917238e-03 2.30417297573763929e-05 } 2.85885980666130812e-04 ; : ( -- body ) - F{ 1.28943695621391310e+01 -1.51111514016986312e+01 -2.23307578892655734e-01 } - F{ 2.96460137564761618e-03 2.37847173959480950e-03 -2.96589568540237556e-05 } + double-array{ 1.28943695621391310e+01 -1.51111514016986312e+01 -2.23307578892655734e-01 } + double-array{ 2.96460137564761618e-03 2.37847173959480950e-03 -2.96589568540237556e-05 } 4.36624404335156298e-05 ; : ( -- body ) - F{ 1.53796971148509165e+01 -2.59193146099879641e+01 1.79258772950371181e-01 } - F{ 2.68067772490389322e-03 1.62824170038242295e-03 -9.51592254519715870e-05 } + double-array{ 1.53796971148509165e+01 -2.59193146099879641e+01 1.79258772950371181e-01 } + double-array{ 2.68067772490389322e-03 1.62824170038242295e-03 -9.51592254519715870e-05 } 5.15138902046611451e-05 ; : ( -- body ) - F{ 0 0 0 } F{ 0 0 0 } 1 ; + double-array{ 0 0 0 } double-array{ 0 0 0 } 1 ; : offset-momentum ( body offset -- body ) vneg solar-mass v/n >>velocity ; inline @@ -49,7 +49,7 @@ TUPLE: body TUPLE: nbody-system { bodies array read-only } ; : init-bodies ( bodies -- ) - [ first ] [ F{ 0 0 0 } [ [ velocity>> ] [ mass>> ] bi v*n v+ ] reduce ] bi + [ first ] [ double-array{ 0 0 0 } [ [ velocity>> ] [ mass>> ] bi v*n v+ ] reduce ] bi offset-momentum drop ; inline : ( -- system ) diff --git a/extra/benchmark/raytracer/raytracer.factor b/extra/benchmark/raytracer/raytracer.factor index 34bac61292..7fe46e9c36 100755 --- a/extra/benchmark/raytracer/raytracer.factor +++ b/extra/benchmark/raytracer/raytracer.factor @@ -1,7 +1,7 @@ ! Factor port of the raytracer benchmark from ! http://www.ffconsultancy.com/free/ray_tracer/languages.html -USING: arrays accessors float-arrays io io.files +USING: arrays accessors specialized-arrays.double io io.files io.encodings.binary kernel math math.functions math.vectors math.parser make sequences sequences.private words hints ; IN: benchmark.raytracer @@ -9,7 +9,7 @@ IN: benchmark.raytracer ! parameters : light #! Normalized { -1 -3 2 }. - F{ + double-array{ -0.2672612419124244 -0.8017837257372732 0.5345224838248488 @@ -23,17 +23,17 @@ IN: benchmark.raytracer : delta 1.4901161193847656E-8 ; inline -TUPLE: ray { orig float-array read-only } { dir float-array read-only } ; +TUPLE: ray { orig double-array read-only } { dir double-array read-only } ; C: ray -TUPLE: hit { normal float-array read-only } { lambda float read-only } ; +TUPLE: hit { normal double-array read-only } { lambda float read-only } ; C: hit GENERIC: intersect-scene ( hit ray scene -- hit ) -TUPLE: sphere { center float-array read-only } { radius float read-only } ; +TUPLE: sphere { center double-array read-only } { radius float read-only } ; C: sphere @@ -87,7 +87,7 @@ TUPLE: group < sphere { objs array read-only } ; M: group intersect-scene ( hit ray group -- hit ) [ drop objs>> [ intersect-scene ] with each ] if-ray-sphere ; -: initial-hit T{ hit f F{ 0.0 0.0 0.0 } 1/0. } ; inline +: initial-hit T{ hit f double-array{ 0.0 0.0 0.0 } 1/0. } ; inline : initial-intersect ( ray scene -- hit ) [ initial-hit ] 2dip intersect-scene ; inline @@ -120,10 +120,10 @@ DEFER: create ( level c r -- scene ) : create-offsets ( quot -- ) { - F{ -1.0 1.0 -1.0 } - F{ 1.0 1.0 -1.0 } - F{ -1.0 1.0 1.0 } - F{ 1.0 1.0 1.0 } + double-array{ -1.0 1.0 -1.0 } + double-array{ 1.0 1.0 -1.0 } + double-array{ -1.0 1.0 1.0 } + double-array{ 1.0 1.0 1.0 } } swap each ; inline : create-bound ( c r -- sphere ) 3.0 * ; @@ -138,14 +138,14 @@ DEFER: create ( level c r -- scene ) pick 1 = [ nip ] [ create-group ] if ; : ss-point ( dx dy -- point ) - [ oversampling /f ] bi@ 0.0 3float-array ; + [ oversampling /f ] bi@ 0.0 double-array{ } 3sequence ; : ss-grid ( -- ss-grid ) oversampling [ oversampling [ ss-point ] with map ] map ; : ray-grid ( point ss-grid -- ray-grid ) [ - [ v+ normalize F{ 0.0 0.0 -4.0 } swap ] with map + [ v+ normalize double-array{ 0.0 0.0 -4.0 } swap ] with map ] with map ; : ray-pixel ( scene point -- n ) @@ -156,7 +156,7 @@ DEFER: create ( level c r -- scene ) size reverse [ size [ [ size 0.5 * - ] bi@ swap size - 3float-array + double-array{ } 3sequence ] with map ] map ; @@ -169,7 +169,7 @@ DEFER: create ( level c r -- scene ) pixel-grid [ [ ray-pixel ] with map ] with map ; : run ( -- string ) - levels F{ 0.0 -1.0 0.0 } 1.0 create ray-trace [ + levels double-array{ 0.0 -1.0 0.0 } 1.0 create ray-trace [ size size pgm-header [ [ oversampling sq / pgm-pixel ] each ] each ] B{ } make ; diff --git a/extra/benchmark/spectral-norm/spectral-norm.factor b/extra/benchmark/spectral-norm/spectral-norm.factor index 245027ef77..64d2bdbb1f 100644 --- a/extra/benchmark/spectral-norm/spectral-norm.factor +++ b/extra/benchmark/spectral-norm/spectral-norm.factor @@ -1,8 +1,8 @@ ! Factor port of ! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all -USING: float-arrays kernel math math.functions math.vectors -sequences sequences.private prettyprint words -hints locals ; +USING: specialized-arrays.double kernel math math.functions +math.vectors sequences sequences.private prettyprint words hints +locals ; IN: benchmark.spectral-norm :: inner-loop ( u n quot -- seq ) @@ -10,7 +10,7 @@ IN: benchmark.spectral-norm n 0.0 [| j | u i j quot call + ] reduce - ] F{ } map-as ; inline + ] double-array{ } map-as ; inline : eval-A ( i j -- n ) [ >float ] bi@ @@ -32,7 +32,7 @@ IN: benchmark.spectral-norm : eval-AtA-times-u ( u n -- seq ) [ eval-A-times-u ] [ eval-At-times-u ] bi ; inline -: ones ( n -- seq ) [ 1.0 ] F{ } replicate-as ; inline +: ones ( n -- seq ) [ 1.0 ] double-array{ } replicate-as ; inline :: u/v ( n -- u v ) n ones dup