matmul
FP matrix multiplication
- extensions
- raw README.md
- raw benchmark.4th
- raw matmul.4th
- raw package.4th
- raw runbenchs
- raw test.4th
\ matrix muliplication benchmark : init-matrix {: m ncols nrows nstart -- :} \ initialize m with floats nstart, nstart+1, ... nstart nrows 0 ?do ncols 0 ?do dup 0 d>f m j ncols * i + floats + f! 1+ loop loop drop ; 500 constant dim dim dup * floats allocate throw constant a a dim dim 1 init-matrix dim dup * floats allocate throw constant b b dim dim 30000 init-matrix dim dup * floats allocate throw constant c a b c dim dim matmul fvariable sum 0. d>f sum f! : checksum ( m ncols nrows -- x ) * 0 ?do ( m1 ) dup f@ sum f@ f+ sum f! float+ loop drop ; [defined] f~ [if] c dim dup checksum sum f@ 2423178953093560000. d>f 1e-5 f~ [if] .( result incorrect ) cr [then] [then]
by AntonErtl
Versions
2.0.2, 2.0.1, 2.0.0, 1.0.2, 1.0.1, 1.0.0
Tags
ansforth94, forth-94, forth-2012, floating-point-arithmetic, benchmark
Dependencies
None
Dependents
None