Markus Mottl avatar Markus Mottl committed 46a32ff

Fixed unintuitive potri/potrs behavior

Comments (0)

Files changed (5)

+2008-09-08:  !!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!!
+
+             potri and potrs now implicitly call potrf by default!
+             This will break previous code depending on these functions,
+             but should be trivial to fix.  This change was deemed
+             necessary, because otherwise switching between sytri/potri
+             and sytrs/potrs would cause surprises: the purely symmetric
+             functions do already implicitly call the factorization
+             unless a default parameter (ipiv) is overridden.
+
+             Sorry for the inconvenience.
+
 2008-07-21:  Generalized Mat.transpose to support specifying sub-matrices.
 
 2008-04-23:  Fixed a parameter checking bug for syevr-related functions.
-release-4-3-3
+release-4-4-0
 name="lacaml"
-version="4.3.3"
+version="4.4.0"
 description="LACAML - BLAS/LAPACK-interface for OCaml"
 
 requires="lacaml.core"
   mat (* B *)
   -> int = "lacaml_NPRECpotrs_stub_bc" "lacaml_NPRECpotrs_stub"
 
-let potrs ?n ?(up = true) ?(ar = 1) ?(ac = 1) a ?nrhs ?(br = 1) ?(bc = 1) b =
+let potrs
+      ?n ?(up = true) ?(ar = 1) ?(ac = 1) a ?nrhs ?(br = 1) ?(bc = 1)
+      ?(factorize = true) b =
   let loc = "Lacaml.Impl.NPREC.potrs" in
   let uplo_char = get_uplo_char up in
   let n, nrhs = xxtrs_get_params loc ar ac a n br bc b nrhs in
+  if factorize then potrf ~n ~up ~ar ~ac a;
   let info = direct_potrs uplo_char n nrhs ar ac a br bc b in
   if info <> 0 then potrs_err loc n nrhs a b info
 
   mat (* A *)
   -> int = "lacaml_NPRECpotri_stub"
 
-let potri ?n ?(up = true) ?(ar = 1) ?(ac = 1) a =
+let potri ?n ?(up = true) ?(ar = 1) ?(ac = 1) ?(factorize = true) a =
   let loc = "Lacaml.Impl.NPREC.potri" in
   let n = get_n_of_a loc ar ac a n in
   let uplo_char = get_uplo_char up in
+  if factorize then potrf ~n ~up ~ar ~ac a;
   let info = direct_potri uplo_char n ar ac a in
   if info <> 0 then
     if info > 0 then xxtri_lu_err loc info

lib/impl_SDCZ.mli

   ?nrhs : int ->
   ?br : int ->
   ?bc : int ->
+  ?factorize : bool ->
   mat
   -> unit
-(** [potrs ?n ?up ?ar ?ac a ?nrhs ?br ?bc b]
+(** [potrs ?n ?up ?ar ?ac a ?nrhs ?br ?bc ?factorize b]
     @raise Failure if the matrix is singular.
     @param n default = number of columns in matrix [a]
     @param up default = true
     @param ac default = 1
     @param nrhs default = available number of columns in matrix [b]
     @param br default = 1
-    @param bc default = 1 *)
+    @param bc default = 1
+    @param factorize default = true (calls potrf implicitly) *)
 
 val potri :
   ?n : int ->
   ?up : bool ->
   ?ar : int ->
   ?ac : int ->
+  ?factorize : bool ->
   mat
   -> unit
-(** [potri ?n ?up ?ar ?ac a]
+(** [potri ?n ?up ?ar ?ac ?factorize a]
     @raise Failure if the matrix is singular.
     @param n default = number of columns in matrix [a]
     @param up default = true (upper triangel stored in [a])
     @param ar default = 1
-    @param ac default = 1 *)
+    @param ac default = 1
+    @param factorize default = true (calls potrf implicitly) *)
 
 (** Linear equations (simple drivers) *)
 
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.