本文整理汇总了C++中SpMat::outerSize方法的典型用法代码示例。如果您正苦于以下问题:C++ SpMat::outerSize方法的具体用法?C++ SpMat::outerSize怎么用?C++ SpMat::outerSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpMat
的用法示例。
在下文中一共展示了SpMat::outerSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SolveSystem
bool StiffnessSolver::SolveSystem(
SpMat &K, VX &D, VX &F, VX &R,
int DoF, VXi &q, VXi &r,
int verbose, int &info, double &rms_resid)
{
VX diag; /* diagonal vector of the L D L' decomp. */
diag.resize(DoF);
//MX K_comp = K;
int row = K.rows(), col = K.cols();
MX K_comp(row, col);
K_comp.setZero();
for (int k = 0; k < K.outerSize(); ++k)
{
for (SpMat::InnerIterator it(K, k); it; ++it)
{
int r = it.row();
int c = it.col();
double v = it.value();
K_comp(r, c) = v;
}
}
/* L D L' decomposition of K[q,q] into lower triangle of K[q,q] and diag[q] */
/* vectors F and D are unchanged */
/* not solving at this moment*/
LDLDecompPM(K_comp, DoF, diag, F, D, R, q, r, 1, 0, info);
if (info < 0)
{
fprintf(stderr, "Stiffness Matrix is not positive definite: %d negative elements\n", info);
fprintf(stderr, "found on decomp diagonal of K.\n");
fprintf(stderr, "The stucture may have mechanism and thus not stable in general\n");
fprintf(stderr, "Please Make sure that all six\n");
fprintf(stderr, "rigid body translations are restrained!\n");
return false;
}
else
{
/* LDL' back-substitution for D[q] and R[r] */
LDLDecompPM(K_comp, DoF, diag, F, D, R, q, r, 0, 1, info);
if (verbose) { fprintf(stdout, " LDL' RMS residual:"); }
rms_resid = info = 1;
do {
/* improve solution for D[q] and R[r] */
LDLImprovePM(K_comp, DoF, diag, F, D, R, q, r, rms_resid, info);
if (verbose) { fprintf(stdout, "%9.2e", rms_resid); }
} while (info);
if (verbose) fprintf(stdout, "LDL^t Solving completed\n");
}
return true;
}