Markus Mottl avatar Markus Mottl committed 45eb706

Added Mat.scal_rows

Comments (0)

Files changed (4)

 2009-09-21:  Added new functions:
 
                * ormqr
+               * Mat.scal_rows
 
 2009-09-16:  Added new functions:
 
   ignore (get_dim_vec loc alphas_str ofs 1 alphas n_str (Some n));
   direct_scal_cols ~m ~n ~ar ~ac ~a ~ofs ~alphas
 
+external direct_scal_rows :
+  m : int ->
+  n : int ->
+  ofs : int ->
+  alphas : vec ->
+  ar : int ->
+  ac : int ->
+  a : mat ->
+  unit = "lacaml_NPRECscal_rows_stub_bc" "lacaml_NPRECscal_rows_stub"
+
+let scal_rows ?m ?n ?ofs alphas ?(ar = 1) ?(ac = 1) a =
+  let loc = "Lacaml.Impl.NPREC.Mat.scal_rows" in
+  let m = get_dim1_mat loc a_str a ar m_str m in
+  let n = get_dim2_mat loc a_str a ac n_str n in
+  let ofs = get_ofs loc alphas_str ofs in
+  ignore (get_dim_vec loc alphas_str ofs 1 alphas n_str (Some m));
+  direct_scal_rows ~m ~n ~ofs ~alphas ~ar ~ac ~a
+
 external direct_mat_axpy :
   m : int ->
   n : int ->
 (** [scal_cols ?m ?n ?ar ?ac a ?ofs alphas] column-wise [scal]
     function for matrices. *)
 
+val scal_rows :
+  ?m : int -> ?n : int ->
+  ?ofs : int -> vec ->
+  ?ar : int -> ?ac : int -> mat ->
+  unit
+(** [scal_rows ?m ?n ?ofs alphas ?ar ?ac a] row-wise [scal]
+    function for matrices. *)
+
 val axpy :
   ?m : int ->
   ?n : int ->
 }
 
 
+/* scal_rows */
+
+CAMLprim value LFUN(scal_rows_stub)(
+  value vM, value vN,
+  value vOFSALPHAs, value vALPHAs,
+  value vAR, value vAC, value vA)
+{
+  CAMLparam2(vALPHAs, vA);
+  integer GET_INT(M), GET_INT(N);
+
+  if (M > 0 && N > 0) {
+    VEC_PARAMS(ALPHAs);
+    MAT_PARAMS(A);
+    NUMBER *A_last = A_data + M;
+    caml_enter_blocking_section();
+      do {
+        FUN(scal)(&N, ALPHAs_data, A_data, &rows_A);
+        A_data++;
+        ALPHAs_data++;
+      } while (A_data != A_last);
+    caml_leave_blocking_section();
+  }
+
+  CAMLreturn(Val_unit);
+}
+
+CAMLprim value LFUN(scal_rows_stub_bc)(value *argv, int argn)
+{
+  return LFUN(scal_rows_stub)(
+    argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
+}
+
+
 /* mat_axpy */
 
 extern void FUN(axpy)(
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.