2009-09-30 13:58:32 -04:00
|
|
|
USING: locals math math.combinatorics math.matrices
|
|
|
|
prettyprint sequences typed ;
|
|
|
|
IN: benchmark.matrix-exponential-scalar
|
|
|
|
|
|
|
|
:: e^m ( m iterations -- e^m )
|
|
|
|
{
|
|
|
|
{ 0.0 0.0 0.0 0.0 }
|
|
|
|
{ 0.0 0.0 0.0 0.0 }
|
|
|
|
{ 0.0 0.0 0.0 0.0 }
|
|
|
|
{ 0.0 0.0 0.0 0.0 }
|
|
|
|
}
|
2017-06-01 17:59:35 -04:00
|
|
|
iterations <iota> [| i |
|
2009-09-30 13:58:32 -04:00
|
|
|
m i m^n i factorial >float m/n m+
|
|
|
|
] each ;
|
|
|
|
|
2012-07-19 20:35:47 -04:00
|
|
|
:: matrix-exponential-scalar-benchmark ( -- )
|
2009-09-30 13:58:32 -04:00
|
|
|
f :> result!
|
|
|
|
4 identity-matrix :> i4
|
|
|
|
10000 [
|
|
|
|
i4 20 e^m result!
|
|
|
|
] times
|
|
|
|
result . ;
|
|
|
|
|
2012-07-19 20:35:47 -04:00
|
|
|
MAIN: matrix-exponential-scalar-benchmark
|