[Returnanalytics-commits] r3121 - in pkg/PortfolioAnalytics: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 16 22:01:00 CEST 2013


Author: rossbennett34
Date: 2013-09-16 22:01:00 +0200 (Mon, 16 Sep 2013)
New Revision: 3121

Modified:
   pkg/PortfolioAnalytics/DESCRIPTION
   pkg/PortfolioAnalytics/R/optFUN.R
Log:
Adding corpcor require to optFUN and to the depends list in NAMESPACE.

Modified: pkg/PortfolioAnalytics/DESCRIPTION
===================================================================
--- pkg/PortfolioAnalytics/DESCRIPTION	2013-09-16 19:54:19 UTC (rev 3120)
+++ pkg/PortfolioAnalytics/DESCRIPTION	2013-09-16 20:01:00 UTC (rev 3121)
@@ -25,7 +25,8 @@
     ROI.plugin.glpk,
     ROI.plugin.quadprog,
     pso,
-    GenSA
+    GenSA,
+    corpcor
 License: GPL
 Copyright: (c) 2004-2012
 Collate:

Modified: pkg/PortfolioAnalytics/R/optFUN.R
===================================================================
--- pkg/PortfolioAnalytics/R/optFUN.R	2013-09-16 19:54:19 UTC (rev 3120)
+++ pkg/PortfolioAnalytics/R/optFUN.R	2013-09-16 20:01:00 UTC (rev 3121)
@@ -561,6 +561,7 @@
   
   d <- rep(-moments$mean, 3)
   
+  stopifnot("package:corpcor" %in% search() || require("foreach",quietly = TRUE))
   qp.result <- try(solve.QP(Dmat=make.positive.definite(2*lambda*V), 
                             dvec=d, Amat=t(Amat), bvec=rhs, meq=meq), silent=TRUE)
   if(inherits(qp.result, "try-error")) stop("No solution found, consider adjusting constraints.")
@@ -672,7 +673,8 @@
   
   d <- rep(-moments$mean, 3)
   
-  qp.result <- try(solve.QP(Dmat=corpcor:::make.positive.definite(2*lambda*V), 
+  stopifnot("package:corpcor" %in% search() || require("foreach",quietly = TRUE))
+  qp.result <- try(solve.QP(Dmat=make.positive.definite(2*lambda*V), 
                             dvec=d, Amat=t(Amat), bvec=rhs, meq=meq), silent=TRUE)
   if(inherits(qp.result, "try-error")) stop("No solution found, consider adjusting constraints.")
   



More information about the Returnanalytics-commits mailing list