[Yuima-commits] r117 - in pkg/yuima: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 23 15:04:02 CEST 2010


Author: iacus
Date: 2010-07-23 15:04:02 +0200 (Fri, 23 Jul 2010)
New Revision: 117

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/NEWS
   pkg/yuima/R/toLatex.R
Log:
fixed toLatex output

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2010-07-21 03:16:35 UTC (rev 116)
+++ pkg/yuima/DESCRIPTION	2010-07-23 13:04:02 UTC (rev 117)
@@ -1,8 +1,8 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project package (unstable version)
-Version: 0.1.08
-Date: 2010-07-20
+Version: 0.1.09
+Date: 2010-07-23
 Depends: methods, zoo, stats4, utils
 Suggests: cubature, mvtnorm
 Author: YUIMA Project Team.

Modified: pkg/yuima/NEWS
===================================================================
--- pkg/yuima/NEWS	2010-07-21 03:16:35 UTC (rev 116)
+++ pkg/yuima/NEWS	2010-07-23 13:04:02 UTC (rev 117)
@@ -1,3 +1,7 @@
+Changes in Version 0.1.09
+
+  o fixed toLatex() output for diffusion matrix
+
 Changes in Version 0.1.08
 
   o added CPoint() for change point estimation

Modified: pkg/yuima/R/toLatex.R
===================================================================
--- pkg/yuima/R/toLatex.R	2010-07-21 03:16:35 UTC (rev 116)
+++ pkg/yuima/R/toLatex.R	2010-07-23 13:04:02 UTC (rev 117)
@@ -1,73 +1,58 @@
 
