[Depmix-commits] r470 - pkg/depmixS4/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 21 15:29:11 CEST 2011


Author: ingmarvisser
Date: 2011-06-21 15:29:11 +0200 (Tue, 21 Jun 2011)
New Revision: 470

Modified:
   pkg/depmixS4/src/fb.cc
Log:
Initial set up of loop for backwards variables

Modified: pkg/depmixS4/src/fb.cc
===================================================================
--- pkg/depmixS4/src/fb.cc	2011-06-21 13:06:22 UTC (rev 469)
+++ pkg/depmixS4/src/fb.cc	2011-06-21 13:29:11 UTC (rev 470)
@@ -87,12 +87,32 @@
 				}
 				alpha1 = alphat;
 			}
-		}			
+		}
+		
+		// compute backward variables and xi
+		matrix betatp1(ns[0]);
+		matrix betat(ns[0]);
+		// compute initial beta, ie for t=T (for each case)
+		for(int i=0; i<ns[0]; i++) {
+			betatp1[et[cas],i] <- sca[et[cas]]
+		}
+		betatp1.print();
+		
+// 		R-code for the backwards/xi loop
+// 		if(ntimes[case]>1) {
+// 			for(i in (et[case]-1):bt[case]) {
+// 				if(stationary) beta[i,] <-(B[i+1,]*beta[i+1,])%*%A[1,,]*sca[i]
+// 				else beta[i,] <-(B[i+1,]*beta[i+1,])%*%A[i,,]*sca[i]
+// 			}
+// 			
+// 			for(i in bt[case]:(et[case]-1)) {
+// 				if(stationary) xi[i,,] <- rep(alpha[i,],each=ns)*(B[i+1,]*beta[i+1,]*A[1,,])
+// 				else xi[i,,] <- rep(alpha[i,],each=ns)*(B[i+1,]*beta[i+1,]*A[i,,])
+// 			}
+// 		}
+				
 	} // end cases
 	
-	// compute backward variables and xi
-	
-	
 }
 
 } // end extern "C"
\ No newline at end of file



More information about the depmix-commits mailing list