本文整理汇总了C++中eigen::Matrix3d::fullPivLu方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3d::fullPivLu方法的具体用法?C++ Matrix3d::fullPivLu怎么用?C++ Matrix3d::fullPivLu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Matrix3d
的用法示例。
在下文中一共展示了Matrix3d::fullPivLu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Eigen::Vector3d LinearAlgebra::solveLinearSystem(const Eigen::Matrix3d& M, const Eigen::Vector3d& a) {
Eigen::Vector3d result;
// TODO: Solve Mx = a for x and return x.
result = M.fullPivLu().solve(a);
return result;
}
示例2: rhs
// =============================================================================
Eigen::VectorXd
mesh_tri::
edge_coefficients_numerically_(
const std::vector<Eigen::Vector3d> & edges
) const
{
size_t num_edges = edges.size();
TEUCHOS_ASSERT_EQUALITY(num_edges, 3);
// Build an equation system for the edge coefficients alpha_k.
// They fulfill
//
// |simplex| * <u,v> = \sum_{edges e_i} alpha_i <u,e_i> <e_i,v>
//
// for any pair of vectors u, v in the plane of the triangle.
//
const double vol = 0.5 * (edges[0].cross(edges[1])).norm();
Eigen::Matrix3d A;
Eigen::Vector3d rhs;
// Build the equation system:
// The equation
//
// |simplex| ||u||^2 = \sum_i \alpha_i <u,e_i> <e_i,u>
//
// has to hold for all vectors u in the plane spanned by the edges,
// particularly by the edges themselves.
//
for (size_t i = 0; i < num_edges; i++) {
double alpha = edges[i].dot(edges[i]);
rhs(i) = vol * alpha;
A(i, i) = alpha * alpha;
for (size_t j = i+1; j < num_edges; j++) {
A(i, j) = edges[i].dot(edges[j]) * edges[j].dot(edges[i]);
A(j, i) = A(i, j);
}
}
// Solve the equation system for the alpha_i. The system is symmetric and,
// if the simplex is not degenerate, positive definite.
//return A.ldlt().solve(rhs);
const auto x = A.fullPivLu().solve(rhs);
//auto x = A.colPivHouseholderQr().solve(rhs);
return x;
}