fix warning about uninitialized var

This commit is contained in:
Tiago Gomes 2012-04-14 17:59:04 +01:00
parent 401ad145a5
commit f1d2889eaa

View File

@ -214,9 +214,8 @@ namespace LogAware {
void void
normalize (Params& v) normalize (Params& v)
{ {
double sum; double sum = LogAware::addIdenty();
if (Globals::logDomain) { if (Globals::logDomain) {
sum = LogAware::addIdenty();
for (unsigned i = 0; i < v.size(); i++) { for (unsigned i = 0; i < v.size(); i++) {
sum = Util::logSum (sum, v[i]); sum = Util::logSum (sum, v[i]);
} }
@ -225,7 +224,6 @@ normalize (Params& v)
v[i] -= sum; v[i] -= sum;
} }
} else { } else {
sum = 0.0;
for (unsigned i = 0; i < v.size(); i++) { for (unsigned i = 0; i < v.size(); i++) {
sum += v[i]; sum += v[i];
} }
@ -401,7 +399,8 @@ Statistics::updateCompressingStatistics (
unsigned nrGroundFactors, unsigned nrGroundFactors,
unsigned nrClusterVars, unsigned nrClusterVars,
unsigned nrClusterFactors, unsigned nrClusterFactors,
unsigned nrNeighborless) { unsigned nrNeighborless)
{
compressInfo_.push_back (CompressInfo (nrGroundVars, nrGroundFactors, compressInfo_.push_back (CompressInfo (nrGroundVars, nrGroundFactors,
nrClusterVars, nrClusterFactors, nrNeighborless)); nrClusterVars, nrClusterFactors, nrNeighborless));
} }