14 int inverse (
double *a,
int nsize);
15 int isymp(
int row,
int col);
20 inline int isymp(
int row,
int col)
29 if(row < col) k= row + col *(col -1)/2;
30 else k= col + row * (row - 1)/2;
104 for( i =0,j=0;i<set_size-1;i++,j=indeces[i-1]+1)
116 indeces[i] = j+set-1;
123 int foresub (
double *,
double *,
int);
124 int backsub (
double *,
double *,
int);
127#define NOT_SOLVABLE 0
140 if (flag < 1 || flag > 3)
146 if (flag == 1)
return SOLVED;
155 if (flag == 2)
return SOLVED;
179 int i, j, k, m, n = 2;
182 for (k = 0; k < nsize; k++)
188 for (i = 0; i < k; i++)
193 for (j = 0; j < i; j++)
195 sum += *ap4++ * *ap5++;
199 *ap3 = (*ap3 - sum) / *ap2;ap3++;
204 for (j = 0; j < k; j++)
206 sum += *ap1 * *ap1;ap1++;
214 if ((*ap6 - sum) <= 0)
215 *ap6 = sqrt(-(*ap6 - sum));
217 *ap6 = sqrt(*ap6 - sum);
229 inline int foresub (
double *a,
double *b,
int nsize)
240 for (i = 1; i < nsize; i++)
243 for (j = 0, bp2 = b; j < i; j++)
245 sum += *ap1++ * *bp2++;
249 *bp1 = (*bp1 - sum) / *ap1;bp1++;ap1++;
257 inline int backsub (
double *a,
double *b,
int nsize)
266 double *ap1 = a + (k + k * (k + 1) / 2);
267 double *ap2 = ap1 - 1;
275 *bp1 = *bp1 / *ap1;bp1--;
276 for (i = k - 1; i >= 0; i--)
280 for (j = nsize - 1, ap3 = ap2--, bp3 = bp2; j >= i + 1; j--)
282 sum += *ap3 * *bp3--;
288 *bp1 = (*bp1 - sum) / *ap1;bp1--;
310 while (ap1 < (a + (nsize * (nsize + 1)/2)))
318 for (i = 1; i < nsize; i++)
323 for (j = m; j <= nsize; j++)
330 sum += *ap1 * *ap2++;
334 *ap3 = -(*ap4) * sum;
342 ap1 = ap2 = ap3 = ap4 = a;
343 for (i = 0; i < nsize;)
347 for (j = i; j < nsize;)
350 ap1 = ap3 = ap5 + i + n;
353 for (k = j; k < nsize;)
#define NOT_SOLVABLE
Definition Ransac.h:127
#define SOLVED
Definition Ransac.h:126
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
int backsub(double *, double *, int)
Definition Ransac.h:257
int foresub(double *, double *, int)
Definition Ransac.h:229
int indeces_from_set(int *indeces, int set, int set_size, int n)
Definition Ransac.h:88
int isymp(int row, int col)
Definition Ransac.h:20
int choleski_solve(double *a, double *b, int nsize, int flag)
Definition Ransac.h:131
int binomial_coeficient(int n, int k)
Definition Ransac.h:36
int decompose(double *, int)
Definition Ransac.h:165
int inverse(double *a, int nsize)
Definition Ransac.h:296