Markus Mottl avatar Markus Mottl committed 6b4e5c8

Updated Mat.transpose

Comments (0)

Files changed (5)

+2008-07-21:  Generalized Mat.transpose to support specifying sub-matrices.
+
 2008-04-23:  Fixed a parameter checking bug for syevr-related functions.
 
 2008-04-11:  Added new BLAS function:
-release-4-3-2
+release-4-3-3
 name="lacaml"
-version="4.3.2"
+version="4.3.3"
 description="LACAML - BLAS/LAPACK-interface for OCaml"
 
 requires="lacaml.core"
     for i = 2 to n do ar.(i - 1) <- col mat i done;
     ar
 
-let transpose mat =
-  let rows = dim1 mat in
-  let cols = dim2 mat in
-  let res = create cols rows in
-  for col = 1 to cols do
-    for row = 1 to rows do res.{col, row} <- mat.{row, col} done
+let transpose ?m ?n ?(ar = 1) ?(ac = 1) a =
+  let loc = "Lacaml.Impl.NPREC.Mat.transpose" in
+  let x_name = "a" in
+  let m = get_dim1_mat loc x_name a ar "m" m in
+  let n = get_dim2_mat loc x_name a ac "n" n in
+  let res = create n m in
+  for col = 1 to n do
+    for row = 1 to m do res.{col, row} <- a.{ar + row - 1, ac + col - 1} done
   done;
   res
 
 
 (** {6 Matrix transformations} *)
 
-val transpose : mat -> mat
-(** [transpose m] @return the transpose of matrix [m]. *)
+val transpose : ?m : int -> ?n : int -> ?ar : int -> ?ac : int -> mat -> mat
+(** [transpose a] @return the transpose of matrix [a]. *)
 
 val detri : ?up : bool -> ?ar : int -> ?ac : int -> ?n : int -> mat -> unit
 (** [detri ?up ?ar ?ac ?n a] takes a triangular (sub-)matrix [a], i.e. one
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.