(* Calcul de Fib(n) avec l'exponentiation rapide *) open Matrix (* Programme 83 page 333 + exercice 10.10 *) let fib n = let mfib = [| [| 1; 1 |]; [| 1; 0 |] |] in (power mfib n).(0).(1) let () = assert (fib 0 = 0); assert (fib 10 = 55); assert (fib 14 = 377)
This document was generated using caml2html