~ubuntu-branches/ubuntu/gutsy/gnumeric/gutsy-201105201701

« back to all changes in this revision

Viewing changes to src/regression.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2007-03-08 16:16:45 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070308161645-uotkhmwywh7dkur4
Tags: 1.7.8-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#include <math.h>
17
17
#include <string.h>
18
18
#include <stdlib.h>
19
 
#include <stdio.h>
20
19
 
21
20
#undef DEBUG_NEAR_SINGULAR
22
21
 
54
53
        for (_i = 0; _i < _d1; _i++)                                    \
55
54
          {                                                             \
56
55
            for (_j = 0; _j < _d2; _j++)                                \
57
 
              fprintf (stderr, " %19.10" GNM_FORMAT_g, (var)[_i][_j]);  \
58
 
            fprintf (stderr, "\n");                                     \
 
56
              g_printerr (" %19.10" GNM_FORMAT_g, (var)[_i][_j]);       \
 
57
            g_printerr ("\n");                                          \
59
58
          }                                                             \
60
59
  } while (0)
61
60
 
118
117
                (void)gnm_frexp (gnm_sqrt (max), &expn);
119
118
                scale = gnm_ldexp (1, expn);
120
119
#ifdef DEBUG_NEAR_SINGULAR
121
 
                printf ("scale[%d]=%" GNM_FORMAT_g "\n",
122
 
                        i, scale);
 
120
                g_print ("scale[%d]=%" GNM_FORMAT_g "\n",
 
121
                         i, scale);
123
122
#endif
124
123
 
125
124
                *pdet *= scale;
180
179
                        }
181
180
#ifdef DEBUG_NEAR_SINGULAR
182
181
                PRINT_MATRIX (LU, n, n);
183
 
                printf ("max[%d]=%" GNM_FORMAT_g " at %d\n",
184
 
                        i, max, mov);
 
182
                g_print ("max[%d]=%" GNM_FORMAT_g " at %d\n",
 
183
                         i, max, mov);
185
184
#endif
186
185
                if (max == 0)
187
186
                        return REG_singular;
218
217
 
219
218
        cond = (gnm_log (highest) - gnm_log (lowest)) / gnm_log (2);
220
219
#ifdef DEBUG_NEAR_SINGULAR
221
 
        printf ("cond=%.20" GNM_FORMAT_g "\n", cond);
 
220
        g_print ("cond=%.20" GNM_FORMAT_g "\n", cond);
222
221
#endif
223
222
 
224
223
        /* FIXME: make some science out of this.  */
1003
1002
        }
1004
1003
 
1005
1004
#ifdef DEBUG
1006
 
        printf ("y1 = %lf\n", y1);
1007
 
        printf ("y2 = %lf\n", y2);
1008
 
        printf ("DELTA = %lf\n",DELTA);
 
1005
        g_print ("y1 = %lf\n", y1);
 
1006
        g_print ("y2 = %lf\n", y2);
 
1007
        g_print ("DELTA = %lf\n",DELTA);
1009
1008
#endif
1010
1009
 
1011
1010
        *df = (y2 - y1) / (2 * DELTA);
1096
1095
        }
1097
1096
 
1098
1097
#ifdef DEBUG
1099
 
        printf ("y1 = %lf\n", y1);
1100
 
        printf ("y2 = %lf\n", y2);
1101
 
        printf ("DELTA = %lf\n", DELTA);
 
1098
        g_print ("y1 = %lf\n", y1);
 
1099
        g_print ("y2 = %lf\n", y2);
 
1100
        g_print ("DELTA = %lf\n", DELTA);
1102
1101
#endif
1103
1102
 
1104
1103
        *dchi = (y2 - y1) / (2 * DELTA);
1280
1279
        tmp_par = g_new (gnm_float, p_dim);
1281
1280
        b       = g_new (gnm_float, p_dim);
1282
1281
#ifdef DEBUG
1283
 
        printf ("Chi Squared : %lf", chi_pre);
 
1282
        g_print ("Chi Squared : %lf", chi_pre);
1284
1283
#endif
1285
1284
 
1286
1285
        for (count = 0; count < MAX_STEPS; count++) {
1317
1316
                        goto out;
1318
1317
 
1319
1318
#ifdef DEBUG
1320
 
                printf ("Chi Squared : %lf", chi_pre);
1321
 
                printf ("Chi Squared : %lf", chi_pos);
1322
 
                printf ("r  :  %lf", r);
 
1319
                g_print ("Chi Squared : %lf", chi_pre);
 
1320
                g_print ("Chi Squared : %lf", chi_pos);
 
1321
                g_print ("r  :  %lf", r);
1323
1322
#endif
1324
1323
 
1325
1324
                if (chi_pos <= chi_pre + DELTA / 2) {