[Depmix-commits] r500 - in pkg/depmixS4: . R src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Nov 1 12:56:53 CET 2011
Author: ingmarvisser
Date: 2011-11-01 12:56:53 +0100 (Tue, 01 Nov 2011)
New Revision: 500
Removed:
pkg/depmixS4/src/ddens.cc
pkg/depmixS4/src/ddens.h
Modified:
pkg/depmixS4/DESCRIPTION
pkg/depmixS4/NEWS
pkg/depmixS4/R/fb.R
pkg/depmixS4/R/logLik.R
Log:
Updated NEWS file with version 1.1-0 info; removed ddens code as it does not provide any speed improvements.
Modified: pkg/depmixS4/DESCRIPTION
===================================================================
--- pkg/depmixS4/DESCRIPTION 2011-10-27 13:34:56 UTC (rev 499)
+++ pkg/depmixS4/DESCRIPTION 2011-11-01 11:56:53 UTC (rev 500)
@@ -1,6 +1,6 @@
Package: depmixS4
Version: 1.1-0
-Date: 2011-09-01
+Date: 2011-11-01
Title: Dependent Mixture Models - Hidden Markov Models of GLMs and Other Distributions in S4
Author: Ingmar Visser <i.visser at uva.nl>, Maarten Speekenbrink <m.speekenbrink at ucl.ac.uk>
Maintainer: Ingmar Visser <i.visser at uva.nl>
Modified: pkg/depmixS4/NEWS
===================================================================
--- pkg/depmixS4/NEWS 2011-10-27 13:34:56 UTC (rev 499)
+++ pkg/depmixS4/NEWS 2011-11-01 11:56:53 UTC (rev 500)
@@ -1,12 +1,20 @@
Changes in depmixS4 version 1.1-0
+
+ Major changes
+
+ o The main loop computing the forward and backward variables for use in
+ the EM algorithm is now implemented in C. Depending on model specifics
+ this results in a 2-4 fold speed increase when fitting models.
+ o The Changes for each release (in the NEWS file) is now split into two
+ sections: Major and Minor changes
+
+ Minor changes
+
o Corrected a typo in the vignette in Equation 1; the first occurrence
of S read S_t instead of S_1 (thanks to Peng Yu for reporting this).
- o
-
-
Changes in depmixS4 version 1.0-4
o Added examples of the use of ntimes argument on ?depmix and ?fit
Modified: pkg/depmixS4/R/fb.R
===================================================================
--- pkg/depmixS4/R/fb.R 2011-10-27 13:34:56 UTC (rev 499)
+++ pkg/depmixS4/R/fb.R 2011-11-01 11:56:53 UTC (rev 500)
@@ -22,18 +22,6 @@
nt <- nrow(B)
ns <- ncol(init)
-# print(head(B))
-#
-# bin <- array(0,dim=dim(B)[c(1,3)])
-# res <- .C("ddens",
-# as.double(B),
-# out=as.double(bin),
-# dim=dim(B),
-# package="depmixS4")[c("out")]
-# B <- matrix(res$out,nc=ns,byrow=TRUE)
-#
-# print(head(B))
-
B <- apply(B,c(1,3),prod)
if(is.null(ntimes)) ntimes <- nt
@@ -45,8 +33,9 @@
if(useC) {
alpha <- matrix(0,ncol=ns,nrow=nt)
- beta <- matrix(0,ncol=ns,nrow=nt)
sca <- rep(0,nt)
+
+ beta <- matrix(0,ncol=ns,nrow=nt)
xi <- array(0,dim=c(nt,ns,ns))
res <- .C("forwardbackward",
Modified: pkg/depmixS4/R/logLik.R
===================================================================
--- pkg/depmixS4/R/logLik.R 2011-10-27 13:34:56 UTC (rev 499)
+++ pkg/depmixS4/R/logLik.R 2011-11-01 11:56:53 UTC (rev 500)
@@ -3,7 +3,6 @@
function(object,method="lystig") {
if(method=="fb") ll <- fb(object at init,object at trDens,object at dens,object at ntimes,object at stationary)$logLike
if(method=="lystig") ll <- lystig(object at init,object at trDens,object at dens,object at ntimes,object at stationary)$logLike
- if(method=="Cfb") ll <- Cfb(object at init,object at trDens,object at dens,object at ntimes,object at stationary)$logLike
attr(ll, "df") <- freepars(object)
attr(ll, "nobs") <- nobs(object)
class(ll) <- "logLik"
@@ -16,7 +15,6 @@
function(object,method="lystig") {
if(method=="fb") ll <- fb(object at init,matrix(0,1,1),object at dens,object at ntimes,TRUE)$logLike
if(method=="lystig") ll <- lystig(object at init,matrix(0,1,1),object at dens,object at ntimes,TRUE)$logLike
- if(method=="Cfb") ll <- lystig(object at init,matrix(0,1,1),object at dens,object at ntimes,TRUE)$logLike
attr(ll, "df") <- freepars(object)
attr(ll, "nobs") <- nobs(object)
class(ll) <- "logLik"
Deleted: pkg/depmixS4/src/ddens.cc
===================================================================
--- pkg/depmixS4/src/ddens.cc 2011-10-27 13:34:56 UTC (rev 499)
+++ pkg/depmixS4/src/ddens.cc 2011-11-01 11:56:53 UTC (rev 500)
@@ -1,27 +0,0 @@
-#include "ddens.h"
-
-extern "C" {
-
-void ddens(double *dens, double *res, int *dim) {
-
-// Rprintf("dim 0: %d \n", dim[0]);
-// Rprintf("dim 1: %d \n", dim[1]);
-// Rprintf("dim 2: %d \n", dim[2]);
-
- for(int t=0; t<dim[0]; t++) {
-// Rprintf("t: %d \n", t);
- for(int i=0; i<dim[1]; i++) {
-// Rprintf("i: %d \n", i);
- res[t*dim[2]+i] = dens[i*dim[0]*dim[2]+t];
-// Rprintf("dens %f \n", dens[i*dim[0]*dim[2]+t]);
- for(int j=1; j<dim[2]; j++) {
-// Rprintf("j: %d \n", j);
- res[t*dim[2]+i] *= dens[i*dim[0]*dim[2]+j*dim[0]+t];
-// Rprintf("dens %f \n", dens[i*dim[0]*dim[2]+j*dim[0]+t]);
-
- }
- }
- }
-}
-
-} // end extern "C"
\ No newline at end of file
Deleted: pkg/depmixS4/src/ddens.h
===================================================================
--- pkg/depmixS4/src/ddens.h 2011-10-27 13:34:56 UTC (rev 499)
+++ pkg/depmixS4/src/ddens.h 2011-11-01 11:56:53 UTC (rev 500)
@@ -1,19 +0,0 @@
-
-#ifndef DDENS
-#define DDENS 1
-
-#include <stdio.h>
-#include <stdlib.h>
-
-extern "C" {
-
-#include <R.h>
-#include <Rmath.h>
-
-// compute the product of densities for each t
-// hopefully more efficient than apply?!?!?
-void ddens(double *dens, double *densOut, int *dim);
-
-} //end extern "C"
-
-#endif
\ No newline at end of file
More information about the depmix-commits
mailing list