eigen - QCustomPlot 在图形中添加双精度需要很长时间
问题描述
我有这个代码:
QCustomPlot* plot;
QCPGraph* graph = plot->addGraph();
for(int i = 0; i < 50000; i++) {
double x_l = static_cast<double>(buffer[i * 3]);
double y_l = static_cast<double>(buffer[i * 3 + 1);
double z_l = static_cast<double>(buffer[i * 3 + 2]);
r = A * v + v1; // r and v1 and v are Eigen::Vector3d, A is Eigen::Matrix3d
graph->addData(x_l, x_l);
}
这个 for 循环需要 240 毫秒!!!!
如果我将最后一行替换为:
graph->addData(5.1121, 6.7457) //random number which are also double
for 循环需要 4 毫秒!!!
为什么差距这么大???
原来的行应该是:
graph->addData(r[0], r[1]);
但这也需要大约 300 毫秒。
解决方案
推荐阅读
- javascript - 当有人单击“垃圾箱”图标时,如何删除特定的 localStorage,这会在前端而不是本地删除它
- android - 在反应本机应用程序中启用/禁用 Firebase 推送通知
- django-channels - Django Channels - 如何获取组列表,添加了一个频道?
- django - django-CMS 和 cookiecutter-django 不兼容吗?
- django - 如何在 ubuntu 上的 django 中进行 docker-compose 后进入重新启动状态时修复 docker
- pdf - ionic4 在 inappbrowser 中显示动态创建的 pdf 文件
- node.js - 未找到模块。我在 app.js 文件中运行 ----- CONST DATE 代码的那一刻,它向我显示了一个错误 (internal/modules/cjs/loader.js:985 throw err; ^)
- python - 如何在 Pygame 中为 pygame.sprite.rect 矩形分配“rect”属性?
- excel - 你能控制另一个程序.exe吗?我试过使用发送键,但这不可靠
- c# - C# CSV 文件:如何在使用数据表读取 csv 文件时跳过几列