[Distr-commits] r104 - in pkg/distrMod: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 27 19:41:21 CET 2008


Author: stamats
Date: 2008-02-27 19:41:21 +0100 (Wed, 27 Feb 2008)
New Revision: 104

Modified:
   pkg/distrMod/R/PosDefSymmMatrix.R
   pkg/distrMod/man/PosDefSymmMatrix.Rd
Log:
extended generating function for PosSemDefSymmMatrix to accept object of class PosDefSymmMatrix

Modified: pkg/distrMod/R/PosDefSymmMatrix.R
===================================================================
--- pkg/distrMod/R/PosDefSymmMatrix.R	2008-02-27 18:40:26 UTC (rev 103)
+++ pkg/distrMod/R/PosDefSymmMatrix.R	2008-02-27 18:41:21 UTC (rev 104)
@@ -1,5 +1,6 @@
 # generating function for class 'PosDefSymmMatrix'
-PosSemDefSymmMatrix <- function(mat){ 
+PosSemDefSymmMatrix <- function(mat){
+    if(is(mat, "PosDefSymmMatrix")) return(as(mat, "PosSemDefSymmMatrix"))
     if(!is.matrix(mat)) mat <- as.matrix(mat)
     new("PosSemDefSymmMatrix", mat)
 }

Modified: pkg/distrMod/man/PosDefSymmMatrix.Rd
===================================================================
--- pkg/distrMod/man/PosDefSymmMatrix.Rd	2008-02-27 18:40:26 UTC (rev 103)
+++ pkg/distrMod/man/PosDefSymmMatrix.Rd	2008-02-27 18:41:21 UTC (rev 104)
@@ -24,18 +24,7 @@
 PosSemDefSymmMatrix(diag(2))
 PosDefSymmMatrix(1)
 PosDefSymmMatrix(diag(2))
-
-## The functions are currently defined as
-function(mat){ 
-    if(!is.matrix(mat)) mat <- as.matrix(mat)
-    new("PosSemDefSymmMatrix", mat)
 }
-#resp.
-function(mat){ 
-    if(!is.matrix(mat)) mat <- as.matrix(mat)
-    new("PosDefSymmMatrix", mat)
-}
-}
 \concept{positive-semi-definite matrix}
 \concept{positive-definite matrix}
 \concept{symmetric matrix}



More information about the Distr-commits mailing list