-toLatex.yuima <- function(object,...){
-	mod <- NULL
-	if(class(object)=="yuima.model") mod <- object
-	if(class(object)=="yuima") mod <- object at model
- 	n.eq <- mod at equation.number
-	dr <- paste("\\left(\\begin{array}{c}\n")
+toLatex.yuima <- function (object, ...) 
+{
+    mod <- NULL
+    if (class(object) == "yuima.model") 
+	mod <- object
+    if (class(object) == "yuima") 
+	mod <- object at model
+    n.eq <- mod at equation.number
+    dr <- paste("\\left(\\begin{array}{c}\n")
+    for (i in 1:n.eq) {
+        dr <- paste(dr, substr(mod at drift[i], 2, nchar(mod at drift[i]) - 
+							   1), "\\\\ \n")
+    }
+    dr <- paste(dr, "\\end{array}\\right)", sprintf("d%s", mod at time.variable))
+    n.n <- mod at noise.number
+    df <- paste(sprintf("\\left[\\begin{array}{%s}\n",paste(rep("c",n.n),sep="",collapse="")))
+    for (i in 1:n.eq) {
+        df <- paste(df, paste(mod at diffusion[[i]], collapse = "&"))
+        df <- paste(df, "\\\\ \n")
+    }
+    df <- paste(df, "\\end{array}\\right]")
+    wn <- paste("\\left(\\begin{array}{c}\n")
+    wn <- paste(wn, paste(sprintf("dW%s", 1:n.n), sep = "", collapse = "\\\\ "))
+    wn <- paste(wn, "\n \\end{array}\\right)")
+    st <- paste("\\left(\\begin{array}{c}\n")
+    st <- paste(st, paste(sprintf("d%s", mod at solve.variable), 
+						  sep = "", collapse = "\\\\ "))
+    st <- paste(st, "\n \\end{array}\\right)")
+    mysymb <- c("*", "alpha", "beta", "gamma", "delta", "rho", 
+				"theta", "sqrt")
+    myrepl <- c(" \\cdot ", "\\alpha ", "\\beta ", "\\gamma ", 
+				"\\delta ", "\\rho ", "\\theta ", "\\sqrt ")
+    ns <- length(mysymb)
+    for (i in 1:ns) {
+        dr <- gsub(mysymb[i], myrepl[i], dr, fixed = "TRUE")
+        df <- gsub(mysymb[i], myrepl[i], df, fixed = "TRUE")
+    }
+    body <- paste("%%% Copy and paste the following output in your LaTeX file")
+    body <- body <- c(body, paste("$$"))
+    body <- c(body, paste(st))
+    body <- c(body, paste(" = "))
+    body <- c(body, paste(dr))
+    body <- c(body, paste(" +"))
+    body <- c(body, paste(df))
+    body <- c(body, paste("'"))
+    body <- c(body, paste(wn))
+    body <- c(body, paste("$$"))
+    body <- c(body, paste("$$"))
+    body <- c(body, paste(sprintf("%s(0)=%f,\\quad", mod at solve.variable, 
+								  mod at xinit)))
+    body <- c(body, paste("$$"))
+    structure(body, class = "Latex")
+}
 
-	for(i in 1:n.eq){
-		dr <- paste(dr, substr(mod at drift[i],2,nchar(mod at drift[i])-1), "\\\\ \n")
-	}
-	dr <- paste(dr, "\\end{array}\\right)", sprintf("d%s",mod at time.variable))
 
-	
-	df <- paste("\\left(\\begin{array}{c}\n")
-	
-	for(i in 1:n.eq){
-	  df <- paste(df, paste(mod at diffusion[[i]],collapse="+"))
-		
-	 
-	df <- paste(df, "\\\\ \n")
-        }
-	df <- paste(df, "\\end{array}\\right)")
 
-	n.n <- mod at noise.number
-	wn <- paste("\\left(\\begin{array}{c}\n")
-	wn <- paste(wn, paste(sprintf("dW%s",1:n.n), sep="", collapse="\\\\ "))
-	wn <- paste(wn, "\n \\end{array}\\right)")
-
-	st <- paste("\\left(\\begin{array}{c}\n")
-	st <- paste(st, paste(sprintf("d%s",mod at solve.variable), sep="", collapse="\\\\ "))
-	st <- paste(st, "\n \\end{array}\\right)")
-
-	mysymb <- c("*", "alpha", "beta", "gamma", "delta","rho","theta","sqrt")
-	myrepl<- c(" \\cdot ", "\\alpha ", "\\beta ", "\\gamma ", "\\delta ","\\rho ", "\\theta ", "\\sqrt ")
-	ns <- length(mysymb)
-
-	for(i in 1:ns){
- 		dr <- gsub( mysymb[i], myrepl[i] , dr ,fixed="TRUE")
-		df <- gsub( mysymb[i], myrepl[i] , df ,fixed="TRUE")
-	}
-
-#	cat("$$\n")
-#	cat(st)
-#	cat("\n = \n")
-#	cat(dr)
-#	cat("\n +\n")
-#	cat(df)
-#	cat("'\n")
-#	cat(wn)
-#	cat("\n $$\n")
-#	cat("$$\n")
-#	cat(sprintf("%s(0)=%f,\\quad",mod at solve.variable,mod at xinit))
-#	cat("\n $$\n")
-
-	body <- paste("%%% Copy and paste the following output in your LaTeX file")
-	body <- body <- c(body,paste("$$"))
-	body <- c(body, paste(st))
-	body <- c(body, paste(" = "))
-	body <- c(body, paste(dr))
-	body <- c(body, paste(" +"))
-	body <- c(body, paste(df))
-	body <- c(body, paste("'"))
-	body <- c(body, paste(wn))
-	body <- c(body, paste("$$"))
-	body <- c(body, paste("$$"))
-	body <- c(body, paste(sprintf("%s(0)=%f,\\quad",mod at solve.variable,mod at xinit)))
-	body <- c(body, paste("$$"))
-	
-	structure(body, class="Latex")
-}
-
 toLatex.yuima.model <- toLatex.yuima 



More information about the Yuima-commits mailing list