Markus Mottl avatar Markus Mottl committed fcad4e6

Fixed minimum work array size calculation for gesdd

Comments (0)

Files changed (1)

 let gesdd_min_lwork ?(jobz = `A) ~m ~n () =
   let min_lwork =
     let min_m_n = min m n in
-    let max_m_n = max m n in
     let min_m_n_3 = 3 * min_m_n in
-    match jobz with
-    | `N -> min_m_n_3 + max max_m_n (min_m_n_3 + min_m_n_3)
-    | `O ->
-        min_m_n_3 * min_m_n +
-          max max_m_n (5*min_m_n*min_m_n + (min_m_n_3 + min_m_n))
-    | `S | `A ->
-        min_m_n_3 * min_m_n +
-          max max_m_n ((min_m_n_3 + min_m_n) * (min_m_n + 1)) in
+    let arg =
+      match jobz with
+      | `N -> 7
+      | `O -> 5 * min_m_n + 4
+      | `S | `A -> 4 * (min_m_n + 1)
+    in
+    min_m_n_3 + max (max m n) (arg * min_m_n)
+  in
   max 1 min_lwork
 
 let gesdd_liwork ~m ~n = 8 * min 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.