[Distr-commits] r500 - branches/distr-2.2/pkg/distrMod/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 2 15:21:38 CEST 2009


Author: stamats
Date: 2009-07-02 15:21:37 +0200 (Thu, 02 Jul 2009)
New Revision: 500

Modified:
   branches/distr-2.2/pkg/distrMod/R/AllClass.R
Log:
small correction needed for case trafo in R^(1 x k)

Modified: branches/distr-2.2/pkg/distrMod/R/AllClass.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/AllClass.R	2009-07-02 00:38:13 UTC (rev 499)
+++ branches/distr-2.2/pkg/distrMod/R/AllClass.R	2009-07-02 13:21:37 UTC (rev 500)
@@ -30,7 +30,12 @@
 
 
 ## norms to be used in prototype already
-EuclideanNorm <- function(x) sqrt(colSums(x^2))
+EuclideanNorm <- function(x){ 
+    if(is.vector(x)) 
+        return(abs(x))
+    else 
+        return(sqrt(colSums(x^2)))
+}
 QuadFormNorm <- function(x, A) sqrt(colSums(x*(A %*% x)))
 
 ################################



More information about the Distr-commits mailing list