Markus Mottl avatar Markus Mottl committed d424edd

Added trsm

Comments (0)

Files changed (5)

 2009-09-21:  Added new functions:
 
                * ormqr
+               * trsm
                * Mat.scal_rows
 
 2009-09-16:  Added new functions:
       ?(br = 1) ?(bc = 1) ~b ?(alpha = one) ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.NPREC.trmm" in
   let m, n, side, uplo, trans, diag =
-    trmm_get_params loc ar ac a br bc b m n side up trans diag
+    trXm_get_params loc ar ac a br bc b m n side up trans diag
   in
   direct_trmm ~side ~uplo ~trans ~diag ~m ~n ~ar ~ac ~a ~br ~bc ~b ~alpha
 
 
+(* TRSM *)
+
+external direct_trsm :
+  side : char ->
+  uplo : char ->
+  trans : char ->
+  diag : char ->
+  m : int ->
+  n : int ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  br : int ->
+  bc : int ->
+  b : mat ->
+  alpha : num_type ->
+  unit = "lacaml_NPRECtrsm_stub_bc" "lacaml_NPRECtrsm_stub"
+
+let trsm ?m ?n ?(side = `L) ?(up = true) ?(trans = `N) ?(diag = `N)
+      ?(alpha = one) ?(ar = 1) ?(ac = 1) ~a ?(br = 1) ?(bc = 1) b =
+  let loc = "Lacaml.Impl.NPREC.trsm" in
+  let m, n, side, uplo, trans, diag =
+    trXm_get_params loc ar ac a br bc b m n side up trans diag
+  in
+  direct_trsm ~side ~uplo ~trans ~diag ~m ~n ~ar ~ac ~a ~br ~bc ~b ~alpha
+
+
 (* SYRK *)
 
 external direct_syrk :

lib/impl_SDCZ.mli

   unit
 (** [trmm ?m ?n ?side ?up ?trans ?diag ?br ?bc ~b ?alpha ?ar ?ac a]
     see BLAS documentation!
-    @return matrix [c], which is overwritten.
-    @param m default = number of rows of [c]
-    @param n default = number of columns of [c]
+    @param m default = number of rows of [b]
+    @param n default = number of columns of [b]
+    @param side default = `L (left - multiplication is [a][b])
+    @param up default = true (upper triangular portion of [a] is accessed)
+    @param trans default = `N
+    @param diag default = `N (non-unit)
+    @param alpha default = [{ re = 1.; im = 0. }]
+    @param ar default = 1
+    @param ac default = 1
+    @param br default = 1
+    @param bc default = 1 *)
+
+val trsm :
+  ?m : int ->
+  ?n : int ->
+  ?side : side ->
+  ?up : bool ->
+  ?trans : trans3 ->
+  ?diag : diag ->
+  ?alpha : num_type ->
+  ?ar : int ->
+  ?ac : int ->
+  a : mat ->
+  ?br : int ->
+  ?bc : int ->
+  mat ->
+  unit
+(** [trsm ?m ?n ?side ?up ?trans ?diag ?alpha ?ar ?ac ~a ?br ?bc b]
+    see BLAS documentation!
+    @return matrix [b], which is overwritten.
+    @param m default = number of rows of [b]
+    @param n default = number of columns of [b]
     @param side default = `L (left - multiplication is [a][b])
     @param up default = true (upper triangular portion of [a] is accessed)
     @param trans default = `N

lib/impl_SDCZ_c.c

       argv[7], argv[8], argv[9], argv[10], argv[11], argv[12]);
 }
 
+/** TRSM */
+
+extern void FUN(trsm)(
+  char *SIDE, char *UPLO, char *TRANS, char *DIAG,
+  integer *M, integer *N,
+  NUMBER *ALPHA,
+  NUMBER *A, integer *LDA,
+  NUMBER *B, integer *LDB);
+
+CAMLprim value LFUN(trsm_stub)(
+  value vSIDE, value vUPLO, value vTRANS, value vDIAG,
+  value vM, value vN,
+  value vAR, value vAC, value vA,
+  value vBR, value vBC, value vB,
+  value vALPHA)
+{
+  CAMLparam2(vA, vB);
+
+  char GET_INT(SIDE), GET_INT(UPLO), GET_INT(TRANS), GET_INT(DIAG);
+  integer GET_INT(M), GET_INT(N);
+
+  CREATE_NUMBER(ALPHA);
+
+  MAT_PARAMS(A);
+  MAT_PARAMS(B);
+
+  INIT_NUMBER(ALPHA);
+
+  caml_enter_blocking_section();  /* Allow other threads */
+  FUN(trsm)(
+    &SIDE, &UPLO, &TRANS, &DIAG,
+    &M, &N,
+    &ALPHA,
+    A_data, &rows_A,
+    B_data, &rows_B);
+  caml_leave_blocking_section();  /* Disallow other threads */
+
+  CAMLreturn(Val_unit);
+}
+
+CAMLprim value LFUN(trsm_stub_bc)(value *argv, int argn)
+{
+  return
+    LFUN(trsm_stub)(
+      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
+      argv[7], argv[8], argv[9], argv[10], argv[11], argv[12]);
+}
+
 /** SYRK */
 
 extern void FUN(syrk)(
 
 (* trmm -- auxiliary functions *)
 
-let trmm_get_params loc ar ac a br bc b m n side up transa diag =
+let trXm_get_params loc ar ac a br bc b m n side up transa diag =
   let m = get_dim1_mat loc b_str b br m_str m in
   let n = get_dim2_mat loc b_str b bc n_str n in
   if side = `L then check_mat_square loc a_str a ar ac m
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.