[Distr-commits] r112 - pkg/distrMod/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 1 13:22:54 CEST 2008


Author: ruckdeschel
Date: 2008-04-01 13:22:54 +0200 (Tue, 01 Apr 2008)
New Revision: 112

Modified:
   pkg/distrMod/R/solve.R
Log:
minor "cosmetic" change in solve

Modified: pkg/distrMod/R/solve.R
===================================================================
--- pkg/distrMod/R/solve.R	2008-04-01 10:36:01 UTC (rev 111)
+++ pkg/distrMod/R/solve.R	2008-04-01 11:22:54 UTC (rev 112)
@@ -2,16 +2,16 @@
           tol = .Machine$double.eps, ...) {if(!generalized) return(base::solve(a,b, tol = tol, ...))
           else if(is(try(return(base::solve(a,b, tol = tol, ...)), silent = TRUE),
                                         "try-error")){
+             if (!missing(b))
+                if(!(length(b)==nrow(a))) stop("non-conformable arguments")
              a.svd <- svd(a)
              d1 <- a.svd$d
              d1.0 <- (d1 < tol) + 0.0
              d1.1 <- 1/pmax(d1, d1.0)
              d <- (1-d1.0) * d1.1
-             d <- if (length(d)==1) d else diag(d)
+             d <- if (length(d) == 1) d else diag(d)
              a.m <- a.svd$v %*% d %*% t(a.svd$u)
-             if (!missing(b))
-                if(!(length(b)==nrow(a))) stop("non-conformable arguments")
-             erg <- if (missing(b)) a.m else a.m%*%b
+             erg <- if (missing(b)) a.m else a.m %*% b
              return(erg)}
              }
              )
@@ -24,7 +24,7 @@
             d1.0 <- (d1 < tol) + 0.0
             d1.1 <- 1/pmax(d1, d1.0)
             d <- (1-d1.0) * d1.1
-            d <- if (length(d)==1) d else diag(d)
+            d <- if (length(d) == 1) d else diag(d)
             A <- er$vectors %*% d %*% t(er$vectors)
             if(missing(b)) return(A)
             else return(A%*%b)}



More information about the Distr-commits mailing list