10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-13 01:23:41 +01:00
QCaml/Utils/Util.mli
2018-02-24 23:57:38 +01:00

68 lines
1.9 KiB
OCaml

(** All utilities which should be included in all source files are defined here *)
(** {1 Functions from libm} *)
external erf_float : float -> float = "erf_float_bytecode" "erf_float"
[@@unboxed] [@@noalloc]
(** Error function [erf] from [libm] *)
external erfc_float : float -> float = "erfc_float_bytecode" "erfc_float"
[@@unboxed] [@@noalloc]
(** Complementary error function [erfc] from [libm] *)
external gamma_float : float -> float = "gamma_float_bytecode" "gamma_float"
[@@unboxed] [@@noalloc]
(** Gamma function [gamma] from [libm] *)
(** {1 General functions} *)
val fact : int -> float
(** Factorial function.
@raise Invalid_argument for negative arguments or arguments >100.
*)
val pow : float -> int -> float
(** Fast implementation of the power function for small integer powers *)
val chop : float -> (unit -> float) -> float
(** In [chop a f], evaluate [f] only if the absolute value of [a] is larger
than {!Constants.epsilon}, and return [a *. f ()].
*)
(** {1 Functions related to the Boys function} *)
val incomplete_gamma : alpha:float -> float -> float
(** {{:https://en.wikipedia.org/wiki/Incomplete_gamma_function}
Lower incomplete gamma function}
@raise Failure when the calculation doesn't converge.
*)
val boys_function : maxm:int -> float -> float array
(** {{:https://link.springer.com/article/10.1007/s10910-005-9023-3}
Generalized Boys function}.
@param maxm Maximum total angular momentum.
*)
(** {1 Extension of the Array module} *)
val array_sum : float array -> float
(** Returns the sum of all the elements of the array *)
val array_product : float array -> float
(** Returns the product of all the elements of the array *)
(** {1 Linear algebra } *)
val diagonalize_symm : Lacaml.D.mat -> Lacaml.D.mat * Lacaml.D.vec
(** Diagonalize a symmetric matrix. Returns the eigenvectors and the eigenvalues. *)
val xt_o_x : o:Lacaml.D.mat -> x:Lacaml.D.mat -> Lacaml.D.mat
(** Computes X{^T}.O.X *)