本文整理汇总了C++中eigen::Vector2d::array方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector2d::array方法的具体用法?C++ Vector2d::array怎么用?C++ Vector2d::array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Vector2d
的用法示例。
在下文中一共展示了Vector2d::array方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findSubmapParameters
void PolygonIterator::findSubmapParameters(const grid_map::Polygon& polygon, Eigen::Array2i& startIndex, Eigen::Array2i& bufferSize) const
{
Eigen::Vector2d topLeft = polygon_.getVertices()[0];
Eigen::Vector2d bottomRight = topLeft;
for (const auto& vertex : polygon_.getVertices()) {
topLeft = topLeft.array().max(vertex.array());
bottomRight = bottomRight.array().min(vertex.array());
}
limitPositionToRange(topLeft, mapLength_, mapPosition_);
limitPositionToRange(bottomRight, mapLength_, mapPosition_);
getIndexFromPosition(startIndex, topLeft, mapLength_, mapPosition_, resolution_, bufferSize_, bufferStartIndex_);
Eigen::Array2i endIndex;
getIndexFromPosition(endIndex, bottomRight, mapLength_, mapPosition_, resolution_, bufferSize_, bufferStartIndex_);
bufferSize = endIndex - startIndex + Eigen::Array2i::Ones();
}
示例2:
Eigen::MatrixXd sqExp2d(const Eigen::Matrix<double, 2, -1> &x1,
const Eigen::Matrix<double, 2, -1> &x2,
const Eigen::Vector2d &lengthScale, bool noisy)
{
// assert(x1.rows() == x2.rows())
int n1 = x1.cols(), n2 = x2.cols();
// Compute the weighted square distances
Eigen::Vector2d w = (lengthScale.array().square().cwiseInverse()).matrix();
Eigen::RowVectorXd xx1 = w.replicate(1, n1).cwiseProduct(x1).cwiseProduct(x1).colwise().sum();
Eigen::RowVectorXd xx2 = w.replicate(1, n2).cwiseProduct(x2).cwiseProduct(x2).colwise().sum();
Eigen::MatrixXd x1x2 = w.replicate(1, n1).cwiseProduct(x1).transpose() * x2;
// Compute the covariance matrix
Eigen::MatrixXd K = (-0.5 *
Eigen::MatrixXd::Zero(n1, n2).cwiseMax(
xx1.transpose().replicate(1, n2) + xx2.replicate(n1, 1) - 2 * x1x2)).array().exp();
if (noisy) {
K += K.colwise().sum().asDiagonal();
}
return K;
}