Markus Mottl avatar Markus Mottl committed 1acf747

Major API changes (Mat.copy -> lacpy; geev)

Comments (0)

Files changed (25)

+2009-04-25:  Major API changes:
+
+             Removed function:
+
+               * Mat.copy (use lacpy instead)
+
+             Modified function:
+
+               * geev (differently named arguments)
+
+             Added functions:
+
+               * lacpy (also copies triangular matrices)
+               * larnv (random number generation)
+
 2009-04-23:  Improved numerical stability of Vec.ssqr for real numbers
              and zero mean.
 

examples/blas/blas.ml

 (* File: blas.ml
 
-   Copyright (C) 2004-2005
+   Copyright (C) 2004-
 
      Markus Mottl
      email: markus.mottl@gmail.com

examples/eig/eig.ml

 (* File: eig.ml
 
-   Copyright (C) 2004-2005
+   Copyright (C) 2004-
 
      Markus Mottl
      email: markus.mottl@gmail.com
   let n = 5 in
 
   let a = Mat.random ~from:(-500.) ~range:1000. n n in
-  let a_copy = Mat.copy a in
+  let a_copy = lacpy a in
 
   printf "@[<2>Symmetric real matrix A =@\n@\n@[%a@]@]@\n@\n" pp_fmat a;
 
   (* All unperturbed eigenvalues are zero *)
   a.{n, 1} <- 1e-5; (* perturbation, try this: n >> 1 *)
 
-  let a_copy = Mat.copy a in
+  let a_copy = lacpy a in
 
   printf "@[<2>General real matrix A =@\n@\n@[%a@]@]@\n@\n" pp_fmat a;
 
-  let _, wr, wi, right = geev ~left:None a_copy in
+  let _, wr, wi, right = geev ~vl:None a_copy in
 
   printf "@[<2>Eigenvalues: WR =@\n@\n@[%a@]@]@\n@\n" pp_rfvec wr;
   printf "@[<2>Eigenvalues: WI =@\n@\n@[%a@]@]@\n@\n" pp_rfvec wi;
       ~re_from:(-500.) ~re_range:1000.
       ~im_from:(-500.) ~im_range:1000.
       n n in
-  let a_copy = Mat.copy a in
+  let a_copy = lacpy a in
 
   printf "@[<2>General complex matrix A =@\n@\n@[%a@]@]@\n@\n" pp_cmat a;
 

examples/lin_eq/lin_eq.ml

 (* File: lin_eq.ml
 
-   Copyright (C) 2004-2005
+   Copyright (C) 2004-
 
      Markus Mottl
      email: markus.mottl@gmail.com
   printf "@[<2>General matrix A =@\n@\n@[%a@]@]@\n@\n" pp_fmat a;
   printf "@[<2>Right hand side:@\n@\n@[%a@]@]@\n@\n" pp_rfvec (Mat.col b 1);
 
-  let a_copy = Mat.copy a in
-  let b_copy = Mat.copy b in
+  let a_copy = lacpy a in
+  let b_copy = lacpy b in
   gesv a_copy b_copy;
 
   let sol = Mat.col b_copy 1 in

examples/lin_eq_comp/lin_eq_comp.ml

 (* File: lin_eq_comp.ml
 
-   Copyright (C) 2004-2005
+   Copyright (C) 2004-
 
      Markus Mottl
      email: markus.mottl@gmail.com
 
   printf "@[<2>General matrix A = @[%a@]@]@\n@\n" pp_fmat a;
 
-  let lu = Mat.copy a in
+  let lu = lacpy a in
   let ipiv = getrf lu in
   printf "lu(A) = @[%a@]@\n@\n" pp_fmat lu;
 
   printf "ipiv = @[%a@]@\n@\n" pp_rivec ipiv;
 
-  let inv = Mat.copy lu in
+  let inv = lacpy lu in
   let _ipiv = getri inv in
   printf "inv(A) = @[%a@]@\n@\n" pp_fmat inv;
   let aainv = gemm a inv in
 
   printf "@[<2>Symmetric matrix B = @[%a@]@]@\n@\n" pp_fmat b;
 
-  let chol = Mat.copy b in
+  let chol = lacpy b in
   potrf chol;
   printf "chol(B) = @[%a@]@\n@\n" pp_fmat chol;
 
-  let inv = Mat.copy chol in
+  let inv = lacpy chol in
   potri ~factorize:false inv;
   printf "inv(B) = @[%a@]@\n@\n" pp_fmat inv;
 
 name="lacaml"
-version="4.7.8"
+version="5.0.0"
 description="LACAML - BLAS/LAPACK-interface for OCaml"
 
 requires="lacaml.core"
 	utils_c.c \
 	vec2_S_c.c vec2_D_c.c \
 	vec2_C_c.c vec2_Z_c.c \
-	mat2_S_c.c mat2_D_c.c \
-	mat2_C_c.c mat2_Z_c.c \
 	mat4_S_c.c mat4_D_c.c \
 	mat4_C_c.c mat4_Z_c.c \
 	impl4_S_c.c impl4_D_c.c \
   vec2_D_c
   vec2_C_c
   vec2_Z_c
-  mat2_S_c
-  mat2_D_c
-  mat2_C_c
-  mat2_Z_c
   mat4_S_c
   mat4_D_c
   mat4_C_c
 (* NRM2 *)
 
 external direct_nrm2 :
-  int -> (* N *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec    (* X *)
-  -> float = "lacaml_CPRECnrm2_stub"
+  n : int ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  float = "lacaml_CPRECnrm2_stub"
 
 let nrm2 ?n ?ofsx ?incx x =
   let loc = "Lacaml.Impl.CPREC.nrm2" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  direct_nrm2 n ofsx incx x
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  direct_nrm2 ~n ~ofsx ~incx ~x
 
 
 (* Auxiliary routines *)
 
 external direct_lansy :
-  char -> (* NORM *)
-  char -> (* UPLO *)
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  rvec (* WORK *)
-  -> float = "lacaml_CPREClansy_stub_bc" "lacaml_CPREClansy_stub"
+  norm : char ->
+  uplo : char ->
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  work : rvec ->
+  float = "lacaml_CPREClansy_stub_bc" "lacaml_CPREClansy_stub"
 
 let lansy_min_lwork n = function `I -> n | _ -> 0
 
 let lansy ?n ?(up = true) ?(norm = `O) ?work ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.CPREC.lansy" in
   let n = get_n_of_a loc ar ac a n in
-  let norm_char = get_norm_char norm in
-  let uplo_char = get_uplo_char up in
+  let uplo = get_uplo_char up in
   let min_work = lansy_min_lwork n norm in
   let work, _lwork = get_work loc RVec.create work min_work min_work "lwork" in
-  direct_lansy norm_char uplo_char n ar ac a work
+  let norm = get_norm_char norm in
+  direct_lansy ~norm ~uplo ~n ~ar ~ac ~a ~work
 
 
 (* Linear equations (computational routines) *)
 (* GECON *)
 
 external direct_gecon :
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  vec -> (* WORK *)
-  rvec -> (* RWORK *)
-  char -> (* NORM *)
-  float -> (* ANORM *)
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  work : vec ->
+  rwork : rvec ->
+  norm : char ->
+  anorm : float ->
   int * float = "lacaml_CPRECgecon_stub_bc" "lacaml_CPRECgecon_stub"
 
 let gecon_min_lwork n = 2 * n
 let gecon ?n ?(norm = `O) ?anorm ?work ?rwork ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.CPREC.gecon" in
   let n = get_n_of_a loc ar ac a n in
-  let norm_char = get_norm_char norm in
   let work, _lwork =
     get_work
       loc Vec.create work (gecon_min_lwork n) (gecon_min_lwork n) "lwork" in
   let anorm =
     match anorm with
     | None -> lange ~norm:(norm :> norm4) ~m:n ~n ~work:rwork a
-    | Some anorm -> anorm in
-  let info, rcond = direct_gecon n ar ac a work rwork norm_char anorm in
+    | Some anorm -> anorm
+  in
+  let norm = get_norm_char norm in
+  let info, rcond = direct_gecon ~n ~ar ~ac ~a ~work ~rwork ~norm ~anorm in
   if info = 0 then rcond
-  else gecon_err loc norm_char n a info
+  else gecon_err loc norm n a info
 
 (* SYCON *)
 
 external direct_sycon :
-  char -> (* UPLO *)
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int_vec -> (* IPIV *)
-  vec -> (* WORK *)
-  float -> (* ANORM *)
+  uplo : char ->
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  ipiv : int_vec ->
+  work : vec ->
+  anorm : float ->
   int * float = "lacaml_CPRECsycon_stub_bc" "lacaml_CPRECsycon_stub"
 
 let sycon_min_lwork n = 2 * n
 let sycon ?n ?(up = true) ?ipiv ?anorm ?work ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.CPREC.sycon" in
   let n = get_n_of_a loc ar ac a n in
-  let uplo_char = get_uplo_char up in
+  let uplo = get_uplo_char up in
   let work, _lwork =
     get_work
       loc Vec.create work (sycon_min_lwork n) (sycon_min_lwork n) "lwork" in
     match anorm with
     | None -> lange ~m:n ~n ~ar ~ac a
     | Some anorm -> anorm in
-  let info, rcond = direct_sycon uplo_char n ar ac a ipiv work anorm in
+  let info, rcond = direct_sycon ~uplo ~n ~ar ~ac ~a ~ipiv ~work ~anorm in
   if info = 0 then rcond
   else xxcon_err loc n a info
 
 (* POCON *)
 
 external direct_pocon :
-  char -> (* UPLO *)
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  vec -> (* WORK *)
-  rvec -> (* RWORK *)
-  float -> (* ANORM *)
+  uplo : char ->
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  work : vec ->
+  rwork : rvec ->
+  anorm : float ->
   int * float = "lacaml_CPRECpocon_stub_bc" "lacaml_CPRECpocon_stub"
 
 let pocon_min_lwork n = 3 * n
 let pocon ?n ?(up = true) ?anorm ?work ?rwork ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.CPREC.pocon" in
   let n = get_n_of_a loc ar ac a n in
-  let uplo_char = get_uplo_char up in
+  let uplo = get_uplo_char up in
   let min_lwork, min_lrwork = pocon_min_lwork n, pocon_min_lrwork n in
   let work, _lwork =
     get_work loc Vec.create work min_lwork min_lwork "lwork" in
     match anorm with
     | None -> lange ~m:n ~n ~ar ~ac a
     | Some anorm -> anorm in
-  let info, rcond = direct_pocon uplo_char n ar ac a work rwork anorm in
+  let info, rcond = direct_pocon ~uplo ~n ~ar ~ac ~a ~work ~rwork ~anorm in
   if info = 0 then rcond
   else xxcon_err loc n a info
 
 (* GESVD *)
 
 external direct_gesvd :
-  char -> (* JOBU *)
-  char -> (* JOBVT *)
-  int -> (* M *)
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  rvec -> (* S *)
-  int -> (* UR *)
-  int -> (* UC *)
-  mat -> (* U *)
-  int -> (* VTC *)
-  int -> (* VTR *)
-  mat -> (* VT *)
-  vec -> (* WORK *)
-  int -> (* LWORK *)
-  rvec (* RWORK *)
-  -> int = "lacaml_CPRECgesvd_stub_bc" "lacaml_CPRECgesvd_stub"
+  jobu : char ->
+  jobvt : char ->
+  m : int ->
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  s : rvec ->
+  ur : int ->
+  uc : int ->
+  u : mat ->
+  vtc : int ->
+  vtr : int ->
+  vt : mat ->
+  work : vec ->
+  lwork : int ->
+  rwork : rvec ->
+  int = "lacaml_CPRECgesvd_stub_bc" "lacaml_CPRECgesvd_stub"
 
 let gesvd_min_lwork ~m ~n =
   let min_m_n = min m n in
 
 let gesvd_get_opt_lwork loc jobu jobvt m n ar ac a s ur uc u vtr vtc vt =
   let lwork = -1 in
-  let dummy_work = Vec.create 1 in
+  let work = Vec.create 1 in
   let info =
     direct_gesvd
-      jobu jobvt m n ar ac a s ur uc u vtr vtc vt dummy_work lwork RVec.empty in
-  if info = 0 then int_of_floatxx dummy_work.{1}.re
+      ~jobu ~jobvt ~m ~n ~ar ~ac ~a ~s ~ur ~uc ~u ~vtr ~vtc ~vt
+      ~work ~lwork ~rwork:RVec.empty
+  in
+  if info = 0 then int_of_floatxx work.{1}.re
   else gesvd_err loc jobu jobvt m n a u vt lwork info
 
 let gesvd_opt_lwork
             (sprintf "%s: lrwork: valid=[%d..[ got=%d" loc min_lrwork lrwork)
         else rwork in
   let info =
-    direct_gesvd jobu jobvt m n ar ac a s ur uc u vtc vtr vt work lwork rwork in
+    direct_gesvd
+      ~jobu ~jobvt ~m ~n ~ar ~ac ~a ~s ~ur ~uc ~u ~vtc ~vtr ~vt
+      ~work ~lwork ~rwork
+  in
   if info = 0 then s, u, vt
   else gesvd_err loc jobu jobvt m n a u vt lwork info
 
 (* GEEV *)
 
 external direct_geev :
-  int -> int -> mat -> (* AR, AC, A *)
-  int -> (* N *)
-  int -> vec -> (* OFSW, W *)
-  int -> int -> mat -> char -> (* VLR, VLC, VL, JOBVL *)
-  int -> int -> mat -> char -> (* VRR, VRC, VR, JOBVR *)
-  vec -> int -> (* WORK, LWORK *)
-  vec (* RWORK *)
-  -> int = "lacaml_CPRECgeev_stub_bc" "lacaml_CPRECgeev_stub"
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  n : int ->
+  ofsw : int -> w : vec ->
+  vlr : int ->
+  vlc : int ->
+  vl : mat ->
+  jobvl : char ->
+  vrr : int ->
+  vrc : int ->
+  vr : mat ->
+  jobvr : char ->
+  work : vec ->
+  lwork : int ->
+  rwork : vec ->
+  int = "lacaml_CPRECgeev_stub_bc" "lacaml_CPRECgeev_stub"
 
 let geev_min_lwork n = max 1 (n + n)
 let geev_min_lrwork n = n + n
 
-let geev_get_opt_lwork loc n leftr leftc vl jobvl rightr rightc vr jobvr
-    ofsw w ar ac a =
-  let dummy_work = Vec.create 1 in
+let geev_get_opt_lwork loc n vlr vlc vl jobvl vrr vrc vr jobvr ofsw w ar ac a =
+  let work = Vec.create 1 in
   let info =
-    direct_geev ar ac a n ofsw w leftr leftc vl jobvl rightr rightc vr jobvr
-      dummy_work (-1) Vec.empty in
-  if info = 0 then int_of_float dummy_work.{1}.re
-  else geev_err loc geev_min_lwork a n vl vr (-1) info
+    direct_geev ~ar ~ac ~a ~n ~ofsw ~w ~vlr ~vlc ~vl ~jobvl
+    ~vrr ~vrc ~vr ~jobvr ~work ~lwork:~-1 ~rwork:Vec.empty
+  in
+  if info = 0 then int_of_float work.{1}.re
+  else geev_err loc geev_min_lwork a n vl vr ~-1 info
 
-let geev_get_params loc ar ac a n leftr leftc left rightr rightc right ofsw w =
+let geev_get_params loc ar ac a n vlr vlc vl vrr vrc vr ofsw w =
   let n, _, _, _, _, _, _, _, _, _ as params =
     geev_gen_get_params
-      loc Mat.empty Mat.create ar ac a n leftr leftc left rightr rightc right in
-  params, xxev_get_wx Vec.create loc "w" ofsw w n
+      loc Mat.empty Mat.create ar ac a n vlr vlc vl vrr vrc vr in
+  params, xxev_get_wx Vec.create loc w_str ofsw w n
 
 let geev_opt_lwork
     ?n
-    ?(leftr = 1) ?(leftc = 1) ?left
-    ?(rightr = 1) ?(rightc = 1) ?right
+    ?(vlr = 1) ?(vlc = 1) ?vl
+    ?(vrr = 1) ?(vrc = 1) ?vr
     ?(ofsw = 1) ?w
     ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.CPREC.geev_opt_lwork" in
-  let (n, leftr, leftc, vl, jobvl, rightr, rightc, vr, jobvr, _), (ofsw, w) =
-    geev_get_params loc ar ac a n leftr leftc left rightr rightc right ofsw w in
-  geev_get_opt_lwork
-    loc n leftr leftc vl jobvl rightr rightc vr jobvr ofsw w ar ac a
+  let (n, vlr, vlc, vl, jobvl, vrr, vrc, vr, jobvr, _), (ofsw, w) =
+    geev_get_params loc ar ac a n vlr vlc vl vrr vrc vr ofsw w
+  in
+  geev_get_opt_lwork loc n vlr vlc vl jobvl vrr vrc vr jobvr ofsw w ar ac a
 
 let geev
     ?n ?work ?rwork
-    ?(leftr = 1) ?(leftc = 1) ?left
-    ?(rightr = 1) ?(rightc = 1) ?right
+    ?(vlr = 1) ?(vlc = 1) ?vl
+    ?(vrr = 1) ?(vrc = 1) ?vr
     ?(ofsw = 1) ?w
     ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.CPREC.geev" in
-  let (n, leftr, leftc, vl, jobvl, rightr, rightc, vr, jobvr, _), (ofsw, w) =
-    geev_get_params loc ar ac a n leftr leftc left rightr rightc right ofsw w in
+  let (n, vlr, vlc, vl, jobvl, vrr, vrc, vr, jobvr, _), (ofsw, w) =
+    geev_get_params loc ar ac a n vlr vlc vl vrr vrc vr ofsw w in
 
   let work, lwork =
     match work with
         else work, lwork
     | None ->
         let lwork =
-          geev_get_opt_lwork loc n leftr leftc vl jobvl rightr rightc vr jobvr
+          geev_get_opt_lwork loc n vlr vlc vl jobvl vrr vrc vr jobvr
             ofsw w ar ac a in
         Vec.create lwork, lwork in
 
         else rwork in
 
   let info =
-    direct_geev ar ac a n ofsw w leftr leftc vl jobvl rightr rightc vr jobvr
-      work lwork rwork in
+    direct_geev
+      ~ar ~ac ~a ~n ~ofsw ~w ~vlr ~vlc ~vl ~jobvl
+      ~vrr ~vrc ~vr ~jobvr ~work ~lwork ~rwork
+  in
 
   if info = 0 then vl, w, vr
   else geev_err loc geev_min_lwork a n vl vr lwork info
   ?work : rvec ->
   ?ar : int ->
   ?ac : int ->
-  mat
-  -> float
+  mat ->
+  float
 (** [lansy ?n ?up ?norm ?work ?ar ?ac a] see LAPACK documentation!
     @param norm default = `O
     @param up default = true (reference upper triangular part of [a])
   ?rwork : rvec ->
   ?ar : int ->
   ?ac : int ->
-  mat
-  -> float
+  mat ->
+  float
 (** [gecon ?n ?norm ?anorm ?work ?rwork ?ar ?ac a]
     @return estimate of the reciprocal of the condition number of matrix [a]
     @param n default = available number of columns of matrix [a]
     ?work : vec ->
     ?ar : int ->
     ?ac : int ->
-    mat
-    -> float
+    mat ->
+    float
 (** [sycon ?n ?up ?ipiv ?anorm ?work ?ar ?ac a]
     @return estimate of the reciprocal of the
             condition number of symmetric matrix [a]
     ?rwork : rvec ->
     ?ar : int ->
     ?ac : int ->
-    mat
-    -> float
+    mat ->
+    float
 (** [pocon ?n ?up ?anorm ?work ?rwork ?ar ?ac a]
     @return estimate of the reciprocal of the condition number of
             complex Hermitian positive definite matrix [a]
   ?s : rvec ->
   ?ur : int -> ?uc : int -> ?u : mat ->
   ?vtr : int -> ?vtc : int -> ?vt : mat ->
-  ?ar : int -> ?ac : int -> mat
-  -> int
+  ?ar : int -> ?ac : int -> mat ->
+  int
 
 val gesvd :
   ?m : int -> ?n : int ->
   ?vtr : int -> ?vtc : int -> ?vt : mat ->
   ?work : vec ->
   ?rwork : rvec ->
-  ?ar : int -> ?ac : int -> mat
-  -> rvec * mat * mat
+  ?ar : int -> ?ac : int -> mat ->
+  rvec * mat * mat
 
 
 (** General eigenvalue problem (simple drivers) *)
 
 val geev_opt_lwork :
   ?n : int ->
-  ?leftr : int -> ?leftc  : int -> ?left : mat option ->
-  ?rightr : int -> ?rightc : int -> ?right : mat option ->
+  ?vlr : int -> ?vlc  : int -> ?vl : mat option ->
+  ?vrr : int -> ?vrc : int -> ?vr : mat option ->
   ?ofsw : int -> ?w : vec ->
   ?ar : int -> ?ac : int -> mat ->
   int
- (** [geev ?work ?rwork ?n ?leftr ?leftc ?left
-       ?rightr ?rightc ?right ?ofsw w ?ar ?ac a]
+ (** [geev ?work ?rwork ?n ?vlr ?vlc ?vl
+       ?vrr ?vrc ?vr ?ofsw w ?ar ?ac a]
     See [geev]-function for details about arguments.
     @return "optimal" work size *)
 
   ?n : int ->
   ?work : vec ->
   ?rwork : vec ->
-  ?leftr : int -> ?leftc  : int -> ?left : mat option ->
-  ?rightr : int -> ?rightc : int -> ?right : mat option ->
+  ?vlr : int -> ?vlc  : int -> ?vl : mat option ->
+  ?vrr : int -> ?vrc : int -> ?vr : mat option ->
   ?ofsw : int -> ?w : vec ->
   ?ar : int -> ?ac : int -> mat ->
   mat * vec * mat
 (** [geev ?work ?rwork ?n
-      ?leftr ?leftc ?left
-      ?rightr ?rightc ?right
+      ?vlr ?vlc ?vl
+      ?vrr ?vrc ?vr
       ?ofsw w
       ?ar ?ac a]
     @return [(lv, w, rv)], where [lv] and [rv] correspond to the left and
       right eigenvectors respectively, [w] to the eigenvalues. [lv] ([rv])
-      is the empty matrix if [left] ([right]) is set to [None].
+      is the empty matrix if [vl] ([vr]) is set to [None].
     @raise Failure if the function fails to converge
     @param n default = available number of columns of matrix [a]
     @param work default = automatically allocated workspace
     @param rwork default = automatically allocated workspace
-    @param left default = Automatically allocated left eigenvectors.
-                          Pass [None] if you do not want to compute them,
-                          [Some lv] if you want to provide the storage.
-                          You can set [leftr], [leftc] in the last case.
+    @param vl default = Automatically allocated left eigenvectors.
+                        Pass [None] if you do not want to compute them,
+                        [Some lv] if you want to provide the storage.
+                        You can set [vlr], [vlc] in the last case.
     (See LAPACK GEEV docs for details about storage of complex eigenvectors)
-    @param right default = Automatically allocated right eigenvectors.
-                           Pass [None] if you do not want to compute them,
-                           [Some rv] if you want to provide the storage.
-                           You can set [rightr], [rightc] in the last case.
+    @param vr default = Automatically allocated right eigenvectors.
+                         Pass [None] if you do not want to compute them,
+                         [Some rv] if you want to provide the storage.
+                         You can set [vrr], [vrc] in the last case.
     @param w default = automatically allocate eigenvalues
     @param a the matrix whose eigensystem is computed *)
 (* DOT *)
 
 external direct_dot :
-  int -> (* N *)
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec    (* X *)
+  n : int ->
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  ofsx : int ->
+  incx : int ->
+  x : vec
   -> float = "lacaml_FPRECdot_stub_bc" "lacaml_FPRECdot_stub"
 
 let dot ?n ?ofsx ?incx ~x ?ofsy ?incy y =
   let loc = "Lacaml.Impl.FPREC.dot" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let ofsy, incy = get_vec_geom loc "y" ofsy incy in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  check_vec loc "y" y (ofsy + (n - 1) * abs incy);
-  direct_dot n ofsy incy y ofsx incx x
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let ofsy, incy = get_vec_geom loc y_str ofsy incy in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  check_vec loc y_str y (ofsy + (n - 1) * abs incy);
+  direct_dot ~n ~ofsy ~incy ~y ~ofsx ~incx ~x
 
 
 (* NRM2 *)
 
 external direct_nrm2 :
-  int -> (* N *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec    (* X *)
+  n : int ->
+  ofsx : int ->
+  incx : int ->
+  x : vec
   -> float = "lacaml_FPRECnrm2_stub"
 
 let nrm2 ?n ?ofsx ?incx x =
   let loc = "Lacaml.Impl.FPREC.nrm2" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  direct_nrm2 n ofsx incx x
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  direct_nrm2 ~n ~ofsx ~incx ~x
 
 
 (* ASUM *)
 
 external direct_asum :
-  int -> (* N *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec    (* X *)
+  n : int ->
+  ofsx : int ->
+  incx : int ->
+  x : vec
   -> float = "lacaml_FPRECasum_stub"
 
 let asum ?n ?ofsx ?incx x =
   let loc = "Lacaml.Impl.FPREC.asum" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  direct_asum n ofsx incx x
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  direct_asum ~n ~ofsx ~incx ~x
 
 
 
 (* SBMV *)
 
 external direct_sbmv :
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int -> (* N *)
-  int -> (* K *)
-  char -> (* UPLO *)
-  float -> (* ALPHA *)
-  float -> (* BETA *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  n : int ->
+  k : int ->
+  uplo : char ->
+  alpha : float ->
+  beta : float ->
+  ofsx : int ->
+  incx : int ->
+  x : vec
   -> unit = "lacaml_FPRECsbmv_stub_bc" "lacaml_FPRECsbmv_stub"
 
 let sbmv ?ofsy ?incy ?y ?(ar = 1) ?(ac = 1) a ?n ?k ?(up = true) ?(alpha = 1.0)
     ?(beta = 0.0) ?ofsx ?incx x =
   let loc = "Lacaml.Impl.FPREC.sbmv" in
   (* [a] is a band matrix of size [k+1]*[n]. *)
-  let n = get_dim2_mat loc "a" a ac "n" n in
-  let k = get_k_mat_sb loc "a" a ar "k" k in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let ofsy, incy = get_vec_geom loc "y" ofsy incy in
-  let y = get_vec loc "y" y ofsy incy n Vec.make0 in
-  check_vec loc "x" x (ofsx + (n - 1) * abs incx);
-  direct_sbmv ofsy incy y ar ac a n k (get_uplo_char up) alpha beta ofsx incx x;
+  let n = get_dim2_mat loc a_str a ac n_str n in
+  let k = get_k_mat_sb loc a_str a ar k_str k in
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let ofsy, incy = get_vec_geom loc y_str ofsy incy in
+  let y = get_vec loc y_str y ofsy incy n Vec.make0 in
+  check_vec loc x_str x (ofsx + (n - 1) * abs incx);
+  direct_sbmv
+    ~ofsy ~incy ~y ~ar ~ac ~a ~n ~k ~uplo:(get_uplo_char up)
+    ~alpha ~beta ~ofsx ~incx ~x;
   y
 
 (* SYR *)
 
 external direct_syr :
-  char -> (* UPLO *)
-  int -> (* N *)
-  float -> (* ALPHA *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec -> (* X *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat (* A *)
+  uplo : char ->
+  n : int ->
+  alpha : float ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  ar : int ->
+  ac : int ->
+  a : mat
   -> unit = "lacaml_FPRECsyr_stub_bc" "lacaml_FPRECsyr_stub"
 
 let syr ?(alpha = 1.0) ?(up = true) ?ofsx ?incx x ?n ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.syr" in
   let n = get_n_of_a loc ar ac a n in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let uplo_char = get_uplo_char up in
-  check_vec loc "x" x (ofsx + (n - 1) * abs incx);
-  direct_syr uplo_char n alpha ofsx incx x ar ac a;
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let uplo = get_uplo_char up in
+  check_vec loc x_str x (ofsx + (n - 1) * abs incx);
+  direct_syr ~uplo ~n ~alpha ~ofsx ~incx ~x ~ar ~ac ~a;
   a
 
 
 (* Auxiliary routines *)
 
 external direct_lansy :
-  char -> (* NORM *)
-  char -> (* UPLO *)
-  int ->  (* N *)
-  int ->  (* AR *)
-  int ->  (* AC *)
-  mat ->  (* A *)
-  vec     (* WORK *)
+  norm : char ->
+  uplo : char ->
+  n : int -> 
+  ar : int -> 
+  ac : int -> 
+  a : mat -> 
+  work : vec
   -> float = "lacaml_FPREClansy_stub_bc" "lacaml_FPREClansy_stub"
 
 let lansy_min_lwork n = function
 let lansy ?n ?(up = true) ?(norm = `O) ?work ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.lansy" in
   let n = get_n_of_a loc ar ac a n in
-  let norm_char = get_norm_char norm in
-  let uplo_char = get_uplo_char up in
+  let uplo = get_uplo_char up in
   let min_work = lansy_min_lwork n norm in
   let work, _lwork = get_work loc Vec.create work min_work min_work "lwork" in
-  direct_lansy norm_char uplo_char n ar ac a work
+  let norm = get_norm_char norm in
+  direct_lansy ~norm ~uplo ~n ~ar ~ac ~a ~work
 
 external direct_lamch : char -> float = "lacaml_FPREClamch_stub"
 
 (* GECON *)
 
 external direct_gecon :
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  vec -> (* WORK *)
-  int_vec -> (* IWORK *)
-  char -> (* NORM *)
-  float -> (* ANORM *)
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  work : vec ->
+  iwork : int_vec ->
+  norm : char ->
+  anorm : float ->
   int * float = "lacaml_FPRECgecon_stub_bc" "lacaml_FPRECgecon_stub"
 
 let gecon_min_lwork n = 4 * n
 let gecon ?n ?(norm = `O) ?anorm ?work ?iwork ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.gecon" in
   let n = get_n_of_a loc ar ac a n in
-  let norm_char = get_norm_char norm in
   let work, _lwork =
     get_work
       loc Vec.create work (gecon_min_lwork n) (gecon_min_lwork n) "lwork" in
     match anorm with
     | None -> lange ~norm:(norm :> norm4) ~m:n ~n a
     | Some anorm -> anorm in
-  let info, rcond = direct_gecon n ar ac a work iwork norm_char anorm in
+  let norm = get_norm_char norm in
+  let info, rcond = direct_gecon ~n ~ar ~ac ~a ~work ~iwork ~norm ~anorm in
   if info = 0 then rcond
-  else gecon_err loc norm_char n a info
+  else gecon_err loc norm n a info
 
 (* SYCON *)
 
 external direct_sycon :
-  char -> (* UPLO *)
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int_vec -> (* IPIV *)
-  vec -> (* WORK *)
-  int_vec -> (* IWORK *)
-  float -> (* ANORM *)
+  uplo : char ->
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  ipiv : int_vec ->
+  work : vec ->
+  iwork : int_vec ->
+  anorm : float ->
   int * float = "lacaml_FPRECsycon_stub_bc" "lacaml_FPRECsycon_stub"
 
 let sycon_min_lwork n = 2 * n
 let sycon ?n ?(up = true) ?ipiv ?anorm ?work ?iwork ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.sycon" in
   let n = get_n_of_a loc ar ac a n in
-  let uplo_char = get_uplo_char up in
+  let uplo = get_uplo_char up in
   let work, _lwork =
     get_work
       loc Vec.create work (sycon_min_lwork n) (sycon_min_lwork n) "lwork" in
     match anorm with
     | None -> lange ~m:n ~n ~work ~ar ~ac a
     | Some anorm -> anorm in
-  let info, rcond = direct_sycon uplo_char n ar ac a ipiv work iwork anorm in
+  let info, rcond =
+    direct_sycon ~uplo ~n ~ar ~ac ~a ~ipiv ~work ~iwork ~anorm
+  in
   if info = 0 then rcond
   else xxcon_err loc n a info
 
 (* POCON *)
 
 external direct_pocon :
-  char -> (* UPLO *)
-  int -> (* N *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  vec -> (* WORK *)
-  int_vec -> (* IWORK *)
-  float -> (* ANORM *)
+  uplo : char ->
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  work : vec ->
+  iwork : int_vec ->
+  anorm : float ->
   int * float = "lacaml_FPRECpocon_stub_bc" "lacaml_FPRECpocon_stub"
 
 let pocon_min_lwork n = 3 * n
 let pocon ?n ?(up = true) ?anorm ?work ?iwork ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.pocon" in
   let n = get_n_of_a loc ar ac a n in
-  let uplo_char = get_uplo_char up in
+  let uplo = get_uplo_char up in
   let work, _lwork =
     get_work
       loc Vec.create work (pocon_min_lwork n) (pocon_min_lwork n) "lwork" in
     match anorm with
     | None -> lange ~m:n ~n ~work ~ar ~ac a
     | Some anorm -> anorm in
-  let info, rcond = direct_pocon uplo_char n ar ac a work iwork anorm in
+  let info, rcond = direct_pocon ~uplo ~n ~ar ~ac ~a ~work ~iwork ~anorm in
   if info = 0 then rcond
   else xxcon_err loc n a info
 
 (* GELSY *)
 
 external direct_gelsy :
-  int ->     (* AR *)
-  int ->     (* AC *)
-  mat ->     (* A *)
-  int ->     (* M *)
-  int ->     (* N *)
-  int_vec -> (* JPVT *)
-  float ->   (* RCOND *)
-  vec ->     (* WORK *)
-  int ->     (* LWORK *)
-  int ->     (* NRHS *)
-  int ->     (* BR *)
-  int ->     (* BC *)
-  mat        (* B *)
+  ar : int ->    
+  ac : int ->    
+  a : mat ->    
+  m : int ->    
+  n : int ->    
+  jpvt : int_vec ->
+  rcond : float ->  
+  work : vec ->    
+  lwork : int ->    
+  nrhs : int ->    
+  br : int ->    
+  bc : int ->    
+  b : mat
   -> int * int = "lacaml_FPRECgelsy_stub_bc" "lacaml_FPRECgelsy_stub"
 
 let gelsy_min_lwork ~m ~n ~nrhs =
   max (mn + 3*n + 1) (2*mn + nrhs)
 
 let gelsy_get_opt_lwork loc ar ac a m n nrhs br bc b =
-  let dummy_work = Vec.create 1 in
+  let work = Vec.create 1 in
   let info, _ =
     direct_gelsy
-      ar ac a m n empty_int_vec (-1.0) dummy_work (-1) nrhs br bc b in
-  if info = 0 then int_of_float dummy_work.{1}
+      ~ar ~ac ~a ~m ~n ~jpvt:empty_int_vec
+      ~rcond:(-1.0) ~work ~lwork:~-1 ~nrhs ~br ~bc ~b
+  in
+  if info = 0 then int_of_float work.{1}
   else gelsX_err loc gelsy_min_lwork ar a m n 1 nrhs br b info
 
 let gelsy_opt_lwork ?m ?n ?(ar = 1) ?(ac = 1) a ?nrhs
         Vec.create lwork, lwork in
 
   let info, rank =
-    direct_gelsy ar ac a m n jpvt rcond work lwork nrhs br bc b in
+    direct_gelsy ~ar ~ac ~a ~m ~n ~jpvt ~rcond ~work ~lwork ~nrhs ~br ~bc ~b
+  in
   if info = 0 then rank
   else gelsX_err loc gelsy_min_lwork ar a m n lwork nrhs br b info
 
 (* GELSD *)
 
 external direct_gelsd :
-  int ->   (* AR *)
-  int ->   (* AC *)
-  mat ->   (* A *)
-  int ->   (* M *)
-  int ->   (* N *)
-  int ->   (* OFSS *)
-  vec ->   (* S *)
-  float -> (* RCOND *)
-  vec ->   (* WORK *)
-  int ->   (* LWORK *)
-  vec ->   (* IWORK *)
-  int ->   (* NRHS *)
-  int ->   (* BR *)
-  int ->   (* BC *)
-  mat      (* B *)
+  ar : int ->  
+  ac : int ->  
+  a : mat ->  
+  m : int ->  
+  n : int ->  
+  ofss : int ->  
+  s : vec ->  
+  rcond : float ->
+  work : vec ->  
+  lwork : int ->  
+  iwork : vec ->  
+  nrhs : int ->  
+  br : int ->  
+  bc : int ->  
+  b : mat
   -> int * int = "lacaml_FPRECgelsd_stub_bc" "lacaml_FPRECgelsd_stub"
 
 let lg2_10 = log10 2.0
   gelsd_get_min_iwork mn (gelsd_nlvl mn)
 
 let gelsd_get_opt_lwork loc ar ac a m n nrhs br bc b =
-  let dummy_work = Vec.create 1 in
+  let work = Vec.create 1 in
   let info, _ =
-    direct_gelsd ar ac a m n 1 Vec.empty (-1.0) dummy_work (-1) Vec.empty
-      nrhs br bc b in
+    direct_gelsd
+      ~ar ~ac ~a ~m ~n ~ofss:1 ~s:Vec.empty ~rcond:(-1.0) ~work
+      ~lwork:~-1 ~iwork:Vec.empty
+      ~nrhs ~br ~bc ~b
+  in
   if info = 0 then
     (* FIXME: LAPACK bug??? *)
-    (* int_of_floatxx dummy_work.{1} *)
-    max (int_of_floatxx dummy_work.{1}) (gelsd_min_lwork ~m ~n ~nrhs)
+    (* int_of_floatxx work.{1} *)
+    max (int_of_floatxx work.{1}) (gelsd_min_lwork ~m ~n ~nrhs)
   else gelsX_err loc gelsd_min_lwork ar a m n 1 nrhs br b info
 
 let gelsd_opt_lwork ?m ?n ?(ar = 1) ?(ac = 1) a ?nrhs
   let loc = "Lacaml.Impl.FPREC.gelsd" in
   let m, n, nrhs = gelsX_get_params loc ar ac a m n nrhs br bc b in
   let mn = min m n in
-  let ofss = get_ofs loc "s" ofss in
+  let ofss = get_ofs loc s_str ofss in
   let s = gelsX_get_s Vec.create loc mn ofss s in
 
   let iwork =
         Vec.create lwork, lwork in
 
   let info, rank =
-    direct_gelsd ar ac a m n ofss s rcond work lwork iwork nrhs br bc b in
+    direct_gelsd
+      ~ar ~ac ~a ~m ~n ~ofss ~s ~rcond ~work ~lwork ~iwork ~nrhs ~br ~bc ~b
+  in
 
   if info = 0 then rank
   else gelsX_err loc gelsd_min_lwork ar a m n lwork nrhs br b info
 (* GELSS *)
 
 external direct_gelss :
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int -> (* M *)
-  int -> (* N *)
-  int -> (* OFSS *)
-  vec -> (* S *)
-  float -> (* RCOND *)
-  vec -> (* WORK *)
-  int -> (* LWORK *)
-  int -> (* NRHS *)
-  int -> (* BR *)
-  int -> (* BC *)
-  mat (* B *)
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  m : int ->
+  n : int ->
+  ofss : int ->
+  s : vec ->
+  rcond : float ->
+  work : vec ->
+  lwork : int ->
+  nrhs : int ->
+  br : int ->
+  bc : int ->
+  b : mat
   -> int * int = "lacaml_FPRECgelss_stub_bc" "lacaml_FPRECgelss_stub"
 
 let gelss_min_lwork ~m ~n ~nrhs =
   max 1 (3*min_dim + max (max (2*min_dim) (max m n)) nrhs)
 
 let gelss_get_opt_lwork loc ar ac a m n nrhs br bc b =
-  let dummy_work = Vec.create 1 in
+  let work = Vec.create 1 in
   let info, _ =
-    direct_gelss ar ac a m n 1 Vec.empty (-1.0) dummy_work (-1) nrhs br bc b in
-  if info = 0 then int_of_floatxx dummy_work.{1}
+    direct_gelss
+      ~ar ~ac ~a ~m ~n ~ofss:1 ~s:Vec.empty ~rcond:(-1.0)
+      ~work ~lwork:~-1 ~nrhs ~br ~bc ~b
+  in
+  if info = 0 then int_of_floatxx work.{1}
   else gelsX_err loc gelss_min_lwork ar a m n 1 nrhs br b info
 
 let gelss_opt_lwork ?(ar = 1) ?(ac = 1) a ?m ?n ?nrhs ?(br = 1) ?(bc = 1) b =
       ?(ar = 1) ?(ac = 1) a ?nrhs ?(br = 1) ?(bc = 1) b =
   let loc = "Lacaml.Impl.FPREC.gelss" in
   let m, n, nrhs = gelsX_get_params loc ar ac a m n nrhs br bc b in
-  let ofss = get_ofs loc "s" ofss in
+  let ofss = get_ofs loc s_str ofss in
   let s = gelsX_get_s Vec.create loc (min m n) ofss s in
   let work, lwork =
     match work with
         let lwork = gelss_get_opt_lwork loc ar ac a m n nrhs br bc b in
         Vec.create lwork, lwork in
   let info, rank =
-    direct_gelss ar ac a m n ofss s rcond work lwork nrhs br bc b in
+    direct_gelss ~ar ~ac ~a ~m ~n ~ofss ~s ~rcond ~work ~lwork ~nrhs ~br ~bc ~b
+  in
   if info = 0 then rank
   else gelsX_err loc gelss_min_lwork ar a m n lwork nrhs br b info
 
 (* GESVD *)
 
 external direct_gesvd :
-  char -> (* JOBU *)
-  char -> (* JOBVT *)
-  int ->  (* M *)
-  int ->  (* N *)
-  int ->  (* AR *)
-  int ->  (* AC *)
-  mat ->  (* A *)
-  vec ->  (* S *)
-  int ->  (* UR *)
-  int ->  (* UC *)
-  mat ->  (* U *)
-  int ->  (* VTC *)
-  int ->  (* VTR *)
-  mat ->  (* VT *)
-  vec ->  (* WORK *)
-  int     (* LWORK *)
+  jobu : char ->
+  jobvt : char ->
+  m : int -> 
+  n : int -> 
+  ar : int -> 
+  ac : int -> 
+  a : mat -> 
+  s : vec -> 
+  ur : int -> 
+  uc : int -> 
+  u : mat -> 
+  vtc : int -> 
+  vtr : int -> 
+  vt : mat -> 
+  work : vec -> 
+  lwork : int
   -> int = "lacaml_FPRECgesvd_stub_bc" "lacaml_FPRECgesvd_stub"
 
 let gesvd_min_lwork ~m ~n =
 
 let gesvd_get_opt_lwork loc jobu jobvt m n ar ac a s ur uc u vtr vtc vt =
   let lwork = -1 in
-  let dummy_work = Vec.create 1 in
+  let work = Vec.create 1 in
   let info =
-    direct_gesvd jobu jobvt m n ar ac a s ur uc u vtr vtc vt dummy_work lwork in
-  if info = 0 then int_of_floatxx dummy_work.{1}
+    direct_gesvd
+      ~jobu ~jobvt ~m ~n ~ar ~ac ~a ~s ~ur ~uc ~u ~vtr ~vtc ~vt ~work ~lwork
+  in
+  if info = 0 then int_of_floatxx work.{1}
   else gesvd_err loc jobu jobvt m n a u vt lwork info
 
 let gesvd_opt_lwork
 
 let gesvd
     ?m ?n
-    ?(jobu = `A) ?(jobvt = `A) ?s
+    ?jobu:(jobu_t = `A) ?jobvt:(jobvt_t = `A) ?s
     ?(ur = 1) ?(uc = 1) ?u
     ?(vtr = 1) ?(vtc = 1) ?vt ?work ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.gesvd" in
-  let jobu_c, jobvt_c, m, n, s, u, vt =
+  let jobu, jobvt, m, n, s, u, vt =
     gesvd_get_params
-      loc Vec.create Mat.create jobu jobvt m n ar ac a s ur uc u vtr vtc vt in
+      loc Vec.create Mat.create jobu_t jobvt_t m n ar ac a s ur uc u vtr vtc vt
+  in
   let work, lwork =
     match work with
     | Some work -> work, Array1.dim work
     | None ->
         let lwork =
           gesvd_get_opt_lwork
-            loc jobu_c jobvt_c m n ar ac a s ur uc u vtr vtc vt in
+            loc jobu jobvt m n ar ac a s ur uc u vtr vtc vt in
         Vec.create lwork, lwork in
   let info =
-    direct_gesvd jobu_c jobvt_c m n ar ac a s ur uc u vtr vtc vt work lwork in
+    direct_gesvd
+      ~jobu ~jobvt ~m ~n ~ar ~ac ~a ~s ~ur ~uc ~u ~vtr ~vtc ~vt ~work ~lwork
+  in
   if info = 0 then
-    let u = get_job_svecs u jobu in
-    let vt = get_job_svecs vt jobvt in
+    let u = get_job_svecs u jobu_t in
+    let vt = get_job_svecs vt jobvt_t in
     s, u, vt
-  else gesvd_err loc jobu_c jobvt_c m n a u vt lwork info
+  else gesvd_err loc jobu jobvt m n a u vt lwork info
 
 
 (* GESDD *)
 
 external direct_gesdd :
-  char ->  (* JOBZ *)
-  int ->   (* M *)
-  int ->   (* N *)
-  int ->   (* AR *)
-  int ->   (* AC *)
-  mat ->   (* A *)
-  vec ->   (* S *)
-  int ->   (* UR *)
-  int ->   (* UC *)
-  mat ->   (* U *)
-  int ->   (* VTR *)
-  int ->   (* VTC *)
-  mat ->   (* VT *)
-  vec ->   (* WORK *)
-  int ->   (* LWORK *)
-  int_vec  (* IWORK *)
+  jobz : char -> 
+  m : int ->  
+  n : int ->  
+  ar : int ->  
+  ac : int ->  
+  a : mat ->  
+  s : vec ->  
+  ur : int ->  
+  uc : int ->  
+  u : mat ->  
+  vtr : int ->  
+  vtc : int ->  
+  vt : mat ->  
+  work : vec ->  
+  lwork : int ->  
+  iwork : int_vec
   -> int = "lacaml_FPRECgesdd_stub_bc" "lacaml_FPRECgesdd_stub"
 
 let gesdd_min_lwork ?(jobz = `A) ~m ~n () =
 let gesdd_get_opt_lwork loc jobz ?iwork m n ar ac a s ur uc u vtr vtc vt =
   let iwork = gesdd_get_iwork loc ~m ~n iwork in
   let lwork = -1 in
-  let dummy_work = Vec.create 1 in
+  let work = Vec.create 1 in
   let info =
-    direct_gesdd jobz m n ar ac a s ur uc u vtr vtc vt dummy_work lwork iwork in
+    direct_gesdd
+      ~jobz ~m ~n ~ar ~ac ~a ~s ~ur ~uc ~u ~vtr ~vtc ~vt ~work ~lwork ~iwork
+  in
   if info = 0 then
     (* FIXME: LAPACK bug??? *)
-    (* int_of_floatxx dummy_work.{1} *)
-    max (int_of_floatxx dummy_work.{1}) (gesdd_min_lwork_char jobz ~m ~n)
+    (* int_of_floatxx work.{1} *)
+    max (int_of_floatxx work.{1}) (gesdd_min_lwork_char jobz ~m ~n)
   else gesdd_err loc jobz m n a u vt lwork info
 
 let gesdd_opt_lwork
   let loc = "Lacaml.Impl.FPREC.gesdd_opt_lwork" in
   let jobz_c, m, n, s, u, vt =
     gesdd_get_params
-      loc Vec.create Mat.create jobz m n ar ac a s ur uc u vtr vtc vt in
+      loc Vec.create Mat.create jobz m n ar ac a s ur uc u vtr vtc vt
+  in
   gesdd_get_opt_lwork loc jobz_c ?iwork m n ar ac a s ur uc u vtr vtc vt
 
 let gesdd
     ?m ?n
-    ?(jobz = `A) ?s
+    ?jobz:(jobz_t = `A) ?s
     ?(ur = 1) ?(uc = 1) ?u ?(vtr = 1) ?(vtc = 1) ?vt
     ?work ?iwork ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.gesdd" in
-  let jobz_c, m, n, s, u, vt =
+  let jobz, m, n, s, u, vt =
     gesdd_get_params
-      loc Vec.create Mat.create jobz m n ar ac a s ur uc u vtr vtc vt in
+      loc Vec.create Mat.create jobz_t m n ar ac a s ur uc u vtr vtc vt in
   let iwork = gesdd_get_iwork loc ~m ~n iwork in
   let work, lwork =
     match work with
     | None ->
         let lwork =
           gesdd_get_opt_lwork
-            loc jobz_c ~iwork m n ar ac a s ur uc u vtr vtc vt in
+            loc jobz ~iwork m n ar ac a s ur uc u vtr vtc vt in
         Vec.create lwork, lwork in
   let info =
-    direct_gesdd jobz_c m n ar ac a s ur uc u vtr vtc vt work lwork iwork in
+    direct_gesdd
+      ~jobz ~m ~n ~ar ~ac ~a ~s ~ur ~uc ~u ~vtr ~vtc ~vt ~work ~lwork ~iwork
+  in
   if info = 0 then
-    match jobz with
+    match jobz_t with
     | `A | `S -> s, u, vt
     | `O -> if m >= n then s, Mat.empty, vt else s, u, Mat.empty
     | `N -> s, Mat.empty, Mat.empty
-  else gesdd_err loc jobz_c m n a u vt lwork info
+  else gesdd_err loc jobz m n a u vt lwork info
 
 
 (* General eigenvalue problem (simple drivers) *)
 (* GEEV *)
 
 external direct_geev :
-  int -> int -> mat -> (* AR, AC, A *)
-  int -> (* N *)
-  int -> vec -> (* OFSWR, WR *)
-  int -> vec -> (* OFSWI, WI *)
-  int -> int -> mat -> char -> (* VLR, VLC, VL, JOBVL *)
-  int -> int -> mat -> char -> (* VRR, VRC, VR, JOBVR *)
-  vec -> int (* WORK, LWORK *)
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  n : int ->
+  ofswr : int ->
+  wr : vec ->
+  ofswi : int ->
+  wi : vec ->
+  vlr : int ->
+  vlc : int ->
+  vl : mat ->
+  jobvl : char ->
+  vrr : int ->
+  vrc : int ->
+  vr : mat ->
+  jobvr : char ->
+  work : vec ->
+  lwork : int
   -> int = "lacaml_FPRECgeev_stub_bc" "lacaml_FPRECgeev_stub"
 
 let geev_min_lwork ?(vectors = true) n =
   else max 1 (3 * n)
 
 let geev_get_opt_lwork
-    loc n
-    leftr leftc vl jobvl
-    rightr rightc vr jobvr
-    ofswr wr
-    ofswi wi
-    ar ac a vectors =
-  let dummy_work = Vec.create 1 in
+    ~loc ~n
+    ~vlr ~vlc ~vl ~jobvl
+    ~vrr ~vrc ~vr ~jobvr
+    ~ofswr ~wr
+    ~ofswi ~wi
+    ~ar ~ac ~a ~vectors =
+  let work = Vec.create 1 in
   let info =
     direct_geev
-      ar ac a n ofswr wr ofswi wi leftr leftc vl jobvl rightr rightc vr jobvr
-      dummy_work (-1) in
-  if info = 0 then int_of_float dummy_work.{1}
-  else geev_err loc (geev_min_lwork ~vectors) a n vl vr (-1) info
+      ~ar ~ac ~a ~n ~ofswr ~wr ~ofswi ~wi ~vlr ~vlc ~vl ~jobvl
+      ~vrr ~vrc ~vr ~jobvr ~work ~lwork:~-1
+  in
+  if info = 0 then int_of_float work.{1}
+  else geev_err loc (geev_min_lwork ~vectors) a n vl vr ~-1 info
 
-let geev_get_params loc ar ac a n leftr leftc left rightr rightc right
-    ofswr wr ofswi wi =
+let geev_get_params
+      ~loc ~ar ~ac ~a ~n ~vlr ~vlc ~vl
+      ~vrr ~vrc ~vr ~ofswr ~wr ~ofswi ~wi =
   let n, _, _, _, _, _, _, _, _, _ as params =
     geev_gen_get_params
-      loc Mat.empty Mat.create ar ac a n leftr leftc left rightr rightc right in
-  params,
-  xxev_get_wx Vec.create loc "wr" ofswr wr n,
-  xxev_get_wx Vec.create loc "wi" ofswi wi n
+      loc Mat.empty Mat.create ar ac a n vlr vlc vl vrr vrc vr
+  in
+  (
+    params,
+    xxev_get_wx Vec.create loc wr_str ofswr wr n,
+    xxev_get_wx Vec.create loc wi_str ofswi wi n
+  )
 
 let geev_opt_lwork
     ?n
-    ?(leftr = 1) ?(leftc = 1) ?left
-    ?(rightr = 1) ?(rightc = 1) ?right
+    ?(vlr = 1) ?(vlc = 1) ?vl
+    ?(vrr = 1) ?(vrc = 1) ?vr
     ?(ofswr = 1) ?wr
     ?(ofswi = 1) ?wi
     ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.geev_opt_lwork" in
-  let (n, leftr, leftc, vl, jobvl, rightr, rightc, vr, jobvr, vectors),
+  let (n, vlr, vlc, vl, jobvl, vrr, vrc, vr, jobvr, vectors),
       (ofswr, wr), (ofswi, wi) =
-    geev_get_params loc ar ac a n leftr leftc left rightr rightc right
-      ofswr wr ofswi wi in
+    geev_get_params
+      ~loc ~ar ~ac ~a ~n ~vlr ~vlc ~vl ~vrr ~vrc ~vr ~ofswr ~wr ~ofswi ~wi
+  in
   geev_get_opt_lwork
-    loc n leftr leftc vl jobvl rightr rightc vr jobvr ofswr wr ofswi wi
-    ar ac a vectors
+    ~loc ~n ~vlr ~vlc ~vl ~jobvl ~vrr ~vrc ~vr ~jobvr ~ofswr ~wr
+    ~ofswi ~wi ~ar ~ac ~a ~vectors
 
 let geev
     ?n ?work
-    ?(leftr = 1) ?(leftc = 1) ?left
-    ?(rightr = 1) ?(rightc = 1) ?right
+    ?(vlr = 1) ?(vlc = 1) ?vl
+    ?(vrr = 1) ?(vrc = 1) ?vr
     ?(ofswr = 1) ?wr
     ?(ofswi = 1) ?wi
     ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.geev" in
-  let (n, leftr, leftc, vl, jobvl, rightr, rightc, vr, jobvr, vectors),
+  let (n, vlr, vlc, vl, jobvl, vrr, vrc, vr, jobvr, vectors),
       (ofswr, wr), (ofswi, wi) =
-    geev_get_params loc ar ac a n leftr leftc left rightr rightc right
-      ofswr wr ofswi wi in
+    geev_get_params
+      ~loc ~ar ~ac ~a ~n ~vlr ~vlc ~vl ~vrr ~vrc ~vr ~ofswr ~wr ~ofswi ~wi
+  in
 
   let work, lwork =
     match work with
     | None ->
         let lwork =
           geev_get_opt_lwork
-            loc n leftr leftc vl jobvl rightr rightc vr jobvr
-            ofswr wr ofswi wi ar ac a vectors in
+            ~loc ~n ~vlr ~vlc ~vl ~jobvl ~vrr ~vrc ~vr ~jobvr
+            ~ofswr ~wr ~ofswi ~wi ~ar ~ac ~a ~vectors
+        in
         Vec.create lwork, lwork in
 
   let info =
-    direct_geev ar ac a n ofswr wr ofswi wi leftr leftc vl jobvl
-      rightr rightc vr jobvr work lwork in
+    direct_geev ~ar ~ac ~a ~n ~ofswr ~wr ~ofswi ~wi ~vlr ~vlc ~vl ~jobvl
+      ~vrr ~vrc ~vr ~jobvr ~work ~lwork
+  in
 
   if info = 0 then vl, wr, wi, vr
   else geev_err loc (geev_min_lwork ~vectors) a n vl vr lwork info
 (* SYEV *)
 
 external direct_syev :
-  int ->  (* AR *)
-  int ->  (* AC *)
-  mat ->  (* A *)
-  int ->  (* N *)
-  char -> (* JOBZ *)
-  char -> (* UPLO *)
-  int ->  (* OFSW *)
-  vec ->  (* W *)
-  vec ->  (* WORK *)
-  int     (* LWORK *)
+  ar : int -> 
+  ac : int -> 
+  a : mat -> 
+  n : int -> 
+  jobz : char ->
+  uplo : char ->
+  ofsw : int -> 
+  w : vec -> 
+  work : vec -> 
+  lwork : int
   -> int = "lacaml_FPRECsyev_stub_bc" "lacaml_FPRECsyev_stub"
 
 let syev_min_lwork n = max 1 (3 * n - 1)
 
 let syev_get_opt_lwork loc ar ac a n jobz uplo =
-  let dummy_work = Vec.create 1 in
-  let info = direct_syev ar ac a n jobz uplo 1 Vec.empty dummy_work (-1) in
-  if info = 0 then int_of_float dummy_work.{1}
-  else syev_err loc syev_min_lwork a n (-1) info
+  let work = Vec.create 1 in
+  let info =
+    direct_syev ~ar ~ac ~a ~n ~jobz ~uplo ~ofsw:1 ~w:Vec.empty ~work ~lwork:~-1
+  in
+  if info = 0 then int_of_float work.{1}
+  else syev_err loc syev_min_lwork a n ~-1 info
 
 let syev_opt_lwork ?n ?(vectors = false) ?(up = true) ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.syev_opt_lwork" in
     ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.syev" in
   let n, jobz, uplo = syev_get_params loc ar ac a n vectors up in
-  let ofsw = get_ofs loc "w" ofsw in
-  let ofsw, w = xxev_get_wx Vec.create loc "w" ofsw w n in
+  let ofsw = get_ofs loc w_str ofsw in
+  let ofsw, w = xxev_get_wx Vec.create loc w_str ofsw w n in
 
   let work, lwork =
     match work with
     | None ->
         let lwork = syev_get_opt_lwork loc ar ac a n jobz uplo in
         Vec.create lwork, lwork in
-  let info = direct_syev ar ac a n jobz uplo ofsw w work lwork in
+  let info = direct_syev ~ar ~ac ~a ~n ~jobz ~uplo ~ofsw ~w ~work ~lwork in
   if info = 0 then w
   else syev_err loc syev_min_lwork a n lwork info
 
 (* SYEVD *)
 
 external direct_syevd :
-  int ->     (* AR *)
-  int ->     (* AC *)
-  mat ->     (* A *)
-  int ->     (* N *)
-  char ->    (* JOBZ *)
-  char ->    (* UPLO *)
-  int ->     (* OFSW *)
-  vec ->     (* W *)
-  vec ->     (* WORK *)
-  int ->     (* LWORK *)
-  int_vec -> (* IWORK *)
-  int        (* LIWORK *)
+  ar : int ->    
+  ac : int ->    
+  a : mat ->    
+  n : int ->    
+  jobz : char ->   
+  uplo : char ->   
+  ofsw : int ->    
+  w : vec ->    
+  work : vec ->    
+  lwork : int ->    
+  iwork : int_vec ->
+  liwork : int
   -> int = "lacaml_FPRECsyevd_stub_bc" "lacaml_FPRECsyevd_stub"
 
 let syevd_min_lwork ~vectors n =
   else 3 + 5*n
 
 let syevd_get_opt_l_li_work loc ar ac a n vectors jobz uplo =
-  let dummy_work = Vec.create 1 in
-  let dummy_iwork = Common.create_int_vec 1 in
+  let work = Vec.create 1 in
+  let iwork = Common.create_int_vec 1 in
   let info =
     direct_syevd
-      ar ac a n jobz uplo 1 Vec.empty dummy_work (-1) dummy_iwork (-1) in
-  if info = 0 then int_of_float dummy_work.{1}, Int32.to_int dummy_iwork.{1}
+      ~ar ~ac ~a ~n ~jobz ~uplo ~ofsw:1 ~w:Vec.empty
+      ~work ~lwork:~-1 ~iwork ~liwork:~-1
+  in
+  if info = 0 then int_of_float work.{1}, Int32.to_int iwork.{1}
   else
     syevd_err
       loc (syevd_min_lwork ~vectors) (syevd_min_liwork ~vectors)
-      a n (-1) (-1) info
+      a n ~-1 ~-1 info
 
 let syevd_get_opt_lwork loc ar ac a n vectors jobz uplo =
   fst (syevd_get_opt_l_li_work loc ar ac a n vectors jobz uplo)
       ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.FPREC.syevd" in
   let n, jobz, uplo = syev_get_params loc ar ac a n vectors up in
-  let ofsw = get_ofs loc "w" ofsw in
-  let ofsw, w = xxev_get_wx Vec.create loc "w" ofsw w n in
+  let ofsw = get_ofs loc w_str ofsw in
+  let ofsw, w = xxev_get_wx Vec.create loc w_str ofsw w n in
   let work, iwork, lwork, liwork =
     match work, iwork with
     | Some work, Some iwork ->
         let work = Vec.create lwork in
         let iwork = Common.create_int_vec liwork in
         work, iwork, lwork, liwork in
-  let info = direct_syevd ar ac a n jobz uplo ofsw w work lwork iwork liwork in
+  let info =
+    direct_syevd ~ar ~ac ~a ~n ~jobz ~uplo ~ofsw ~w ~work ~lwork ~iwork ~liwork
+  in
   if info = 0 then w
   else
     syevd_err
 (* SYEVR *)
 
 external direct_syevr :
-  int ->     (* AR *)
-  int ->     (* AC *)
-  mat ->     (* A *)
-  int ->     (* N *)
-  char ->    (* JOBZ *)
-  char ->    (* RANGE *)
-  char ->    (* UPLO *)
-  float ->   (* VL *)
-  float ->   (* VU *)
-  int ->     (* IL *)
-  int ->     (* IU *)
-  float ->   (* ABSTOL *)
-  int ->     (* OFSW *)
-  vec ->     (* W *)
-  int ->     (* ZR *)
-  int ->     (* ZC *)
-  mat ->     (* Z *)
-  int_vec -> (* ISUPPZ *)
-  vec ->     (* WORK *)
-  int ->     (* LWORK *)
-  int_vec -> (* IWORK *)
-  int        (* LIWORK *)
+  ar : int ->    
+  ac : int ->    
+  a : mat ->    
+  n : int ->    
+  jobz : char ->   
+  range : char ->   
+  uplo : char ->   
+  vl : float ->  
+  vu : float ->  
+  il : int ->    
+  iu : int ->    
+  abstol : float ->  
+  ofsw : int ->    
+  w : vec ->    
+  zr : int ->    
+  zc : int ->    
+  z : mat ->    
+  isuppz : int_vec ->
+  work : vec ->    
+  lwork : int ->    
+  iwork : int_vec ->
+  liwork : int
   -> int * int = "lacaml_FPRECsyevr_stub_bc" "lacaml_FPRECsyevr_stub"
 
 let syevr_err loc a n err =
 
 let syevr_get_opt_l_li_work
       loc ar ac a n jobz range uplo vl vu il iu abstol ofsw w zr zc z isuppz =
-  let dummy_work = Vec.create 1 in
-  let dummy_iwork = Common.create_int_vec 1 in
+  let work = Vec.create 1 in
+  let iwork = Common.create_int_vec 1 in
   let info, _ =
     direct_syevr
-      ar ac a n
-      jobz range uplo
-      vl vu
-      il iu
-      abstol
-      ofsw w
-      zr zc z
-      isuppz
-      dummy_work (-1)
-      dummy_iwork (-1) in
-  if info = 0 then int_of_float dummy_work.{1}, Int32.to_int dummy_iwork.{1}
+      ~ar ~ac ~a ~n
+      ~jobz ~range ~uplo
+      ~vl ~vu
+      ~il ~iu
+      ~abstol
+      ~ofsw ~w
+      ~zr ~zc ~z
+      ~isuppz
+      ~work ~lwork:~-1
+      ~iwork ~liwork:~-1 in
+  if info = 0 then int_of_float work.{1}, Int32.to_int iwork.{1}
   else syevr_err loc a n info
 
 let syevr_get_opt_lwork
   let n, jobz, uplo = syev_get_params loc ar ac a n vectors up in
   let range, m, vl, vu, il, iu = syevr_get_params loc n range in
   let abstol = syevr_get_abstol abstol in
-  let ofsw = get_ofs loc "w" ofsw in
-  let ofsw, w = xxev_get_wx Vec.create loc "w" ofsw w n in
-  let z = get_mat loc "z" Mat.create zr zc z n m (* order of n, m is ok! *) in
+  let ofsw = get_ofs loc w_str ofsw in
+  let ofsw, w = xxev_get_wx Vec.create loc w_str ofsw w n in
+  let z = get_mat loc z_str Mat.create zr zc z n m (* order of n, m is ok! *) in
   let isuppz =
     let min_lisuppz_1 = max 1 m in
     let min_lisuppz = min_lisuppz_1 + min_lisuppz_1 in
         work, iwork, lwork, liwork in
   let info, m =
     direct_syevr
-      ar ac a n
-      jobz range uplo
-      vl vu
-      il iu
-      abstol
-      ofsw w
-      zr zc z
-      isuppz
-      work lwork
-      iwork liwork in
+      ~ar ~ac ~a ~n
+      ~jobz ~range ~uplo
+      ~vl ~vu
+      ~il ~iu
+      ~abstol
+      ~ofsw ~w
+      ~zr ~zc ~z
+      ~isuppz
+      ~work ~lwork
+      ~iwork ~liwork
+  in
   if info = 0 then m, w, z, isuppz
   else syevr_err loc a n info
 
 val geev_opt_lwork :
   ?n : int ->
-  ?leftr : int -> ?leftc : int -> ?left : mat option ->
-  ?rightr : int -> ?rightc : int -> ?right : mat option ->
+  ?vlr : int -> ?vlc : int -> ?vl : mat option ->
+  ?vrr : int -> ?vrc : int -> ?vr : mat option ->
   ?ofswr : int -> ?wr : vec ->
   ?ofswi : int -> ?wi : vec ->
   ?ar : int -> ?ac : int -> mat ->
   int
  (** [geev_opt_lwork
        ?n
-       ?leftr ?leftc ?left
-       ?rightr ?rightc ?right
+       ?vlr ?vlc ?vl
+       ?vrr ?vrc ?vr
        ?ofswr wr
        ?ofswi wi
        ?ar ?ac a]
 val geev :
   ?n : int ->
   ?work : vec ->
-  ?leftr : int -> ?leftc  : int -> ?left : mat option ->
-  ?rightr : int -> ?rightc : int -> ?right : mat option ->
+  ?vlr : int -> ?vlc  : int -> ?vl : mat option ->
+  ?vrr : int -> ?vrc : int -> ?vr : mat option ->
   ?ofswr : int -> ?wr : vec ->
   ?ofswi : int -> ?wi : vec ->
   ?ar : int -> ?ac : int -> mat ->
   mat * vec * vec * mat
 (** [geev ?work ?n
-      ?leftr ?leftc ?left
-      ?rightr ?rightc ?right
+      ?vlr ?vlc ?vl
+      ?vrr ?vrc ?vr
       ?ofswr wr ?ofswi wi
       ?ar ?ac a]
     @return ([lv], [wr], [wi], [rv]), where [wr] and [wv] are the real
       and imaginary components of the eigenvalues, and [lv] and [rv]
       are the left and right eigenvectors. [lv] ([rv]) is the empty
-      matrix if [left] ([right]) is set to [None].
+      matrix if [vl] ([vr]) is set to [None].
     @raise Failure if the function fails to converge
     @param n default = available number of columns of matrix [a]
     @param work default = automatically allocated workspace
-    @param left default = Automatically allocated left eigenvectors.
-                          Pass [None] if you do not want to compute them,
-                          [Some lv] if you want to provide the storage.
-                          You can set [leftr], [leftc] in the last case.
+    @param vl default = Automatically allocated left eigenvectors.
+                        Pass [None] if you do not want to compute them,
+                        [Some lv] if you want to provide the storage.
+                        You can set [vlr], [vlc] in the last case.
     (See LAPACK GEEV docs for details about storage of complex eigenvectors)
-    @param right default = Automatically allocated right eigenvectors.
-                           Pass [None] if you do not want to compute them,
-                           [Some rv] if you want to provide the storage.
-                           You can set [rightr], [rightc] in the last case.
+    @param vr default = Automatically allocated right eigenvectors.
+                        Pass [None] if you do not want to compute them,
+                        [Some rv] if you want to provide the storage.
+                        You can set [vrr], [vrc] in the last case.
     @param wr default = vector of size [n]; real components of the eigenvalues
     @param wi default = vector of size [n];
                         imaginary components of the eigenvalues
 (* SWAP *)
 
 external direct_swap :
-  int -> (* N *)
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECswap_stub_bc" "lacaml_NPRECswap_stub"
+  n : int ->
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECswap_stub_bc" "lacaml_NPRECswap_stub"
 
 let swap ?n ?ofsx ?incx ~x ?ofsy ?incy y =
   let loc = "Lacaml.Impl.NPREC.swap" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let ofsy, incy = get_vec_geom loc "y" ofsy incy in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  check_vec loc "y" y (ofsy + (n - 1) * abs incy);
-  direct_swap n ofsx incx x ofsy incy y
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let ofsy, incy = get_vec_geom loc y_str ofsy incy in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  check_vec loc y_str y (ofsy + (n - 1) * abs incy);
+  direct_swap ~n ~ofsx ~incx ~x ~ofsy ~incy ~y
 
 
 (* SCAL *)
 
 external direct_scal :
-  int -> (* N *)
-  num_type -> (* ALPHA *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECscal_stub"
+  n : int ->
+  alpha : num_type ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECscal_stub"
 
 let scal ?n alpha ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.scal" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  direct_scal n alpha ofsx incx x
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  direct_scal ~n ~alpha ~ofsx ~incx ~x
 
 
 (* COPY *)
 
 external direct_copy :
-  int -> (* N *)
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECcopy_stub_bc" "lacaml_NPRECcopy_stub"
+  n : int ->
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECcopy_stub_bc" "lacaml_NPRECcopy_stub"
 
 let copy ?n ?ofsy ?incy ?y ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.copy" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let ofsy, incy = get_vec_geom loc "y" ofsy incy in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let ofsy, incy = get_vec_geom loc y_str ofsy incy in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
   let y, ofsy, incy =
     let min_dim_y = ofsy + (n - 1) * abs incy in
     match y with
-    | Some y -> check_vec loc "y" y min_dim_y; y, ofsy, incy
+    | Some y -> check_vec loc y_str y min_dim_y; y, ofsy, incy
     | None -> Vec.create min_dim_y, 1, 1 in
-  direct_copy n ofsy incy y ofsx incx x;
+  direct_copy ~n ~ofsy ~incy ~y ~ofsx ~incx ~x;
   y
 
 
 (* AXPY *)
 
 external direct_axpy :
-  int -> (* N *)
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  num_type -> (* ALPHA *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECaxpy_stub_bc" "lacaml_NPRECaxpy_stub"
+  n : int ->
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  alpha : num_type ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECaxpy_stub_bc" "lacaml_NPRECaxpy_stub"
 
 let axpy ?n ?(alpha = one) ?ofsx ?incx ~x ?ofsy ?incy y =
   let loc = "Lacaml.Impl.NPREC.axpy" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let ofsy, incy = get_vec_geom loc "y" ofsy incy in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  check_vec loc "y" y (ofsy + (n - 1) * abs incy);
-  direct_axpy n ofsy incy y alpha ofsx incx x
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let ofsy, incy = get_vec_geom loc y_str ofsy incy in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  check_vec loc y_str y (ofsy + (n - 1) * abs incy);
+  direct_axpy ~n ~ofsy ~incy ~y ~alpha ~ofsx ~incx ~x
 
 
 (* AMAX *)
 
 external direct_iamax :
-  int -> (* N *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> int = "lacaml_NPRECiamax_stub"
+  n : int ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  int = "lacaml_NPRECiamax_stub"
 
 let iamax ?n ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.iamax" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  direct_iamax n ofsx incx x
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  direct_iamax ~n ~ofsx ~incx ~x
 
 let amax ?n ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.amax" in
-  let ofsx, incx = get_vec_geom loc "x" ofsx incx in
-  let n = get_dim_vec loc "x" ofsx incx x "n" n in
-  x.{direct_iamax n ofsx incx x}
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  let n = get_dim_vec loc x_str ofsx incx x n_str n in
+  x.{direct_iamax ~n ~ofsx ~incx ~x}
 
 
 (* BLAS-2 *)
 (* GEMV *)
 
 external direct_gemv :
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int -> (* M *)
-  int -> (* N *)
-  char -> (* TRANS *)
-  float -> (* ALPHA *)
-  float -> (* BETA *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECgemv_stub_bc" "lacaml_NPRECgemv_stub"
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  m : int ->
+  n : int ->
+  trans : char ->
+  alpha : float ->
+  beta : float ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECgemv_stub_bc" "lacaml_NPRECgemv_stub"
 
 let gemv ?m ?n ?(beta = 0.0) ?ofsy ?incy ?y ?(trans = `N) ?(alpha = 1.0)
       ?(ar = 1) ?(ac = 1) a ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.gemv" in
-  let m, n, ofsx, incx, ofsy, incy, y, trans_char =
-    gXmv_get_params loc Vec.make0 ar ac a m n ofsx incx x ofsy incy y trans in
-  direct_gemv ofsy incy y ar ac a m n trans_char alpha beta ofsx incx x;
+  let m, n, ofsx, incx, ofsy, incy, y, trans =
+    gXmv_get_params loc Vec.make0 ar ac a m n ofsx incx x ofsy incy y trans
+  in
+  direct_gemv
+    ~ofsy ~incy ~y ~ar ~ac ~a ~m ~n ~trans ~alpha ~beta ~ofsx ~incx ~x;
   y
 
 
 (* GBMV *)
 
 external direct_gbmv :
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int -> (* M *)
-  int -> (* N *)
-  int -> (* KL *)
-  int -> (* KU *)
-  char -> (* TRANS *)
-  float -> (* ALPHA *)
-  float -> (* BETA *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECgbmv_stub_bc" "lacaml_NPRECgbmv_stub"
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  m : int ->
+  n : int ->
+  kl : int ->
+  ku : int ->
+  trans : char ->
+  alpha : float ->
+  beta : float ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECgbmv_stub_bc" "lacaml_NPRECgbmv_stub"
 
 let gbmv ?m ?n ?(beta = 0.0) ?ofsy ?incy ?y ?(trans = `N) ?(alpha = 1.0)
       ?(ar = 1) ?(ac = 1) a kl ku ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.gbmv" in
-  check_var_ltz loc "kl" kl;
-  check_var_ltz loc "ku" ku;
-  let m, n, ofsx, incx, ofsy, incy, y, trans_char =
+  check_var_ltz loc kl_str kl;
+  check_var_ltz loc ku_str ku;
+  let m, n, ofsx, incx, ofsy, incy, y, trans =
     gXmv_get_params loc Vec.make0 ar ac a m n ofsx incx x ofsy incy y trans in
   let min_dim1 = kl + ku + 1 in
   if min_dim1 > m then
     invalid_arg (sprintf "%s: m: valid=[%d..[ got=%d" loc min_dim1 m);
-  direct_gbmv ofsy incy y ar ac a m n kl ku trans_char alpha beta ofsx incx x;
+  direct_gbmv
+    ~ofsy ~incy ~y ~ar ~ac ~a ~m ~n ~kl ~ku ~trans ~alpha ~beta ~ofsx ~incx ~x;
   y
 
 
 (* SYMV *)
 
 external direct_symv :
-  int -> (* OFSY *)
-  int -> (* INCY *)
-  vec -> (* Y *)
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int -> (* N *)
-  char -> (* TRANS *)
-  float -> (* ALPHA *)
-  float -> (* BETA *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECsymv_stub_bc" "lacaml_NPRECsymv_stub"
+  ofsy : int ->
+  incy : int ->
+  y : vec ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  n : int ->
+  uplo : char ->
+  alpha : float ->
+  beta : float ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECsymv_stub_bc" "lacaml_NPRECsymv_stub"
 
 let symv ?n ?(beta = 0.0) ?ofsy ?incy ?y ?(up = true) ?(alpha = 1.0)
       ?(ar = 1) ?(ac = 1) a ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.symv" in
-  let n, ofsx, incx, ofsy, incy, y, uplo_char =
+  let n, ofsx, incx, ofsy, incy, y, uplo =
     symv_get_params loc Vec.make0 ar ac a n ofsx incx x ofsy incy y up in
-  direct_symv ofsy incy y ar ac a n uplo_char alpha beta ofsx incx x;
+  direct_symv ~ofsy ~incy ~y ~ar ~ac ~a ~n ~uplo ~alpha ~beta ~ofsx ~incx ~x;
   y
 
 
 (* TRMV *)
 
 external direct_trmv :
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int -> (* N *)
-  char -> (* UPLO *)
-  char -> (* TRANS *)
-  char -> (* DIAG *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECtrmv_stub_bc" "lacaml_NPRECtrmv_stub"
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  n : int ->
+  uplo : char ->
+  trans : char ->
+  diag : char ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECtrmv_stub_bc" "lacaml_NPRECtrmv_stub"
 
 let trmv
       ?n ?(trans = `N) ?(diag = `N) ?(up = true)
       ?(ar = 1) ?(ac = 1) a ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.trmv" in
-  let n, ofsx, incx, uplo_char, trans_char, diag_char =
+  let n, ofsx, incx, uplo, trans, diag =
     trXv_get_params loc ar ac a n ofsx incx x up trans diag
   in
-  direct_trmv ar ac a n uplo_char trans_char diag_char ofsx incx x
+  direct_trmv ~ar ~ac ~a ~n ~uplo ~trans ~diag ~ofsx ~incx ~x
 
 
 (* TRSV *)
 
 external direct_trsv :
-  int -> (* AR *)
-  int -> (* AC *)
-  mat -> (* A *)
-  int -> (* N *)
-  char -> (* UPLO *)
-  char -> (* TRANS *)
-  char -> (* DIAG *)
-  int -> (* OFSX *)
-  int -> (* INCX *)
-  vec (* X *)
-  -> unit = "lacaml_NPRECtrsv_stub_bc" "lacaml_NPRECtrsv_stub"
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  n : int ->
+  uplo : char ->
+  trans : char ->
+  diag : char ->
+  ofsx : int ->
+  incx : int ->
+  x : vec ->
+  unit = "lacaml_NPRECtrsv_stub_bc" "lacaml_NPRECtrsv_stub"
 
 let trsv
       ?n ?(trans = `N) ?(diag = `N) ?(up = true)
       ?(ar = 1) ?(ac = 1) a ?ofsx ?incx x =
   let loc = "Lacaml.Impl.NPREC.trsv" in
-  let n, ofsx, incx, uplo_char, trans_char, diag_char =
+  let n, ofsx, incx, uplo, trans, diag =
     trXv_get_params loc ar ac a n ofsx incx x up trans diag
   in
-  direct_trsv ar ac a n uplo_char trans_char diag_char ofsx incx x
+  direct_trsv ~ar ~ac ~a ~n ~uplo ~trans ~diag ~ofsx ~incx ~x