text stringlengths 12 786k |
|---|
let row1 ( ) = Alcotest . ( check bool ) " row1 " true ( To_test . row1 ( ) ) |
let col0 ( ) = Alcotest . ( check bool ) " col0 " true ( To_test . col0 ( ) ) |
let col1 ( ) = Alcotest . ( check bool ) " col1 " true ( To_test . col1 ( ) ) |
let trace ( ) = Alcotest . ( check ( float eps ) ) " trace " 15 . ( To_test . trace x2 ) |
let add_diag ( ) = Alcotest . ( check matrix ) " add_diag " ( M . eye Float64 3 ) ( To_test . add_diag ( ) ) |
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 . add_scalar x0 1 . ) ) |
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 kron ( ) = Alcotest . ( check bool ) " kron " true ( To_test . kron ( ) ) |
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 ( float eps ) ) " min " 1 . ( To_test . min ' x2 ) |
let max ' ( ) = Alcotest . ( check ( float eps ) ) " max " 12 . ( To_test . max ' x2 ) |
let min_i ( ) = Alcotest . ( check bool ) " min_i " true ( To_test . min_i ( ) ) |
let max_i ( ) = Alcotest . ( check bool ) " max_i " true ( To_test . max_i ( ) ) |
let map ( ) = Alcotest . ( check bool ) " map " true ( To_test . map ( ) ) |
let fold ( ) = Alcotest . ( check bool ) " fold " true ( To_test . fold ( ) ) |
let foldi ( ) = Alcotest . ( check bool ) " foldi " true ( To_test . foldi ( ) ) |
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 save_load ( ) = Alcotest . ( check bool ) " save_load " true ( To_test . save_load ( ) ) |
let swap_rows ( ) = Alcotest . ( check bool ) " swap_rows " true ( To_test . swap_rows ( ) ) |
let swap_cols ( ) = Alcotest . ( check bool ) " swap_cols " true ( To_test . swap_cols ( ) ) |
let transpose ( ) = Alcotest . ( check bool ) " transpose " true ( To_test . transpose ( ) ) |
let ctranspose ( ) = Alcotest . ( check bool ) " ctranspose " true ( To_test . ctranspose ( ) ) |
let concat_01 ( ) = Alcotest . ( check bool ) " concat_01 " true ( To_test . concat_01 ( ) ) |
let concat_02 ( ) = Alcotest . ( check bool ) " concat_02 " true ( To_test . concat_02 ( ) ) |
let concat_03 ( ) = Alcotest . ( check bool ) " concat_03 " true ( To_test . concat_03 ( ) ) |
let test_set = [ " sequential " , ` Slow , sequential ; " row_num " , ` Slow , row_num ; " col_num " , ` Slow , col_num ; " numel " , ` Slow , numel ; " get " , ` Slow , get ; " set " , ` Slow , set ; " row0 " , ` Slow , row0 ; " r... |
let approx_equal a b = Stdlib . ( abs_float ( a . - b ) < eps ) |
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 . |
let vec = M . zeros Complex32 [ | 2 ; 1 ] | |
let _ = M . set vec [ | 0 ; 0 ] | { Complex . re = 0 . 0 ; im = 3 . 0 } ; M . set vec [ | 1 ; 0 ] | { Complex . re = 0 . 0 ; im = - 4 . 0 } |
let x3 = M . sequential Float64 ~ a : 1 . [ | 6 ] | |
let x4 = M . ones Float64 [ | 2 ; 3 ; 4 ] | |
let x5 = M . of_arrays Float64 [ | [ | 2 . ; - 1 . ; 3 . 5 ] ; | [ | 0 . 4 ; 0 . 6 ; 0 . 2 ] | ] | |
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 get_slice ( ) = Alcotest . ( check bool ) " get_slice " true ( To_test . get_slice ( ) ) |
let copy ( ) = Alcotest . ( check bool ) " copy " true ( To_test . copy ( ) ) |
let fill ( ) = Alcotest . ( check bool ) " fill " true ( To_test . fill ( ) ) |
let map ( ) = Alcotest . ( check bool ) " map " true ( To_test . map ( ) ) |
let fold ( ) = Alcotest . ( check bool ) " fold " true ( To_test . fold ( ) ) |
let add ( ) = Alcotest . ( check bool ) " add " true ( To_test . add ( ) ) |
let mul ( ) = Alcotest . ( check bool ) " mul " true ( To_test . mul ( ) ) |
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 abs ( ) = Alcotest . ( check bool ) " abs " true ( To_test . abs ( ) ) |
let neg ( ) = Alcotest . ( check bool ) " neg " true ( To_test . neg ( ) ) |
let sum ' ( ) = Alcotest . ( check bool ) " sum ' " true ( To_test . sum ' ( ) ) |
let median ' ( ) = Alcotest . ( check bool ) " median ' " true ( To_test . median ' ( ) ) |
let median ( ) = Alcotest . ( check bool ) " median " true ( To_test . median ( ) ) |
let sort1 ( ) = Alcotest . ( check bool ) " sort1 " true ( To_test . sort1 ( ) ) |
let sum_reduce ( ) = Alcotest . ( check bool ) " sum_reduce " true ( To_test . sum_reduce ( ) ) |
let min ' ( ) = Alcotest . ( check bool ) " min ' " true ( To_test . min ' ( ) ) |
let max ' ( ) = Alcotest . ( check bool ) " max ' " true ( To_test . max ' ( ) ) |
let minmax_i ( ) = Alcotest . ( check bool ) " minmax_i " true ( To_test . minmax_i ( ) ) |
let init_nd ( ) = Alcotest . ( check bool ) " init_nd " true ( To_test . init_nd ( ) ) |
let is_zero ( ) = Alcotest . ( check bool ) " is_zero " false ( To_test . is_zero ( ) ) |
let is_positive ( ) = Alcotest . ( check bool ) " is_positive " false ( To_test . is_positive ( ) ) |
let is_negative ( ) = Alcotest . ( check bool ) " is_negative " false ( To_test . is_negative ( ) ) |
let is_nonnegative ( ) = Alcotest . ( check bool ) " is_nonnegative " true ( To_test . is_nonnegative ( ) ) |
let equal ( ) = Alcotest . ( check bool ) " equal " false ( To_test . equal ( ) ) |
let greater ( ) = Alcotest . ( check bool ) " greater " false ( To_test . greater ( ) ) |
let greater_equal ( ) = Alcotest . ( check bool ) " greater_equal " true ( To_test . greater_equal ( ) ) |
let exists ( ) = Alcotest . ( check bool ) " exists " true ( To_test . exists ( ) ) |
let not_exists ( ) = Alcotest . ( check bool ) " not_exists " true ( To_test . not_exists ( ) ) |
let for_all ( ) = Alcotest . ( check bool ) " for_all " true ( To_test . for_all ( ) ) |
let transpose ( ) = Alcotest . ( check bool ) " transpose " true ( To_test . transpose ( ) ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.