MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / checkFactorization

Function checkFactorization

3rd_party/Src/ode/ode/src/lcp.cpp:270–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268#ifdef DEBUG_LCP
269
270static void checkFactorization (ATYPE A, dReal *_L, dReal *_d,
271 int nC, int *C, int nskip)
272{
273 int i,j;
274 if (nC==0) return;
275
276 // get A1=A, copy the lower triangle to the upper triangle, get A2=A[C,C]
277 dMatrix A1 (nC,nC);
278 for (i=0; i<nC; i++) {
279 for (j=0; j<=i; j++) A1(i,j) = A1(j,i) = AROW(i)[j];
280 }
281 dMatrix A2 = A1.select (nC,C,nC,C);
282
283 // printf ("A1=\n"); A1.print(); printf ("\n");
284 // printf ("A2=\n"); A2.print(); printf ("\n");
285
286 // compute A3 = L*D*L'
287 dMatrix L (nC,nC,_L,nskip,1);
288 dMatrix D (nC,nC);
289 for (i=0; i<nC; i++) D(i,i) = 1/_d[i];
290 L.clearUpperTriangle();
291 for (i=0; i<nC; i++) L(i,i) = 1;
292 dMatrix A3 = L * D * L.transpose();
293
294 // printf ("L=\n"); L.print(); printf ("\n");
295 // printf ("D=\n"); D.print(); printf ("\n");
296 // printf ("A3=\n"); A2.print(); printf ("\n");
297
298 // compare A2 and A3
299 dReal diff = A2.maxDifference (A3);
300 if (diff > 1e-8)
301 dDebug (0,"L*D*L' check, maximum difference = %.6e\n",diff);
302}
303
304#endif
305

Callers 3

transfer_i_to_CMethod · 0.85

Calls 6

LClass · 0.85
dDebugFunction · 0.85
clearUpperTriangleMethod · 0.80
maxDifferenceMethod · 0.80
selectMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected