Markus Mottl avatar Markus Mottl committed 27c7f3e

Added Mat.as_vec

Comments (0)

Files changed (4)

+2009-06-13:  Added new function:
+
+               * Mat.as_vec
+
 2009-06-12:  Added new function:
 
                * tbtrs  (all numbers)
 name="lacaml"
-version="5.4.0"
+version="5.4.1"
 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 as_vec mat =
+  let gen = genarray_of_array2 mat in
+  reshape_1 gen (dim1 mat * dim2 mat)
+
 let transpose ?m ?n ?(ar = 1) ?(ac = 1) a =
   let loc = "Lacaml.Impl.NPREC.Mat.transpose" in
   let m = get_dim1_mat loc a_str a ar m_str m in
 (** [to_col_vecs mat] @return an array of column vectors initialized
     from matrix [mat]. *)
 
+val as_vec : mat -> vec
+(** [as_vec mat] @return a vector containing all elements of the
+    matrix in column-major order.  The data is shared. *)
+
 val init_rows : int -> int -> (int -> int -> num_type) -> mat
 (** [init_cols m n f] @return a matrix containing [m] rows and [n]
     columns, where each element at [row] and [col] is initialized by the
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.