犰狳 C++自动类型错误分配
有人可以解释为什么在调试模式下工作正常,但在发行版中我看到 bad_allocation 吗?
#include <iostream>
#define ARMA_DONT_USE_WRAPPER
#include <armadillo>
int main()
{
arma::cx_mat testMat;
testMat.set_size(40, 19586);
auto nPositions = static_cast<arma::sword>(floor(19586/2));
arma::cx_rowvec a {19586, arma::fill::randu};
for ( int i = 0 ; i < 40; ++i)
{
// testMat.row(i) = arma::shift(arma::fft(a), nPositions); // very slow
auto result = (arma::shift(arma::fft(a), nPositions));
result.print("result");
}
std::cout << " i am done \n";
}
(使用 arma::cx_rowvec 可以正常工作,但性能不佳)
gcc 11.2
armadillo armadillo-10.8.2
提前谢谢您。
Can someone explain why in Debug mode is working okay, but in release i see bad_allocation ?
#include <iostream>
#define ARMA_DONT_USE_WRAPPER
#include <armadillo>
int main()
{
arma::cx_mat testMat;
testMat.set_size(40, 19586);
auto nPositions = static_cast<arma::sword>(floor(19586/2));
arma::cx_rowvec a {19586, arma::fill::randu};
for ( int i = 0 ; i < 40; ++i)
{
// testMat.row(i) = arma::shift(arma::fft(a), nPositions); // very slow
auto result = (arma::shift(arma::fft(a), nPositions));
result.print("result");
}
std::cout << " i am done \n";
}
( with arma::cx_rowvec is wokring okay, but bad perfomane )
gcc 11.2
armadillo armadillo-10.8.2
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论