17 #ifndef BT_SOLVE_PROJECTED_GAUSS_SEIDEL_H
18 #define BT_SOLVE_PROJECTED_GAUSS_SEIDEL_H
31 int i, j, numRows = A.rows();
35 for (
int k = 0; k <numIterations; k++)
37 for (i = 0; i <numRows; i++)
42 for (
int h=0;h<A.m_rowNonZeroElements1[i].size();h++)
44 int j = A.m_rowNonZeroElements1[i][h];
47 delta += A(i,j) * x[j];
52 for (j = 0; j <i; j++)
53 delta += A(i,j) * x[j];
54 for (j = i+1; j<numRows; j++)
55 delta += A(i,j) * x[j];
59 x [i] = (b [i] - delta) / A(i,i);
62 if (limitDependency[i]>=0)
64 s = x[limitDependency[i]];
80 #endif //BT_SOLVE_PROJECTED_GAUSS_SEIDEL_H
virtual bool solveMLCP(const btMatrixXu &A, const btVectorXu &b, btVectorXu &x, const btVectorXu &lo, const btVectorXu &hi, const btAlignedObjectArray< int > &limitDependency, int numIterations, bool useSparsity=true)
original version written by Erwin Coumans, October 2013
original version written by Erwin Coumans, October 2013