Browse code

fix for build error when the inverse algorithm does not converge

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ROntoTools@83801 bc3139a8-67e5-0310-9ffc-ced21a209358

Calin Voichita authored on 02/12/2013 15:06:43
Showing 2 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: ROntoTools
2 2
 Type: Package
3 3
 Title: R Onto-Tools suite
4
-Version: 1.3.0
4
+Version: 1.3.1
5 5
 Author: Calin Voichita <calin@wayne.edu> and Sorin Draghici <sorin@wayne.edu>
6 6
 Maintainer: Calin Voichita <calin@wayne.edu>
7 7
 Description: Suite of tools for functional analysis
... ...
@@ -241,8 +241,9 @@ compute.inverse <- function(M, eps = 1e-5)
241 241
 {
242 242
   if ( abs(det(M)) >= eps )
243 243
   {
244
-    s = svd(M);
245
-    inv = s$v %*% diag(1/s$d) %*% t(s$u)
244
+    inv = tryCatch(solve(M), error = function(e) NULL)
245
+    if (is.null(inv))
246
+      return(NULL)
246 247
     rownames(inv) <- colnames(inv) <- rownames(M)
247 248
     return(inv)
248 249
   }else{
... ...
@@ -269,4 +270,4 @@ compute.B <- function(g, non.zero = TRUE)
269 270
   return(B)
270 271
 }
271 272
 
272
-  
273 273
\ No newline at end of file
274
+