text
stringlengths
0
601k
let cosm ( ) = Alcotest . ( check bool ) " cosm " true ( To_test . cosm ( ) )
let tanm ( ) = Alcotest . ( check bool ) " tanm " true ( To_test . tanm ( ) )
let sincosm ( ) = Alcotest . ( check bool ) " sincosm " true ( To_test . sincosm ( ) )
let sinhm ( ) = Alcotest . ( check bool ) " sinhm " true ( To_test . sinhm ( ) )
let coshm ( ) = Alcotest . ( check bool ) " coshm " true ( To_test . coshm ( ) )
let tanhm ( ) = Alcotest . ( check bool ) " tanhm " true ( To_test . tanhm ( ) )
let sinhcoshm ( ) = Alcotest . ( check bool ) " sinhcoshm " true ( To_test . sinhcoshm ( ) )
let test_set = [ " rank " , ` Slow , rank ; " det " , ` Slow , det ; " inv " , ` Slow , inv ; " vecnorm_01 " , ` Slow , vecnorm_01 ; " vecnorm_02 " , ` Slow , vecnorm_02 ; " vecnorm_03 " , ` Slow , vecnorm_03 ; " vecnorm_04 " , ` Slow , vecnorm_04 ; " vecnorm_05 " , ` Slow , vecnorm_05 ; " vecnorm_06 " , ` Slow , vecno...
let approx_equal a b = let eps = 1e - 5 in N . approx_equal ~ eps a b
module To_test_gauss = struct let test01 ( ) = let a = N . of_array [ | 1 . ; 20 . ; - 30 . ; 4 . ] | [ | 2 ; 2 ] | in let b = N . of_array [ | 1 . ; 0 . ; 1 . ; 2 . ; - 30 . ; 0 . ; 1 . ; 0 . ; 1 . ; 4 . ] | [ | 2 ; 5 ] | in let a_inv , x = L . linsolve_gauss a b in let flag01 = approx_equal ( N . dot a a_inv ) ( M . ...
module To_test_lu = struct let perm_vec_to_mat vec = let n = Array . length vec in let mat = ref ( M . eye n ) in for i = n - 1 downto 0 do let j = vec . ( i ) in let a = M . eye n in N . set a [ | i ; i ] | 0 . ; N . set a [ | j ; j ] | 0 . ; N . set a [ | i ; j ] | 1 . ; N . set a [ | j ; i ] | 1 . ; mat := N . dot a...
module To_test_bandiag = struct let _test_tridiag n = let a = N . uniform [ | n ] | in let trimat = N . zeros [ | n ; n ] | in let a_vec = Array . make n 0 . in for i = 1 to n - 1 do let v = N . get a [ | i ] | in a_vec . ( i ) <- v ; N . set trimat [ | i ; i - 1 ] | v done ; let b = N . uniform [ | n ] | in let b_vec ...
let test_gauss_01 ( ) = Alcotest . ( check bool ) " test_guass_01 " true ( To_test_gauss . test01 ( ) )
let test_gauss_02 ( ) = Alcotest . ( check bool ) " test_guass_02 " true ( To_test_gauss . test02 ( ) )
let test_gauss_03 ( ) = Alcotest . ( check bool ) " test_guass_03 " true ( To_test_gauss . test03 ( ) )
let test_gauss_04 ( ) = Alcotest . ( check bool ) " test_guass_04 " true ( To_test_gauss . test04 ( ) )
let test_lu_01 ( ) = Alcotest . ( check bool ) " test_lu_01 " true ( To_test_lu . test01 ( ) )
let test_lu_02 ( ) = Alcotest . ( check bool ) " test_lu_02 " true ( To_test_lu . test02 ( ) )
let test_lu_03 ( ) = Alcotest . ( check bool ) " test_lu_03 " true ( To_test_lu . test03 ( ) )
let test_lu_04 ( ) = Alcotest . ( check bool ) " test_lu_04 " true ( To_test_lu . test04 ( ) )
let test_lu_05 ( ) = Alcotest . ( check bool ) " test_lu_05 " true ( To_test_lu . test05 ( ) )
let test_lu_06 ( ) = Alcotest . ( check bool ) " test_lu_06 " true ( To_test_lu . test06 ( ) )
let test_lu_07 ( ) = Alcotest . ( check bool ) " test_lu_07 " true ( To_test_lu . test07 ( ) )
let test_lu_08 ( ) = Alcotest . ( check bool ) " test_lu_08 " true ( To_test_lu . test08 ( ) )
let test_lu_09 ( ) = Alcotest . ( check bool ) " test_lu_09 " true ( To_test_lu . test09 ( ) )
let test_lu_10 ( ) = Alcotest . ( check bool ) " test_lu_10 " true ( To_test_lu . test10 ( ) )
let test_bandiag_01 ( ) = Alcotest . ( check bool ) " To_test_bandiag_01 " true ( To_test_bandiag . test01 ( ) )
let test_set = [ " test_gauss_01 " , ` Slow , test_gauss_01 ; " test_gauss_02 " , ` Slow , test_gauss_02 ; " test_gauss_03 " , ` Slow , test_gauss_03 ; " test_gauss_04 " , ` Slow , test_gauss_04 ; " test_lu_01 " , ` Slow , test_lu_01 ; " test_lu_02 " , ` Slow , test_lu_02 ; " test_lu_03 " , ` Slow , test_lu_03 ; " test...
let approx_equal a b = Stdlib . ( abs_float ( a . - b ) < eps )
module To_test = struct let test_j0 ( ) = approx_equal ( M . j0 0 . 5 ) 0 . 93846980724081297 let test_j1 ( ) = approx_equal ( M . j1 0 . 5 ) 0 . 24226845767487387 let test_jv ( ) = approx_equal ( M . jv 0 . 1 0 . 3 ) 0 . 85180759557596664 let test_y0 ( ) = approx_equal ( M . y0 0 . 5 ) ( - 0 . 44451873350670662 ) let ...
let test_j0 ( ) = Alcotest . ( check bool ) " test j0 " true ( To_test . test_j0 ( ) )
let test_j1 ( ) = Alcotest . ( check bool ) " test j1 " true ( To_test . test_j1 ( ) )
let test_jv ( ) = Alcotest . ( check bool ) " test jv " true ( To_test . test_jv ( ) )
let test_y0 ( ) = Alcotest . ( check bool ) " test y0 " true ( To_test . test_y0 ( ) )
let test_y1 ( ) = Alcotest . ( check bool ) " test y1 " true ( To_test . test_y1 ( ) )
let test_yv ( ) = Alcotest . ( check bool ) " test yv " true ( To_test . test_yv ( ) )
let test_i0 ( ) = Alcotest . ( check bool ) " test i0 " true ( To_test . test_i0 ( ) )
let test_i0e ( ) = Alcotest . ( check bool ) " test i0e " true ( To_test . test_i0e ( ) )
let test_i1 ( ) = Alcotest . ( check bool ) " test i1 " true ( To_test . test_i1 ( ) )
let test_i1e ( ) = Alcotest . ( check bool ) " test i1e " true ( To_test . test_i1e ( ) )
let test_iv ( ) = Alcotest . ( check bool ) " test iv " true ( To_test . test_iv ( ) )
let test_k0 ( ) = Alcotest . ( check bool ) " test k0 " true ( To_test . test_k0 ( ) )
let test_k0e ( ) = Alcotest . ( check bool ) " test k0e " true ( To_test . test_k0e ( ) )
let test_k1 ( ) = Alcotest . ( check bool ) " test k1 " true ( To_test . test_k1 ( ) )
let test_k1e ( ) = Alcotest . ( check bool ) " test k1e " true ( To_test . test_k1e ( ) )
let test_airy ( ) = Alcotest . ( check bool ) " test airy " true ( To_test . test_airy ( ) )
let test_ellipj ( ) = Alcotest . ( check bool ) " test ellipj " true ( To_test . test_ellipj ( ) )
let test_ellipk ( ) = Alcotest . ( check bool ) " test ellipk " true ( To_test . test_ellipk ( ) )
let test_ellipkm1 ( ) = Alcotest . ( check bool ) " test ellipkm1 " true ( To_test . test_ellipkm1 ( ) )
let test_ellipkinc ( ) = Alcotest . ( check bool ) " test ellipkinc " true ( To_test . test_ellipkinc ( ) )
let test_ellipe ( ) = Alcotest . ( check bool ) " test ellipe " true ( To_test . test_ellipe ( ) )
let test_ellipeinc ( ) = Alcotest . ( check bool ) " test ellipeinc " true ( To_test . test_ellipeinc ( ) )
let test_gamma ( ) = Alcotest . ( check bool ) " test gamma " true ( To_test . test_gamma ( ) )
let test_rgamma ( ) = Alcotest . ( check bool ) " test rgamma " true ( To_test . test_rgamma ( ) )
let test_loggamma ( ) = Alcotest . ( check bool ) " test loggamma " true ( To_test . test_loggamma ( ) )
let test_gammainc ( ) = Alcotest . ( check bool ) " test gammainc " true ( To_test . test_gammainc ( ) )
let test_gammaincinv ( ) = Alcotest . ( check bool ) " test gammaincinv " true ( To_test . test_gammaincinv ( ) )
let test_gammaincc ( ) = Alcotest . ( check bool ) " test gammaincc " true ( To_test . test_gammaincc ( ) )
let test_gammainccinv ( ) = Alcotest . ( check bool ) " test gammainccinv " true ( To_test . test_gammainccinv ( ) )
let test_psi ( ) = Alcotest . ( check bool ) " test psi " true ( To_test . test_psi ( ) )
let test_beta ( ) = Alcotest . ( check bool ) " test beta " true ( To_test . test_beta ( ) )
let test_betainc ( ) = Alcotest . ( check bool ) " test betainc " true ( To_test . test_betainc ( ) )
let test_bdtr ( ) = Alcotest . ( check bool ) " test bdtr " true ( To_test . test_bdtr ( ) )
let test_bdtrc ( ) = Alcotest . ( check bool ) " test bdtrc " true ( To_test . test_bdtrc ( ) )
let test_bdtri ( ) = Alcotest . ( check bool ) " test bdtri " true ( To_test . test_bdtri ( ) )
let test_btdtr ( ) = Alcotest . ( check bool ) " test btdtr " true ( To_test . test_btdtr ( ) )
let test_btdtri ( ) = Alcotest . ( check bool ) " test btdtri " true ( To_test . test_btdtri ( ) )
let test_fact ( ) = Alcotest . ( check bool ) " test fact " true ( To_test . test_fact ( ) )
let test_log_fact ( ) = Alcotest . ( check bool ) " test log_fact " true ( To_test . test_log_fact ( ) )
let test_combination ( ) = Alcotest . ( check bool ) " test combination " true ( To_test . test_combination ( ) )
let test_mulmod ( ) = Alcotest . ( check bool ) " test mulmod " true ( To_test . test_mulmod ( ) )
let test_powmod ( ) = Alcotest . ( check bool ) " test powmod " true ( To_test . test_powmod ( ) )
let test_is_prime ( ) = Alcotest . ( check bool ) " test is_prime " true ( To_test . test_is_prime ( ) )
let test_set = [ " test j0 " , ` Slow , test_j0 ; " test j1 " , ` Slow , test_j1 ; " test jv " , ` Slow , test_jv ; " test y0 " , ` Slow , test_y0 ; " test y1 " , ` Slow , test_y1 ; " test yv " , ` Slow , test_yv ; " test i0 " , ` Slow , test_i0 ; " test i0e " , ` Slow , test_i0e ; " test i1 " , ` Slow , test_i1 ; " te...
module type T = M . T
module type T = sig end
module type T = sig ; ; end
module type T = functor ( M : T ) -> functor ( M1 : T1 ) -> sig end
sig end and module M = M ' . MF ( X ) and type t ' = t ' '
module type T = ( sig end )
module type T = sig val v : t external x : ' a = " stub " type t = int and t2 = t exception Error of int class virtual [ ' a ] cl : object end and cl2 : object end class type clt = object end and [ ' a ] clt2 = object end module M : Sig module M ( X ) ( Y ) : Sig module type Sig module type Sig1 = sig end open M includ...
module Make ( N : Ndarray_Algodiff with type elt = float ) = struct let tolerance_f64 = 1e - 8 let tolerance_f32 = 5e - 4 let close a b = N . ( sub a b |> abs |> sum ' ) < tolerance_f32 let test_sum_reduce ( ? seq = false ) ( ? a = true ) expected shape axis = let input = if seq = false then N . ones shape else N . seq...
let x0 = Arr . sequential [ | 10 ] |
let x1 = Arr . sequential [ | 10 ; 10 ] |
let x2 = Arr . sequential [ | 10 ; 10 ; 10 ] |
module To_test = struct let test_01 ( ) = let b = ref 0 . in Arr . iter ( fun a -> b := ! b . + a ) x0 ; let c = Arr . sum ' x0 in ! b = c let test_02 ( ) = let b = ref 0 . in Arr . iter ( fun a -> b := ! b . + a ) x1 ; let c = Arr . sum ' x1 in ! b = c let test_03 ( ) = let b = ref 0 . in Arr . iter ( fun a -> b := ! ...
let test_01 ( ) = Alcotest . ( check bool ) " test 01 " true ( To_test . test_01 ( ) )
let test_02 ( ) = Alcotest . ( check bool ) " test 02 " true ( To_test . test_02 ( ) )
let test_03 ( ) = Alcotest . ( check bool ) " test 03 " true ( To_test . test_03 ( ) )
let test_04 ( ) = Alcotest . ( check bool ) " test 04 " true ( To_test . test_04 ( ) )
let test_05 ( ) = Alcotest . ( check bool ) " test 05 " true ( To_test . test_05 ( ) )
let test_06 ( ) = Alcotest . ( check bool ) " test 06 " true ( To_test . test_06 ( ) )
let test_07 ( ) = Alcotest . ( check bool ) " test 07 " true ( To_test . test_07 ( ) )
let test_08 ( ) = Alcotest . ( check bool ) " test 08 " true ( To_test . test_08 ( ) )
let test_09 ( ) = Alcotest . ( check bool ) " test 09 " true ( To_test . test_09 ( ) )
let test_10 ( ) = Alcotest . ( check bool ) " test 10 " true ( To_test . test_10 ( ) )
let test_11 ( ) = Alcotest . ( check bool ) " test 11 " true ( To_test . test_11 ( ) )
let test_12 ( ) = Alcotest . ( check bool ) " test 12 " true ( To_test . test_12 ( ) )
let test_13 ( ) = Alcotest . ( check bool ) " test 13 " true ( To_test . test_13 ( ) )
let test_14 ( ) = Alcotest . ( check bool ) " test 14 " true ( To_test . test_14 ( ) )