11 Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>> solver;
27 if (solver.info() != Eigen::Success)
29 fprintf(stderr,
"SolverSystem(LDLT): Error in Decomposition!\n");
33 VX Diag = solver.vectorD();
35 for (
int i = 0; i < Diag.size(); i++)
39 fprintf(stderr,
" SolveSystem(LDLT): zero found on diagonal ...\n");
40 fprintf(stderr,
" d[%d] = %11.4e\n", i, Diag[i]);
46 fprintf(stderr,
" SolveSystem(LDLT): negative number found on diagonal ...\n");
47 fprintf(stderr,
" d[%d] = %11.4e\n", i, Diag[i]);
55 fprintf(stderr,
"Stiffness Matrix is not positive definite: %d negative elements\n", info);
56 fprintf(stderr,
"found on decomp diagonal of K.\n");
57 fprintf(stderr,
"The stucture may have mechanism and thus not stable in general\n");
58 fprintf(stderr,
"Please Make sure that all six\n");
59 fprintf(stderr,
"rigid body translations are restrained!\n");
76 if (solver.info() != Eigen::Success)
78 fprintf(stderr,
"SolverSystem(LDLT): Error in Solving!\n");
88 Eigen::ConjugateGradient<SpMat> solver;
103 if (solver.info() != Eigen::Success)
105 fprintf(stderr,
"SolverSystem(ConjugateGradient): Error in Decomposition!\n");
109 solver.setMaxIterations(3000);
117 D = solver.solveWithGuess(F, D0);
124 if (solver.info() != Eigen::Success)
126 fprintf(stderr,
"SolverSystem(ConjugateGradient): Error in Solving!\n");
137 x = A.fullPivLu().solve(b);
139 if ((A*x).isApprox(b))
bool SolveSystem(SpMat &K, VX &D, VX &F, int verbose, int &info)
GLboolean GLboolean GLboolean b
Eigen::SparseMatrix< double > SpMat
bool LUDecomp(MX &A, VX &x, VX &b)