[Genabel-commits] r1510 - pkg/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Dec 29 14:11:20 CET 2013
Author: lckarssen
Date: 2013-12-29 14:11:20 +0100 (Sun, 29 Dec 2013)
New Revision: 1510
Modified:
pkg/ProbABEL/src/coxph_data.cpp
pkg/ProbABEL/src/eigen_mematrix.cpp
pkg/ProbABEL/src/reg1.cpp
Log:
Fix a couple of cppcheck warnings in ProbABEL.
Modified: pkg/ProbABEL/src/coxph_data.cpp
===================================================================
--- pkg/ProbABEL/src/coxph_data.cpp 2013-12-28 21:46:42 UTC (rev 1509)
+++ pkg/ProbABEL/src/coxph_data.cpp 2013-12-29 13:11:20 UTC (rev 1510)
@@ -44,17 +44,17 @@
return -9;
}
-coxph_data::coxph_data(const coxph_data &obj) : sstat(obj.sstat)
+coxph_data::coxph_data(const coxph_data &obj) : sstat(obj.sstat),
+ offset(obj.offset),
+ strata(obj.strata),
+ X(obj.X),
+ order(obj.order)
{
nids = obj.nids;
ncov = obj.ncov;
ngpreds = obj.ngpreds;
weights = obj.weights;
stime = obj.stime;
- offset = obj.offset;
- strata = obj.strata;
- X = obj.X;
- order = obj.order;
gcount = 0;
freq = 0;
masked_data = new unsigned short int[nids];
Modified: pkg/ProbABEL/src/eigen_mematrix.cpp
===================================================================
--- pkg/ProbABEL/src/eigen_mematrix.cpp 2013-12-28 21:46:42 UTC (rev 1509)
+++ pkg/ProbABEL/src/eigen_mematrix.cpp 2013-12-29 13:11:20 UTC (rev 1510)
@@ -309,10 +309,10 @@
exit(1);
}
mematrix<DT> temp(M.nrow, M.ncol);
- int source;
+
for (int i = 0; i < temp.nrow; i++)
{
- source = order.data(i, 0);
+ int source = order.data(i, 0);
temp.data.row(source) = M.data.row(i);
}
return temp;
Modified: pkg/ProbABEL/src/reg1.cpp
===================================================================
--- pkg/ProbABEL/src/reg1.cpp 2013-12-28 21:46:42 UTC (rev 1509)
+++ pkg/ProbABEL/src/reg1.cpp 2013-12-29 13:11:20 UTC (rev 1510)
@@ -59,11 +59,11 @@
{
mematrix<double> nX_without_interact_phe;
nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
- int col_new;
+
for (int row = 0; row < nX.nrow; row++)
{
//Han Chen
- col_new = -1;
+ int col_new = -1;
for (int col = 0; col < nX.ncol; col++)
{
if (col != interaction && !iscox)
@@ -118,12 +118,11 @@
//________________________
if (is_interaction_excluded)
{
- int col_new;
mematrix<double> nX_without_interact_phe;
nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
for (int row = 0; row < nX.nrow; row++)
{
- col_new = -1;
+ int col_new = -1;
for (int col = 0; col < nX.ncol; col++)
{
if (col != interaction && !iscox)
@@ -196,10 +195,10 @@
{
mematrix<double> nX_without_interact_phe;
nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
- int col_new;
+
for (int row = 0; row < nX.nrow; row++)
{
- col_new = -1;
+ int col_new = -1;
for (int col = 0; col < nX.ncol; col++)
{
if (col != interaction && !iscox)
@@ -431,14 +430,14 @@
sigma2_matrix = sigma2_matrix - sigma2_matrix1;
// std::cout << "sigma2_matrix\n";
// sigma2_matrix.print();
- static double val;
+
// std::cout << "sigma2_matrix.nrow=" << sigma2_matrix.nrow
// << "sigma2_matrix.ncol" << sigma2_matrix.ncol
// <<"\n";
for (int i = 0; i < sigma2_matrix.nrow; i++)
{
- val = sigma2_matrix.get(i, 0);
+ double val = sigma2_matrix.get(i, 0);
// std::cout << "val = " << val << "\n";
sigma2 += val * val;
// std::cout << "sigma2+= " << sigma2 << "\n";
@@ -689,7 +688,7 @@
{
double emu = eMu.get(i, 0);
double value = emu;
- double zval = 0.;
+ double zval;
value = exp(value) / (1. + exp(value));
residuals[i] = (rdata.Y).get(i, 0) - value;
eMu.put(value, i, 0);
@@ -757,9 +756,11 @@
delta = fabs(1. - (prevlik / loglik));
niter++;
- }
+ } // END while (niter < maxiter && delta > eps)
+
sigma2 = 0.;
mematrix<double> robust_sigma2(X.ncol, X.ncol);
+
if (robust)
{
mematrix<double> XbyR = X;
More information about the Genabel-commits
mailing list