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

Function dInvertPDMatrix

3rd_party/Src/ode/ode/src/matrix.cpp:167–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167int dInvertPDMatrix (const dReal *A, dReal *Ainv, int n)
168{
169 int i,j,nskip;
170 dReal *L,*x;
171 dAASSERT (n > 0 && A && Ainv);
172 nskip = dPAD (n);
173 L = (dReal*) ALLOCA (nskip*n*sizeof(dReal));
174 memcpy (L,A,nskip*n*sizeof(dReal));
175 x = (dReal*) ALLOCA (n*sizeof(dReal));
176 if (dFactorCholesky (L,n)==0) return 0;
177 dSetZero (Ainv,n*nskip); // make sure all padding elements set to 0
178 for (i=0; i<n; i++) {
179 for (j=0; j<n; j++) x[j] = 0;
180 x[i] = 1;
181 dSolveCholesky (L,x,n);
182 for (j=0; j<n; j++) Ainv[j*nskip+i] = x[j];
183 }
184 return 1;
185}
186
187
188int dIsPositiveDefinite (const dReal *A, int n)

Callers 2

dBodySetMassFunction · 0.85
dBodyAngAccelFromTorquFunction · 0.85

Calls 3

dFactorCholeskyFunction · 0.85
dSetZeroFunction · 0.85
dSolveCholeskyFunction · 0.85

Tested by

no test coverage detected