Skip to content

Commit

Permalink
remove more --x, which are undefined in strict C
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87479 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Dec 29, 2024
1 parent 63a5c3f commit 9fe56f2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/library/stats/src/loglin.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ loglin(int nvar, int *dim, int ncon, int *config, int ntab,
double x, y, xmax;

/* Parameter adjustments */
--dim;
// --dim;
// --locmar;
// config -= nvar + 1;
--fit;
--table;
// --fit;
// --table;
// --marg;
--u;
--dev;
// --u;
// --dev;

/* Function body */

Expand All @@ -68,7 +68,7 @@ loglin(int nvar, int *dim, int ncon, int *config, int ntab,

L10:
size = 1;
for (j = 1; j <= nvar; j++) {
for (j = 0; j < nvar; j++) {
if (dim[j] <= 0) goto L5;
size *= dim[j];
}
Expand All @@ -79,7 +79,7 @@ loglin(int nvar, int *dim, int ncon, int *config, int ntab,
L40:
x = 0.;
y = 0.;
for (i = 1; i <= size; i++) {
for (i = 0; i < size; i++) {
if (table[i] < 0. || fit[i] < 0.) goto L5;
x += table[i];
y += fit[i];
Expand All @@ -90,7 +90,7 @@ loglin(int nvar, int *dim, int ncon, int *config, int ntab,

if (y == 0.) goto L5;
x /= y;
for (i = 1; i <= size; i++) fit[i] = x * fit[i];
for (i = 0; i < size; i++) fit[i] = x * fit[i];
if (ncon <= 0 || config[0] == 0) return;

/* Allocate marginal tables */
Expand Down Expand Up @@ -119,7 +119,7 @@ loglin(int nvar, int *dim, int ncon, int *config, int ntab,
if (check[k - 1]) goto L95;
check[k - 1] = 1;
/* Get size */
size *= dim[k];
size *= dim[k-1];
}

/* Since U is used to store fitted marginals, size must not
Expand Down Expand Up @@ -148,7 +148,7 @@ loglin(int nvar, int *dim, int ncon, int *config, int ntab,
for (j = 1; j <= nvar; j++) {
icon[j - 1] = config[j + i * nvar - (nvar+1)];
}
collap(nvar, &table[1], marg, locmar[i-1], &dim[1], icon);
collap(nvar, table, marg, locmar[i-1], dim, icon);
}

/* Perform iterations */
Expand All @@ -160,11 +160,11 @@ loglin(int nvar, int *dim, int ncon, int *config, int ntab,
for (i = 1; i <= n; i++) {
for (j = 1; j <= nvar; j++)
icon[j - 1] = config[j + i * nvar - (nvar+1)];
collap(nvar, &fit[1], &u[1], 1, &dim[1], icon);
adjust(nvar, &fit[1], &u[1], marg, &locmar[i-1], &dim[1], icon, &xmax);
collap(nvar, fit, u, 1, dim, icon);
adjust(nvar, fit, u, marg, &locmar[i-1], dim, icon, &xmax);
}
/* Test convergence */
dev[k] = xmax;
dev[k-1] = xmax;
if (xmax < maxdev) goto L240;
}
if (maxit > 1) goto L230;
Expand Down

0 comments on commit 9fe56f2

Please sign in to comment.