Markus Mottl avatar Markus Mottl committed 00aaad9

Added trmv BLAS-function

Comments (0)

Files changed (9)

+2008-04-11:  Added new BLAS function:
+
+               * trmv
+
+             Thanks to Martin Willensdorfer <ma.wi@gmx.at> for the patch!
+
 2008-02-13:  Fixed a bug when implicitly allocating result matrices
              with user-specified offsets.  It may cause segfaults and
              affects many functions (though it is presumably very rarely
              packed into a separate namespace (Lacaml), and the previously
              visible Lacaml-module is now called "Impl".
 
-2007-12-27:  Added new LAPACK function:
+2007-12-27:  Added new BLAS function:
 
                * symv
 
 OCAMLPACKS = bigarray
 
-.SUBDIRS: lib examples
+Subdirs()
-release-4-3-0
+release-4-3-1
 name="lacaml"
-version="4.3.0"
+version="4.3.1"
 description="LACAML - BLAS/LAPACK-interface for OCaml"
 
 requires="lacaml.core"
   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"
+
+let trmv
+      ?n ?(trans = `N) ?(unit_triangular = false) ?(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 =
+    trmv_get_params loc ar ac a n ofsx incx x up trans unit_triangular in
+  direct_trmv ar ac a n uplo_char trans_char diag_char ofsx incx x
+
+
 (* BLAS-3 *)
 
 (* GEMM *)

lib/impl_SDCZ.mli

     @param beta default = 0.0
     @param ofsy default = 1
     @param incy default = 1
-    @param y default = vect with minimal required length (see BLAS)
+    @param y default = vector with minimal required length (see BLAS)
     @param trans default = `N
     @param alpha default = 1.0
     @param ar default = 1
     @param beta default = 0.0
     @param ofsy default = 1
     @param incy default = 1
-    @param y default = vect with minimal required length (see BLAS)
+    @param y default = vector with minimal required length (see BLAS)
     @param up default = true (upper triangular portion of [a] is accessed)
     @param alpha default = 1.0
     @param ar default = 1
     @param ofsx default = 1
     @param incx default = 1 *)
 
+val trmv :
+  ?n : int ->
+  ?trans : trans3 ->
+  ?unit_triangular : bool ->
+  ?up : bool ->
+  ?ar : int ->
+  ?ac : int ->
+  mat ->
+  ?ofsx : int ->
+  ?incx : int ->
+  vec
+  -> unit
+(** [trmv ?n ?trans ?unit_triangular ?up ?ar ?ac a ?ofsx ?incx x]
+    see BLAS documentation!
+    @param n default = dimension of triangular matrix [a]
+    @param trans default = `N
+    @param unit_triangular default = false (not a unit triangular matrix)
+    @param up default = true (upper triangular portion of [a] is accessed)
+    @param ar default = 1
+    @param ac default = 1
+    @param ofsx default = 1
+    @param incx default = 1 *)
+
 
 (** {6 BLAS-3 interface} *)
 

lib/impl_SDCZ_c.c

 }
 
 
+/** TRMV */
+
+extern void FUN(trmv)(
+  char *UPLO,
+  char *TRANS,
+  char *DIAG,
+  integer *N,
+  NUMBER *A, integer *LDA,
+  NUMBER *X, integer *INCX);
+
+CAMLprim value LFUN(trmv_stub)(
+  value vAR,
+  value vAC,
+  value vA,
+  value vN,
+  value vUPLO,
+  value vTRANS,
+  value vDIAG,
+  value vOFSX, value vINCX, value vX)
+{
+  CAMLparam2(vA, vX);
+
+  char GET_INT(UPLO),
+       GET_INT(TRANS),
+       GET_INT(DIAG);
+
+  integer GET_INT(N),
+          GET_INT(INCX);
+
+  MAT_PARAMS(A);
+  VEC_PARAMS(X);
+
+  caml_enter_blocking_section();  /* Allow other threads */
+  FUN(trmv)(
+    &UPLO,
+    &TRANS,
+    &DIAG,
+    &N,
+    A_data, &rows_A,
+    X_data, &INCX);
+  caml_leave_blocking_section();  /* Disallow other threads */
+
+  CAMLreturn(Val_unit);
+}
+
+CAMLprim value LFUN(trmv_stub_bc)(value *argv, int argn)
+{
+  return
+    LFUN(trmv_stub)(
+      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
+      argv[7], argv[8], argv[9]);
+}
+
+
 /** TODO: SPMV */
 
-/** TODO: TRMV */
-
 /** TODO: TBMV */
 
 /** TODO: TPMV */
 (* Zero-sized dummy vector (int) *)
 let empty_int_vec = create_int_vec 0
 
+(* Char indicating if matrix is unit triangular *)
+let get_diag_char = function true -> 'U' | false -> 'N'
+
 (* Char indicating type of norm to retrieve for XlanYY routines *)
 let get_norm_char = function `M -> 'M' | `O -> 'O' | `I -> 'I' | `F -> 'F'
 
   check_vec loc y_str y (ofsy + (n - 1) * abs incy);
   n, ofsx, incx, ofsy, incy, y, get_uplo_char up
 
+(* trmv -- auxiliary functions *)
+let trmv_get_params loc ar ac a n ofsx incx x up trans unit_triangular =
+  let a_str = "a" in
+  let x_str = "x" in
+  let n_str = "n" in
+  let n = get_dim1_mat loc a_str a ar n_str n in
+  check_dim2_mat loc a_str a ac n_str n;
+  let trans_char = get_trans_char trans in
+  let diag_char = get_diag_char unit_triangular in
+  let ofsx, incx = get_vec_geom loc x_str ofsx incx in
+  check_vec loc x_str x (ofsx + (n - 1) * abs incx);
+  n, ofsx, incx, get_uplo_char up, trans_char, diag_char
+
 (* gemm -- auxiliary functions *)
 
 let get_c loc mat_create cr cc c m n = get_mat loc "c" mat_create cr cc c m n
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.