text stringlengths 12 786k |
|---|
let absolute_pos v p = tfo_apply v . t p |
let atom_pos atom v = absolute_pos v ( atom v . n ) |
let rec get_var id = function | ( v :: lst ) -> if id = v . id then v else get_var id lst | _ -> assert false |
let rec search ( partial_inst : variable list ) l constr = match l with [ ] -> [ partial_inst ] | ( h :: t ) -> let rec try_assignments = function [ ] -> [ ] | v :: vs -> if constr v partial_inst then ( search ( v :: partial_inst ) t constr ) @ ( try_assignments vs ) els... |
let wc_tfo = ( { a = - 1 . 0000 ; b = 0 . 0028 ; c = - 0 . 0019 ; d = 0 . 0028 ; e = 0 . 3468 ; f = - 0 . 9379 ; g = - 0 . 0019 ; h = - 0 . 9379 ; i = - 0 . 3468 ; tx = - 0 . 0080 ; ty = 6 . 0730 ; tz = 8 . 7208 } ) let =... |
let wc_dumas_tfo = ( { a = - 0 . 9737 ; b = - 0 . 1834 ; c = 0 . 1352 ; d = - 0 . 1779 ; e = 0 . 2417 ; f = - 0 . 9539 ; g = 0 . 1422 ; h = - 0 . 9529 ; i = - 0 . 2679 ; tx = 0 . 4837 ; ty = 6 . 2649 ; tz = 8 . 0285 } ) let... |
let helix5 ' _tfo = ( { a = 0 . 9886 ; b = - 0 . 0961 ; c = 0 . 1156 ; d = 0 . 1424 ; e = 0 . 8452 ; f = - 0 . 5152 ; g = - 0 . 0482 ; h = 0 . 5258 ; i = 0 . 8492 ; tx = - 3 . 8737 ; ty = 0 . 5480 ; tz = 3 . 8024 } ) let ... |
let helix3 ' _tfo = ( { a = 0 . 9886 ; b = 0 . 1424 ; c = - 0 . 0482 ; d = - 0 . 0961 ; e = 0 . 8452 ; f = 0 . 5258 ; g = 0 . 1156 ; h = - 0 . 5152 ; i = 0 . 8492 ; tx = 3 . 4426 ; ty = 2 . 0474 ; tz = - 3 . 7042 } ) let ... |
let g37_a38_tfo = ( { a = 0 . 9991 ; b = 0 . 0164 ; c = - 0 . 0387 ; d = - 0 . 0375 ; e = 0 . 7616 ; f = - 0 . 6470 ; g = 0 . 0189 ; h = 0 . 6478 ; i = 0 . 7615 ; tx = - 3 . 3018 ; ty = 0 . 9975 ; tz = 2 . 5585 } ) let = mk_... |
let a38_g37_tfo = ( { a = 0 . 9991 ; b = - 0 . 0375 ; c = 0 . 0189 ; d = 0 . 0164 ; e = 0 . 7616 ; f = 0 . 6478 ; g = - 0 . 0387 ; h = - 0 . 6470 ; i = 0 . 7615 ; tx = 3 . 3819 ; ty = 0 . 7718 ; tz = - 2 . 5321 } ) let = mk_... |
let = ( a38_g37 nucl i j partial_inst ) :: ( helix3 ' nucl i j partial_inst ) let = let refnuc = get_var j partial_inst in let align = tfo_inv_ortho ( tfo_align ( atom_pos nuc_O3 ' refnuc ) ( atom_pos nuc_C3 ' refnuc ) ( atom_pos nuc_C4 ' refnuc ) ) in let rec generate domains = fu... |
let list_of_atoms = function ( N ( dgf_base_tfo , p_o3 ' _275_tfo , p_o3 ' _180_tfo , p_o3 ' _60_tfo , p , o1p , o2p , o5 ' , c5 ' , h5 ' , h5 ' ' , c4 ' , h4 ' , o4 ' , c1 ' , h1 ' , c2 ' , h2 ' ' , o2 ' , h2 ' , c3 ' , h3 ' , ... |
let maximum = function | x :: xs -> let rec iter m = function [ ] -> m | ( a :: b ) -> iter ( if a > m then a else m ) b in iter x xs | _ -> assert false let let atoms = list_of_atoms v . n in let max_dist = ref 0 . 0 in for i = 0 to pred ( Array . length atoms ) do let p = ato... |
let main ( ) = for i = 1 to 50 do ignore ( run ( ) ) done ; Printf . printf " . % 4f " ( run ( ) ) ; print_newline ( ) |
let _ = main ( ) |
type num = Int of int | Big_int of big_int | Ratio of ratio |
let biggest_INT = big_int_of_int biggest_int |
let num_of_big_int bi = if le_big_int bi biggest_INT && ge_big_int bi least_INT then Int ( int_of_big_int bi ) else Big_int bi |
let numerator_num = function Ratio r -> ignore ( normalize_ratio r ) ; num_of_big_int ( numerator_ratio r ) |
let denominator_num = function Ratio r -> ignore ( normalize_ratio r ) ; num_of_big_int ( denominator_ratio r ) |
let normalize_num = function Int i -> Int i then num_of_big_int ( numerator_ratio r ) else Ratio r |
let cautious_normalize_num_when_printing n = if ( ! normalize_ratio_when_printing_flag ) then ( normalize_num n ) else n |
let num_of_ratio r = ignore ( normalize_ratio r ) ; if not ( is_integer_ratio r ) then Ratio r else if is_int_big_int ( numerator_ratio r ) then Int ( int_of_big_int ( numerator_ratio r ) ) else Big_int ( numerator_ratio r ) |
let add_num a b = match ( a , b ) with ( ( Int int1 ) , ( Int int2 ) ) -> let r = int1 + int2 in if ( int1 lxor int2 ) lor ( int1 lxor ( r lxor ( - 1 ) ) ) < 0 then Int r else Big_int ( add_big_int ( big_int_of_int int1 ) ( big_int_of_int int2 ) ) | ( ( Int i... |
let ( +/ ) = add_num |
let minus_num = function Int i -> if i = monster_int then Big_int ( minus_big_int ( big_int_of_int i ) ) else Int ( - i ) |
let sub_num n1 n2 = add_num n1 ( minus_num n2 ) |
let ( -/ ) = sub_num |
let mult_num a b = match ( a , b ) with ( ( Int int1 ) , ( Int int2 ) ) -> if num_bits_int int1 + num_bits_int int2 < length_of_int then Int ( int1 * int2 ) else num_of_big_int ( mult_big_int ( big_int_of_int int1 ) ( big_int_of_int int2 ) ) | ( ( Int i ) , ( Big_int ... |
let ( */ ) = mult_num |
let square_num = function Int i -> if 2 * num_bits_int i < length_of_int then Int ( i * i ) else num_of_big_int ( square_big_int ( big_int_of_int i ) ) | Big_int bi -> Big_int ( square_big_int bi ) | Ratio r -> Ratio ( square_ratio r ) |
let div_num n1 n2 = match n1 with | Int i1 -> begin match n2 with | Int i2 -> num_of_ratio ( create_ratio ( big_int_of_int i1 ) ( big_int_of_int i2 ) ) | Big_int bi2 -> num_of_ratio ( create_ratio ( big_int_of_int i1 ) bi2 ) | Ratio r2 -> num_of_ratio ( div_int_ratio i1 r2 ) end | Big_... |
let ( // ) = div_num |
let floor_num = function Int i as n -> n |
let quo_num n1 n2 = match n1 with | Int i1 -> begin match n2 with | Int i2 -> Int ( i1 / i2 ) | Big_int bi2 -> num_of_big_int ( div_big_int ( big_int_of_int i1 ) bi2 ) | Ratio r2 -> num_of_big_int ( floor_ratio ( div_int_ratio i1 r2 ) ) end | Big_int bi1 -> begin match n2 with | Int i2 ... |
let mod_num n1 n2 = match n1 with | Int i1 -> begin match n2 with | Int i2 -> Int ( i1 mod i2 ) | Big_int bi2 -> num_of_big_int ( mod_big_int ( big_int_of_int i1 ) bi2 ) | Ratio _r2 -> sub_num n1 ( mult_num n2 ( quo_num n1 n2 ) ) end | Big_int bi1 -> begin match n2 with | Int i2 -> num... |
let power_num_int a b = match ( a , b ) with ( ( Int i ) , n ) -> ( match sign_int n with 0 -> Int 1 | 1 -> num_of_big_int ( power_int_positive_int i n ) | _ -> Ratio ( create_normalized_ratio unit_big_int ( power_int_positive_int i ( - n ) ) ) ) ( match sign_int n with... |
let power_num_big_int a b = match ( a , b ) with ( ( Int i ) , n ) -> ( match sign_big_int n with 0 -> Int 1 | 1 -> num_of_big_int ( power_int_positive_big_int i n ) | _ -> Ratio ( create_normalized_ratio unit_big_int ( power_int_positive_big_int i ( minus_big_int n ) ) ) ) ... |
let power_num a b = match ( a , b ) with ( n , ( Int i ) ) -> power_num_int n i |
let ( **/ ) = power_num |
let is_integer_num = function Int _ -> true |
let integer_num = function Int i as n -> n Int i as n -> n Int i as n -> n |
let sign_num = function Int i -> sign_int i |
let eq_num a b = match ( a , b ) with ( ( Int int1 ) , ( Int int2 ) ) -> int1 = int2 |
let ( =/ ) = eq_num |
let ( <>/ ) a b = not ( eq_num a b ) |
let compare_num a b = match ( a , b ) with ( ( Int int1 ) , ( Int int2 ) ) -> compare_int int1 int2 |
let lt_num num1 num2 = compare_num num1 num2 < 0 |
let ( </ ) = lt_num |
let max_num num1 num2 = if lt_num num1 num2 then num2 else num1 |
let int_of_num = function Int i -> i if i = monster_int then Big_int ( big_int_of_int i ) else Int i |
let nat_of_num = function Int i -> nat_of_int i if ( is_nat_int nat 0 ( length_nat nat ) ) then Int ( nth_digit_nat nat 0 ) else Big_int ( big_int_of_nat nat ) |
let big_int_of_num = function Int i -> big_int_of_int i |
let ratio_of_num = function Int i -> ratio_of_int i ; ; |
let string_of_big_int_for_num bi = if ! approx_printing_flag then approx_big_int ! floating_precision bi else string_of_big_int bi |
let string_of_normalized_num = function Int i -> string_of_int i |
let string_of_num n = string_of_normalized_num ( cautious_normalize_num_when_printing n ) |
let num_of_string s = try let flag = ! normalize_ratio_flag in normalize_ratio_flag := true ; let r = ratio_of_string s in normalize_ratio_flag := flag ; if eq_big_int ( denominator_ratio r ) unit_big_int then num_of_big_int ( numerator_ratio r ) else Ratio r with Failure _ -> failwith " num_of_st... |
let float_of_num = function Int i -> float i |
let succ_num = function Int i -> if i = biggest_int then Big_int ( succ_big_int ( big_int_of_int i ) ) else Int ( succ i ) Int i -> if i = monster_int then Big_int ( pred_big_int ( big_int_of_int i ) ) else Int ( pred i ) |
let abs_num = function Int i -> if i = monster_int then Big_int ( minus_big_int ( big_int_of_int i ) ) else Int ( abs i ) | Big_int bi -> Big_int ( abs_big_int bi ) | Ratio r -> Ratio ( abs_ratio r ) |
let approx_num_fix n num = approx_ratio_fix n ( ratio_of_num num ) |
let incr_num r = r := succ_num ! r |
module type Num_common = sig include Container_types . S module Pair : sig type nonrec t = t * t include Container_types . S with type t := t end val cross_product : Set . t -> Set . t -> Pair . Set . t val zero : t val one : t val minus_one : t val add : t -> t -> t val sub : t -> t -> t v... |
module type Number_kind_common = sig module Num : Container_types . S val standard_int_or_float_kind : K . Standard_int_or_float . t val unboxed_prover : Flambda2_types . Typing_env . t -> Flambda2_types . t -> Num . Set . t Flambda2_types . proof val this_unboxed : Num . t -> Flambda2_types... |
module type Number_kind = sig module Num : Num_common include Number_kind_common with module Num := Num end |
module type Int_number_kind = sig module Num : sig include Num_common val and_ : t -> t -> t val or_ : t -> t -> t val xor : t -> t -> t val shift_left : t -> Targetint_31_63 . t -> t val shift_right : t -> Targetint_31_63 . t -> t val shift_right_logical : t -> Targetint_31_63 . t -> t val sw... |
module type Boxable = sig module Num : Container_types . S val boxable_number_kind : K . Boxable_number . t val boxed_prover : Flambda2_types . Typing_env . t -> Flambda2_types . t -> Num . Set . t Flambda2_types . proof val this_boxed : Num . t -> Alloc_mode . t Or_unknown . t -> Flamb... |
module type Boxable_number_kind = sig include Number_kind include Boxable with module Num := Num end |
module type Boxable_int_number_kind = sig include Int_number_kind include Boxable with module Num := Num end |
let with_shift shift if_undefined f = match Targetint_31_63 . Imm . to_int_option ( Targetint_31_63 . to_targetint shift ) with | None -> if_undefined | Some shift -> f shift |
module For_tagged_immediates : Int_number_kind = struct module Num = struct include Targetint_31_63 let strictly_negative t = compare t zero < 0 let compare_unsigned t1 t2 = match strictly_negative t1 , strictly_negative t2 with | true , true -> compare t2 t1 | true , false -> 1 | false , true -> ... |
module For_naked_immediates : Int_number_kind = struct module Num = struct include Targetint_31_63 let strictly_negative t = compare t zero < 0 let compare_unsigned t1 t2 = match strictly_negative t1 , strictly_negative t2 with | true , true -> compare t2 t1 | true , false -> 1 | false , true -> ... |
module For_floats : Boxable_number_kind = struct module Num = struct include Float_by_bit_pattern let add = IEEE_semantics . add let sub = IEEE_semantics . sub let mul = IEEE_semantics . mul let div t1 t2 = Some ( IEEE_semantics . div t1 t2 ) let mod_ t1 t2 = Some ( IEEE_semantics . mod_ t1 t2 )... |
module For_int32s : Boxable_int_number_kind = struct module Num = struct include Int32 let strictly_negative t = compare t zero < 0 let compare_unsigned t1 t2 = match strictly_negative t1 , strictly_negative t2 with | true , true -> compare t2 t1 | true , false -> 1 | false , true -> - 1 | fals... |
module For_int64s : Boxable_int_number_kind = struct module Num = struct include Int64 let strictly_negative t = compare t zero < 0 let compare_unsigned t1 t2 = match strictly_negative t1 , strictly_negative t2 with | true , true -> compare t2 t1 | true , false -> 1 | false , true -> - 1 | fals... |
module For_nativeints : Boxable_int_number_kind = struct module Num = struct include Targetint_32_64 let compare_unsigned _t1 _t2 = Misc . fatal_error " Not yet implemented ( waiting on upstream stdlib change ) " let xor = logxor let or_ = logor let and_ = logand let div t1 t2 = if equal t2 zero the... |
module Int_base = Container_types . Make ( struct type t = int let compare = Int . compare let output oc x = Printf . fprintf oc " % i " x let hash i = i let equal ( i : int ) j = i = j let [ @ ocamlformat " disable " ] print = Format . pp_print_int end ) |
module Int = struct type t = int include Int_base let rec zero_to_n n = if n < 0 then Set . empty else Set . add n ( zero_to_n ( n - 1 ) ) let to_string n = Int . to_string n end |
module Int8 = struct type t = int let zero = 0 let one = 1 let of_int_exn i = if i < ( - 1 lsl 7 ) || i > ( 1 lsl 7 ) - 1 then Misc . fatal_errorf " Int8 . of_int_exn : % d is out of range " i else i let to_int i = i end |
module Int16 = struct type t = int let of_int_exn i = if i < ( - 1 lsl 15 ) || i > ( 1 lsl 15 ) - 1 then Misc . fatal_errorf " Int16 . of_int_exn : % d is out of range " i else i let lower_int64 = Int64 . neg ( Int64 . shift_left Int64 . one 15 ) let upper_int64 = Int64 . s... |
module Float = struct type t = float include Container_types . Make ( struct type t = float let compare x y = Stdlib . compare x y let output oc x = Printf . fprintf oc " % f " x let hash f = Hashtbl . hash f let equal ( i : float ) j = i = j let [ @ ocamlformat " disable " ] print ... |
module Float_by_bit_pattern = struct let create f = Int64 . bits_of_float f let of_bits bits = bits let of_string str = create ( float_of_string str ) let to_float t = Int64 . float_of_bits t let zero = create 0 . let one = create 1 . let minus_one = create ( - 1 . ) module T0 = struct ty... |
module Int32 = struct include Int32 external swap_byte_endianness : t -> t = " % bswap_int32 " module T0 = struct type t = Int32 . t let compare x y = Int32 . compare x y let equal t1 t2 = compare t1 t2 = 0 let hash f = Hashtbl . hash f let [ @ ocamlformat " disable " ] print ppf t = For... |
module Int64 = struct include Int64 external swap_byte_endianness : t -> t = " % bswap_int64 " module T0 = struct type t = Int64 . t let compare x y = Int64 . compare x y let equal t1 t2 = compare t1 t2 = 0 let hash f = Hashtbl . hash f let [ @ ocamlformat " disable " ] print ppf t = For... |
let [ @ inline always ] is_block a = not ( is_int a ) |
let [ @ inline always ] size t = size ( Sys . opaque_identity t ) |
let [ @ inline always ] field t index = field ( Sys . opaque_identity t ) index |
let [ @ inline always ] set_field t index new_value = set_field ( Sys . opaque_identity t ) index new_value floatarray -> int -> float -> unit = " caml_floatarray_set " |
let [ @ inline always ] double_field x i = floatarray_get ( obj x : floatarray ) i |
let [ @ inline always ] set_double_field x i v = floatarray_set ( obj x : floatarray ) i v = " caml_obj_set_raw_field " |
let marshal ( obj : t ) = Marshal . to_bytes obj [ ] |
let unmarshal str pos = ( Marshal . from_bytes str pos , pos + Marshal . total_size str pos ) |
module Closure = struct type info = { arity : int ; start_env : int ; } let info_of_raw ( info : nativeint ) = let open Nativeint in let arity = if Sys . word_size = 64 then to_int ( shift_right info 56 ) else to_int ( shift_right info 24 ) in let start_env = to_int ( shift_right_log... |
module Extension_constructor = struct type t = extension_constructor let of_val x = let x = repr x in let slot = if ( is_block x ) && ( tag x ) <> object_tag && ( size x ) >= 1 then field x 0 else x in let name = if ( is_block slot ) && ( tag slot ) = object_tag then field slot 0 else... |
module Ephemeron = struct type obj_t = t type t let additional_values = 2 let max_ephe_length = Sys . max_array_length - additional_values external create : int -> t = " caml_ephe_create " ; ; let create l = if not ( 0 <= l && l <= max_ephe_length ) then invalid_arg " Obj . Ephemeron . ... |
let input_stringlist ic len = let get_string_list sect len = let rec fold s e acc = if e != len then if sect . [ e ] = ' \ 000 ' then fold ( e + 1 ) ( e + 1 ) ( String . sub sect s ( e - s ) :: acc ) else fold s ( e + 1 ) acc else acc in fold 0 0 [ ] in let sect = S... |
let print_name_crc ( name , crc ) = printf " \ t % s \ t % s \ n " ( Digest . to_hex crc ) name |
let print_line name = printf " \ t % s \ n " name |
let print_cmo_infos cu = printf " Unit name : % s \ n " cu . cu_name ; print_string " Interfaces imported :\ n " ; List . iter print_name_crc cu . cu_imports ; printf " Uses unsafe features : " ; match cu . cu_primitives with | [ ] -> printf " no \ n " | l -> printf " YE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.