text stringlengths 12 786k |
|---|
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 ( ) ) |
let test_15 ( ) = Alcotest . ( check bool ) " test 15 " true ( To_test . test_15 ( ) ) |
let test_16 ( ) = Alcotest . ( check bool ) " test 16 " true ( To_test . test_16 ( ) ) |
let test_17 ( ) = Alcotest . ( check bool ) " test 17 " true ( To_test . test_17 ( ) ) |
let test_18 ( ) = Alcotest . ( check bool ) " test 18 " true ( To_test . test_18 ( ) ) |
let test_19 ( ) = Alcotest . ( check bool ) " test 19 " true ( To_test . test_19 ( ) ) |
let test_20 ( ) = Alcotest . ( check bool ) " test 20 " true ( To_test . test_20 ( ) ) |
let test_21 ( ) = Alcotest . ( check bool ) " test 21 " true ( To_test . test_21 ( ) ) |
let test_22 ( ) = Alcotest . ( check bool ) " test 22 " true ( To_test . test_22 ( ) ) |
let test_23 ( ) = Alcotest . ( check bool ) " test 23 " true ( To_test . test_23 ( ) ) |
let test_24 ( ) = Alcotest . ( check bool ) " test 24 " true ( To_test . test_24 ( ) ) |
let test_25 ( ) = Alcotest . ( check bool ) " test 25 " true ( To_test . test_25 ( ) ) |
let test_26 ( ) = Alcotest . ( check bool ) " test 26 " true ( To_test . test_26 ( ) ) |
let test_27 ( ) = Alcotest . ( check bool ) " test 27 " true ( To_test . test_27 ( ) ) |
let test_28 ( ) = Alcotest . ( check bool ) " test 28 " true ( To_test . test_28 ( ) ) |
let test_29 ( ) = Alcotest . ( check bool ) " test 29 " true ( To_test . test_29 ( ) ) |
let test_30 ( ) = Alcotest . ( check bool ) " test 30 " true ( To_test . test_30 ( ) ) |
let test_31 ( ) = Alcotest . ( check bool ) " test 31 " true ( To_test . test_31 ( ) ) |
let test_32 ( ) = Alcotest . ( check bool ) " test 32 " true ( To_test . test_32 ( ) ) |
let test_33 ( ) = Alcotest . ( check bool ) " test 33 " true ( To_test . test_33 ( ) ) |
let test_34 ( ) = Alcotest . ( check bool ) " test 34 " true ( To_test . test_34 ( ) ) |
let test_35 ( ) = Alcotest . ( check bool ) " test 35 " true ( To_test . test_35 ( ) ) |
let test_36 ( ) = Alcotest . ( check bool ) " test 36 " true ( To_test . test_36 ( ) ) |
let test_set = [ " test 01 " , ` Slow , test_01 ; " test 02 " , ` Slow , test_02 ; " test 03 " , ` Slow , test_03 ; " test 04 " , ` Slow , test_04 ; " test 05 " , ` Slow , test_05 ; " test 06 " , ` Slow , test_06 ; " test 07 " , ` ... |
let matrix = Alcotest . testable ( fun _p _x -> ( ) ) M . equal |
let x0 = M . zeros Float64 3 4 |
let x1 = M . ones Float64 3 4 |
let x2 = M . sequential Float64 3 4 |
module To_test = struct let sequential ( ) = M . sequential Float64 3 4 let row_num x = M . row_num x let col_num x = M . col_num x let numel x = M . numel x let transpose ( ) = let y = M . zeros Float64 4 3 in let y = M . mapi ( fun i j _ -> i + ( M . row_num y * j ) |> flo... |
let sequential ( ) = Alcotest . ( check matrix ) " sequential " x2 ( To_test . sequential ( ) ) |
let row_num ( ) = Alcotest . ( check int ) " row_num " 3 ( To_test . row_num x2 ) |
let col_num ( ) = Alcotest . ( check int ) " col_num " 4 ( To_test . col_num x0 ) |
let numel ( ) = Alcotest . ( check int ) " numel " 12 ( To_test . numel x0 ) |
let transpose ( ) = Alcotest . ( check bool ) " transpose " true ( To_test . transpose ( ) ) |
let get ( ) = Alcotest . ( check ( float eps ) ) " get " 6 . ( To_test . get x2 ) |
let set ( ) = Alcotest . ( check ( float eps ) ) " set " 5 . ( To_test . set ( ) ) |
let fill ( ) = Alcotest . ( check matrix ) " fill " x1 ( To_test . fill ( ) ) |
let row ( ) = Alcotest . ( check matrix ) " row " ( M . row x2 1 ) ( To_test . row ( ) ) |
let col ( ) = Alcotest . ( check matrix ) " col " ( M . col x2 1 ) ( To_test . col ( ) ) |
let trace ( ) = Alcotest . ( check ( float eps ) ) " trace " 15 . ( To_test . trace x2 ) |
let sum ( ) = Alcotest . ( check ( float eps ) ) " sum " 66 . ( To_test . sum x2 ) |
let exists ( ) = Alcotest . ( check bool ) " exits " true ( To_test . exists x2 ) |
let not_exists ( ) = Alcotest . ( check bool ) " not_exists " true ( To_test . not_exists x2 ) |
let for_all ( ) = Alcotest . ( check bool ) " for_all " false ( To_test . for_all x2 ) |
let equal ( ) = Alcotest . ( check bool ) " equal " true ( To_test . equal x1 ( M . map ( ( . + ) 1 . ) x0 ) ) |
let not_equal ( ) = Alcotest . ( check bool ) " not_equal " true ( To_test . not_equal x0 x1 ) |
let less ( ) = Alcotest . ( check bool ) " less " true ( To_test . less ( ) ) |
let greater ( ) = Alcotest . ( check bool ) " greater " false ( To_test . greater ( ) ) |
let greater_equal ( ) = Alcotest . ( check bool ) " greater_equal " true ( To_test . greater_equal x2 ) |
let less_equal ( ) = Alcotest . ( check bool ) " less_equal " true ( To_test . less_equal x2 ) |
let is_zero ( ) = Alcotest . ( check bool ) " is_zero " true ( To_test . is_zero x0 ) |
let is_positive ( ) = Alcotest . ( check bool ) " is_positive " true ( To_test . is_positive x1 ) |
let is_negative ( ) = Alcotest . ( check bool ) " is_negative " false ( To_test . is_negative x1 ) |
let is_nonnegative ( ) = Alcotest . ( check bool ) " is_nonnegative " true ( To_test . is_nonnegative x0 ) |
let is_nonpositive ( ) = Alcotest . ( check bool ) " is_nonpositive " true ( To_test . is_nonpositive x0 ) |
let add ( ) = Alcotest . ( check bool ) " add " true ( To_test . add x2 ) |
let mul ( ) = Alcotest . ( check bool ) " mul " true ( To_test . mul x2 ) |
let dot ( ) = Alcotest . ( check bool ) " dot " true ( To_test . dot ( ) ) |
let add_scalar ( ) = Alcotest . ( check bool ) " add_scalar " true ( To_test . add_scalar ( ) ) |
let mul_scalar ( ) = Alcotest . ( check bool ) " mul_scalar " true ( To_test . mul_scalar ( ) ) |
let min ( ) = Alcotest . ( check bool ) " min " true ( To_test . min ( ) ) |
let max ( ) = Alcotest . ( check bool ) " max " true ( To_test . max ( ) ) |
let map ( ) = Alcotest . ( check bool ) " map " true ( To_test . map ( ) ) |
let fold ( ) = Alcotest . ( check ( float eps ) ) " fold " ( M . sum x2 ) ( To_test . fold x2 ) |
let foldi ( ) = Alcotest . ( check bool ) " foldi " true ( To_test . foldi ( ) ) |
let foldi_nz ( ) = Alcotest . ( check bool ) " foldi_nz " true ( To_test . foldi_nz ( ) ) |
let filter ( ) = Alcotest . ( check bool ) " filter " true ( To_test . filter ( ) ) |
let fold_rows ( ) = Alcotest . ( check bool ) " fold_rows " true ( To_test . fold_rows ( ) ) |
let fold_cols ( ) = Alcotest . ( check bool ) " fold_cols " true ( To_test . fold_cols ( ) ) |
let sum_rows ( ) = Alcotest . ( check bool ) " sum_rows " true ( To_test . sum_rows ( ) ) |
let sum_cols ( ) = Alcotest . ( check bool ) " sum_cols " true ( To_test . sum_cols ( ) ) |
let of_array ( ) = Alcotest . ( check bool ) " of_array " true ( To_test . of_array ( ) ) |
let save_load ( ) = Alcotest . ( check bool ) " save_load " true ( To_test . save_load ( ) ) |
let test_set = [ " sequential " , ` Slow , sequential ; " row_num " , ` Slow , row_num ; " col_num " , ` Slow , col_num ; " numel " , ` Slow , numel ; " transpose " , ` Slow , transpose ; " get " , ` Slow , get ; " set " , ` Slow , set... |
let ndarray = Alcotest . testable ( fun _p ( _x : ( float , float64_elt ) M . t ) -> ( ) ) M . equal |
let x0 = M . zeros Float64 [ | 2 ; 2 ; 3 ] | |
let _ = M . set x0 [ | 0 ; 0 ; 1 ] | 1 . ; M . set x0 [ | 0 ; 1 ; 0 ] | 2 . ; M . set x0 [ | 1 ; 0 ; 0 ] | 3 . |
let x1 = M . zeros Float64 [ | 2 ; 2 ; 3 ] | |
let _ = M . set x1 [ | 0 ; 0 ; 1 ] | 1 . ; M . set x1 [ | 0 ; 0 ; 2 ] | 2 . ; M . set x1 [ | 0 ; 1 ; 1 ] | 3 . ; M . set x1 [ | 1 ; 0 ; 0 ] | 4 . |
let x2 = M . zeros Float64 [ | 2 ; 2 ; 3 ] | |
let _ = M . set x2 [ | 0 ; 0 ; 1 ] | 2 . ; M . set x2 [ | 0 ; 0 ; 2 ] | 2 . ; M . set x2 [ | 0 ; 1 ; 0 ] | 2 . ; M . set x2 [ | 0 ; 1 ; 1 ] | 3 . ; M . set x2 [ | 1 ; 0 ; 0 ] | 7 . |
module To_test = struct let shape ( ) = M . shape x0 = [ | 2 ; 2 ; 3 ] | let num_dims ( ) = M . num_dims x0 = 3 let nth_dim ( ) = M . nth_dim x0 2 = 3 let numel ( ) = M . numel x0 = 12 let nnz ( ) = M . nnz x0 = 3 let density ( ) = M . density x0 = 3 .... |
let shape ( ) = Alcotest . ( check bool ) " shape " true ( To_test . shape ( ) ) |
let num_dims ( ) = Alcotest . ( check bool ) " num_dims " true ( To_test . num_dims ( ) ) |
let nth_dim ( ) = Alcotest . ( check bool ) " nth_dim " true ( To_test . nth_dim ( ) ) |
let numel ( ) = Alcotest . ( check bool ) " numel " true ( To_test . numel ( ) ) |
let nnz ( ) = Alcotest . ( check bool ) " nnz " true ( To_test . nnz ( ) ) |
let density ( ) = Alcotest . ( check bool ) " density " true ( To_test . density ( ) ) |
let get ( ) = Alcotest . ( check bool ) " get " true ( To_test . get ( ) ) |
let set ( ) = Alcotest . ( check bool ) " set " true ( To_test . set ( ) ) |
let slice ( ) = Alcotest . ( check bool ) " slice " true ( To_test . slice ( ) ) |
let copy ( ) = Alcotest . ( check bool ) " copy " true ( To_test . copy ( ) ) |
let map ( ) = Alcotest . ( check bool ) " map " true ( To_test . map ( ) ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.