[Rsiena-commits] r313 - in pkg/RSienaTest: . src src/model/variables

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 6 17:27:35 CEST 2017


Author: fschoenen
Date: 2017-09-06 17:27:35 +0200 (Wed, 06 Sep 2017)
New Revision: 313

Modified:
   pkg/RSienaTest/ChangeLog
   pkg/RSienaTest/src/Makevars.in
   pkg/RSienaTest/src/model/variables/DependentVariable.cpp
Log:
fix null pointer in accumulateRateScores


Modified: pkg/RSienaTest/ChangeLog
===================================================================
--- pkg/RSienaTest/ChangeLog	2017-09-04 12:09:55 UTC (rev 312)
+++ pkg/RSienaTest/ChangeLog	2017-09-06 15:27:35 UTC (rev 313)
@@ -1,3 +1,12 @@
+2017-09-06 R-Forge Revision 313
+Changes in RSienaTest:
+   * DependentVariable.cpp: Fix null pointer in accumulateRateScores when
+     called on BehaviorVariable.
+
+2017-09-04 R-Forge Revision 312
+Changes in RSienaTest:
+   * configure.win: adapt windows configuration script
+
 2017-09-04 R-Forge Revision 311
 Changes in RSienaTest:
    * configure.ac: add openmp test for macOS El Capitan compatibility

Modified: pkg/RSienaTest/src/Makevars.in
===================================================================
--- pkg/RSienaTest/src/Makevars.in	2017-09-04 12:09:55 UTC (rev 312)
+++ pkg/RSienaTest/src/Makevars.in	2017-09-06 15:27:35 UTC (rev 313)
@@ -9,7 +9,7 @@
 
 PKG_CPPFLAGS = -I. $(RNGSTREAMS_CPP) $(EIGEN_CPP) @PKG_CPPFLAGS@ @OPENMP_CFLAGS@
 # -UNDEBUG -DR_LEGACY -DPROFILER
-PKG_LIBS     = $(SHLIB_OPENMP_CXXFLAGS) $(ARCHLIB) @PKG_LIBS@ @OPENMP_CFLAGS@
+PKG_LIBS     = $(ARCHLIB) @PKG_LIBS@ @OPENMP_CFLAGS@
 #  -lprofiler -ltcmalloc
 
 all: $(SHLIB)

Modified: pkg/RSienaTest/src/model/variables/DependentVariable.cpp
===================================================================
--- pkg/RSienaTest/src/model/variables/DependentVariable.cpp	2017-09-04 12:09:55 UTC (rev 312)
+++ pkg/RSienaTest/src/model/variables/DependentVariable.cpp	2017-09-06 15:27:35 UTC (rev 313)
@@ -113,8 +113,8 @@
 	if (this->networkVariable())
 	{
 		NetworkLongitudinalData * pNetworkData =
-				dynamic_cast<NetworkLongitudinalData *>(this->pSimulation()->pData()->pNetworkData(
-						this->name()));
+			dynamic_cast<NetworkLongitudinalData *>(
+				this->pSimulation()->pData()->pNetworkData(this->name()));
 		const std::vector<SettingInfo> & rSettingNames =
 			pNetworkData->rSettingNames();
 		for (unsigned i = 0 ; i < rSettingNames.size(); i++)
@@ -922,22 +922,26 @@
 		this->lbasicRateScore -= this->totalRate() * tau / this->basicRate();
 	}
 
-	// Update scores for setting rates
-	NetworkLongitudinalData * pNetworkData =
-		dynamic_cast<NetworkLongitudinalData *>(this->pData());
-	const std::vector<SettingInfo> & rSettingNames =
-		pNetworkData->rSettingNames();
+	// TODO Current settings implementation is only for networks.
+	if (this->networkVariable())
+	{
+		// Update scores for setting rates
+		NetworkLongitudinalData * pNetworkData =
+			dynamic_cast<NetworkLongitudinalData *>(this->pData());
+		const std::vector<SettingInfo> & rSettingNames =
+			pNetworkData->rSettingNames();
 
-	for (int i = 0; i < this->lnumberSettings; i++)
-	{
-		// TODO: Check if this correct
-		if (this == pSelectedVariable && this->lstepType == i)
+		for (int i = 0; i < this->lnumberSettings; i++)
 		{
-			this->lsettingRateScores[rSettingNames[i].getId()] += 1.0
+			// TODO: Check if this correct
+			if (this == pSelectedVariable && this->lstepType == i)
+			{
+				this->lsettingRateScores[rSettingNames[i].getId()] += 1.0
 					/ this->lsettings[i]->getRate();
+			}
+			this->lsettingRateScores[rSettingNames[i].getId()] -= this->totalRate() * tau /
+				this->lsettings[i]->getRate();
 		}
-		this->lsettingRateScores[rSettingNames[i].getId()] -= this->totalRate() * tau /
-			this->lsettings[i]->getRate();
 	}
 
 	// Update scores for covariate dependent rate parameters



More information about the Rsiena-commits mailing list