2017-12-15 10 views
0

私はEigenを使用して、次の形式の線形方程式のシステムを解こうとしています。 Aは45×45の行列、Bは45×1の行列です。私は45×1の解を得ることを期待しています。しかし、ソルバーは決して戻ってこない。いずれかの行列のインデックス-4591537738753454899にアクセスしようとしているため、異常終了すると失敗します。これはもちろん無効なインデックスです。しかし私はこのインデックスを生成していません、Eigenです。Eigen 3アサートは、線形システムを解くときに失敗します.Eigen内の無効なインデックスが原因であることがわかります限り、

これはC++やLinear Algebraのいずれかで、私が何かばかげている可能性がありますが、私はそれを見ていません。何か案は?

これはコードである:

using Matrix = Eigen::Matrix<ScalarT, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor>; 
using Vector = Eigen::Matrix<ScalarT, Eigen::Dynamic, 1, Eigen::ColMajor>; 
auto x0 = problem.get_x_as_vector(); 
auto B = problem.get_hessian(); 
auto g = problem.get_gradient(); 
std::cout 
    << " B.rows(): " << B.rows() 
    << " B.cols(): " << B.cols() 
    << " g.rows(): " << g.rows() 
    << " g.cols(): " << g.cols() 
    << std::endl; 
Eigen::FullPivLU<decltype(B)> lu_decomp(B); 
std::cout << B.determinant() << std::endl; 
std::cout << "The rank of A is " << lu_decomp.rank() << std::endl; 
std::cout << B << std::endl; 
std::cout << g << std::endl; 
auto p = B.fullPivHouseholderQr().solve(-g); 
std::cout << "p" << std::endl; 
std::cout << p << std::endl; // this is exact_newton.hpp:130 

これは、この出力をもたらす:

A.rows(): 45 A.cols(): 45 b.rows(): 45 b.cols(): 1 
The determinant of A is: -6.53094e+193 
The rank of A is 45 
A:45 
14848 -7168 9728 2048 17920 1536 512 512 -8192 5632 3072 5120 15872 4096 2560 8704 7680 10240  0 14336 -1536 7168 -3072 6656 512 10240 -4096 3584 2048 -1536 7680 7168 7168 -1024 3584 -11776 3072 -1024 5120 6144 15872 -5120 -512 6656 3584 
-7168 -27136 -10240 -8704 1024 -6144 -16896 -17920 -18432 -8704 -16896 -2560 -11264 -9728 -5632 -3072 1024 -8192 -10752 5120 -12288 -13824 -18432 -11264 -23040 -9216 -20480 -4096 -12288 -1024 -17408 -11776 -16384 -23040 512 -20992 -13312 -17408 -2560 -8192 4608 -28160 -11776 4096 -10752 
    9728 -10240 1024 -5632 13312 -512 2560 6656 -14848 10752 1536 8704 2560 -6656 7168 6144 5120 -4608 1024 16384 2560 1024 -4096 4096 -10240 3584 -10240 6656 6656 512 5632 4096 -4096 6656 -3584 -9728 -2560 -512 10752 2560 22528 -6144  0 12288 10752 
    2048 -8704 -5632 -1024 6144 2048 -6656 -7680 -5632 -512 -2560 10240 -3584 -8192 2560 -3584 -8192 2560 2560 8704 -7680 -1024 -1536 -3584 -12288 3072 -17408 -1024 -8704 -512 -12288 8192 512 -6144 -2560 -14848 -8192 -9728 -1024  0 17408 -11776 -4096 7680 -2560 
17920 1024 13312 6144 25088 6144 11264 7680 2560 11776 4096 19968 9216 12800 11776 17408 17408 8704 8192 22016 15872 18944 4608 8704 -3584 14848 -4608 12800 16384 13824 16384 5120 9216 5120 2048 -3584 512 512 4096 11776 18432 512 9216 10240 11264 
    1536 -6144 -512 2048 6144 1536 -3584 -3584 -3072 -3072 -8704 11776 1024 -3584 4608 12288 1024 6144 -2048 12288 -6144 3584 -3072 -6656 -8192 9728 -12288 4608 512 6144 -2048 7168  0 -512 -3584 -13824 -1536 -2560 6656 -3072 12288 -5632  0 9216 1536 
    512 -16896 2560 -6656 11264 -3584 -11776 -512 -12288 -5632 1536 9216 -1024 -9216 -2048 6656 2048  0  0 9216 -6656  0 -5120 -3584 -3584 -1536 -15360 -1536 -512 1536 -4096 3584 -3584 2048 -10752 -15360 -2560 -6144 3584 -1536 7168 -15360 -12288 -3584 -2048 
    512 -17920 6656 -7680 7680 -3584 -512 -6144 -11776 -6656 -3072 1536 4096 -5120 -6144 7680 -2560 6144 -4096  0 -3072 3072 -5632 -4096 -14336 10240 -8192 512 1024 5120 -7168 2560 -1536 -4096 -11264 -9216 -3072 -512 512 -1024 8704 -16896 -512 7680 -6144 
-8192 -18432 -14848 -5632 2560 -3072 -12288 -11776  0 6144 -11264 4608 -3584 -13312 -22016 2048 -7680 -1536 -5120 2560 -5632 -2048 -9728 -6144 -10752 -1024 -6656 -11264 -3584 -4608 -7680 -1024 -10752 -9728 -8192 -19968 -15360 -11776 -9216 2560 1536 -11776 -512 8704 -12288 
    5632 -8704 10752 -512 11776 -3072 -5632 -6656 6144 5120 -7168 11264 1024 512 5632 7680 13824 9216 -2048 9216 1024 9728 1536 -1536 -9216 8704 -13824 1024 1024 5120 3584 3584 2048 -11264 -4096 -9216 4608 -12288 -512 3584 12288 -12800 -3584 9728 2048 
    3072 -16896 1536 -2560 4096 -8704 1536 -3072 -11264 -7168 -10752 8704 -7680 -16896 -5120 6656 2560 6144 -5632 -1024 -8192  0 -7168  0 -10752 -3072 -14848 4608 -4608 -1024 -8704 -11264 -11264 -9216 4096 -15872 -6656 -12288 -13312 -3072 1024 -21504 -9728 3584 -4096 
    5120 -2560 8704 10240 19968 11776 9216 1536 4608 11264 8704 15360 11264 512 4096 12800 17920 14848 12800 17920 1536 -1536 8704  0 -1024 4608 1536 12288 8192 11264 5632 3072 19456 2048  0 -512 4096 512 8192 6656 24064 -6144 8704 17920 -1024 
15872 -11264 2560 -3584 9216 1024 -1024 4096 -3584 1024 -7680 11264 2048  0 1024 5120 2560 9216 -512 12800 -2560 2560 -5120 6144 -5632 7168 -7168 9216 -5120 9216 512 3072  0 -512 -2560 -6144 -5632 -4608 1536 -2560 18944 -4608 -2560 2048 -10240 
    4096 -9728 -6656 -8192 12800 -3584 -9216 -5120 -13312 512 -16896 512  0 -17920 -9728 3584 -3584 2560 -8192 5120 -2560 -3584 -8704 -6144 -14848 1024 -9216 512 -8192 4608 1024 -3072 -4608 -14848 -13312 -15360 -12800 -6144 3072 -1536 9216 -17920 -6656 7680 -4096 
    2560 -5632 7168 2560 11776 4608 -2048 -6144 -22016 5632 -5120 4096 1024 -9728  0 8192 2560 -1024 -3072 -2048 -6144 3072 -6656 -1024 -11776 -6144 -8192 1024 7168 3072 -7680 5632 -10240 -4608 2560 -11264 -1024 -5632 1024 5632 10240 -23040 -4096 4096 -16896 
    8704 -3072 6144 -3584 17408 12288 6656 7680 2048 7680 6656 12800 5120 3584 8192 20480 1024 16384 6144 16896 1024 8192 -5120 11264 -4096 6656  0 10752 3072 3584 1536  0 3584 2048 -512 -3584 2048 2048 1536 8192 17920 -11776 512 4096 -3072 
    7680 1024 5120 -8192 17408 1024 2048 -2560 -7680 13824 2560 17920 2560 -3584 2560 1024 6656 5632 5632 19456 -3584 7680 -9728 2048 -16384 1536 -9728 12288 2560 7680 2560 3584 -2048 1536 5632 2560 -4096 -1024 6656 10240 12288 -13312 2560 13312  0 
10240 -8192 -4608 2560 8704 6144  0 6144 -1536 9216 6144 14848 9216 2560 -1024 16384 5632 3072 10240 11264  0 8192 -4096 4096 -9728 10240 -9216 4608 2560 8192 2048 4096 6144 -512 1024 -8704 3584 -4608 4096 2048 17920 -11776 512 12800 -8192 
    0 -10752 1024 2560 8192 -2048  0 -4096 -5120 -2048 -5632 12800 -512 -8192 -3072 6144 5632 10240 -1536 6144 -5632 -512 -6656 6656 -9216 8704 -13312 1024 -6656 -2048 -2048 7168 -3072 -4608 1536 -15360 -1024 -4608 -1024 7168 13824 -19968 6656 12288 4096 
14336 5120 16384 8704 22016 12288 9216  0 2560 9216 -1024 17920 12800 5120 -2048 16896 19456 11264 6144 19456 5632 3072 -2560 10752 -5632 15872 -4096 13312 16384 11264 2048 12800 4608 5632 9216 -2560 6656 2560 15360 19456 17920 -9216 7168 24064 4096 
-1536 -12288 2560 -7680 15872 -6144 -6656 -3072 -5632 1024 -8192 1536 -2560 -2560 -6144 1024 -3584  0 -5632 5632 -1536 5120 512 -1024 -1024  0 -17408 5632 -6656 -5120 2048 13312 -4096 -5632 -8704 -15360 -8192 -15360 3072 7168 8704 -20992 -8192 10240 -4608 
    7168 -13824 1024 -1024 18944 3584  0 3072 -2048 9728  0 -1536 2560 -3584 3072 8192 7680 8192 -512 3072 5120 -512 512 2048 -8704 11264 -9216 6656 -512 18944 -2048 1024 3584 -4608  0 -3072 -2048 -3072 -2560 8192 15872 -13824 -8704 11264 512 
-3072 -18432 -4096 -1536 4608 -3072 -5120 -5632 -9728 1536 -7168 8704 -5120 -8704 -6656 -5120 -9728 -4096 -6656 -2560 512 512 -9216 -4096 -11264  0 -15872 5120 -6144 -512 -8704 -2048 -512 -12288 -3072 -14848 -10240 -18944 -10752 5120 10240 -21504 -6144 2048 -6144 
    6656 -11264 4096 -3584 8704 -6656 -3584 -4096 -6144 -1536  0  0 6144 -6144 -1024 11264 2048 4096 6656 10752 -1024 2048 -4096 -4608 -9728 16896 -10240 1024 2048 4096 3584 2048 -512 -8192  0 -6656 -11776 -7680 1024 6656 10752 -12288 -5120 11776 -1024 
    512 -23040 -10240 -12288 -3584 -8192 -3584 -14336 -10752 -9216 -10752 -1024 -5632 -14848 -11776 -4096 -16384 -9728 -9216 -5632 -1024 -8704 -11264 -9728 -22016  0 -29184 -8192 -6144 -10752 -13312 -4608 -7680 -13824 -12288 -16384 -20480 -16384 -4608 -5632 512 -18944 -18432 -10240 -6144 
10240 -9216 3584 3072 14848 9728 -1536 10240 -1024 8704 -3072 4608 7168 1024 -6144 6656 1536 10240 8704 15872  0 11264  0 16896  0 1536 -4608 9728 2560 5120 1536 7680 -1536 1024 -512 -8192 4096  0 4096 10752 9216 -12288 -3584 13312 6656 
-4096 -20480 -10240 -17408 -4608 -12288 -15360 -8192 -6656 -13824 -14848 1536 -7168 -9216 -8192  0 -9728 -9216 -13312 -4096 -17408 -9216 -15872 -10240 -29184 -4608 -16384 -4096 -15872 -10240 -19456 -4096 -17920 -21504 -7168 -20480 -19968 -10752 -6656 -4096 -8704 -21504 -5120 -4608 -13312 
    3584 -4096 6656 -1024 12800 4608 -1536 512 -11264 1024 4608 12288 9216 512 1024 10752 12288 4608 1024 13312 5632 6656 5120 1024 -8192 9728 -4096 3072 2048 -4608 -2048 2560 7168 -2560 -4096 -9216 -1536 -6144 -4608 4608 16384 -11264 -1024 8704 -1024 
    2048 -12288 6656 -8704 16384 512 -512 1024 -3584 1024 -4608 8192 -5120 -8192 7168 3072 2560 2560 -6656 16384 -6656 -512 -6144 2048 -6144 2560 -15872 2048 -3584 512 -5120 -3584 -1024 -9728 -3072 -10752 -9728 -9216 -3072 -1024 12800 -8192 512 13824 -6656 
-1536 -1024 512 -512 13824 6144 1536 5120 -4608 5120 -1024 11264 9216 4608 3072 3584 7680 8192 -2048 11264 -5120 18944 -512 4096 -10752 5120 -10240 -4608 512 6144 -6144 4096 7168 1024 4096 -13824 -10240 4096 10752 5120 10240 -12800 5632 11264 3584 
    7680 -17408 5632 -12288 16384 -2048 -4096 -7168 -7680 3584 -8704 5632 512 1024 -7680 1536 2560 2048 -2048 2048 2048 -2048 -8704 3584 -13312 1536 -19456 -2048 -5120 -6144 512 5120 -1536 -2048 -4608 -13824 -9728 -5120 -4096 1024 12288 -14336 -14848 6144 -8704 
    7168 -11776 4096 8192 5120 7168 3584 2560 -1024 3584 -11264 3072 3072 -3072 5632  0 3584 4096 7168 12800 13312 1024 -2048 2048 -4608 7680 -4096 2560 -3584 4096 5120 17408 4608 512 -4608 -3072 -6144 1536 -2048 5120 8192 -2560 3072 3584 6656 
    7168 -16384 -4096 512 9216  0 -3584 -1536 -10752 2048 -11264 19456  0 -4608 -10240 3584 -2048 6144 -3072 4608 -4096 3584 -512 -512 -7680 -1536 -17920 7168 -1024 7168 -1536 4608 10240 -16896 -12288 -14848 -3584 -5632 4608 -1536 18432 -11776 -6656 12800 -2048 
-1024 -23040 6656 -6144 5120 -512 2048 -4096 -9728 -11264 -9216 2048 -512 -14848 -4608 2048 1536 -512 -4608 5632 -5632 -4608 -12288 -8192 -13824 1024 -21504 -2560 -9728 1024 -2048 512 -16896 -13312 -5120 -20992 -7680 -7680 -9728 -4608 7168 -8704 -9728 11776 -2048 
    3584 512 -3584 -2560 2048 -3584 -10752 -11264 -8192 -4096 4096  0 -2560 -13312 2560 -512 5632 1024 1536 9216 -8704  0 -3072  0 -12288 -512 -7168 -4096 -3072 4096 -4608 -4608 -12288 -5120 -4096 -10240 -16384 -6656 -512 4608 2048 -10752 -3072 -512 -1536 
-11776 -20992 -9728 -14848 -3584 -13824 -15360 -9216 -19968 -9216 -15872 -512 -6144 -15360 -11264 -3584 2560 -8704 -15360 -2560 -15360 -3072 -14848 -6656 -16384 -8192 -20480 -9216 -10752 -13824 -13824 -3072 -14848 -20992 -10240 -21504 -10240 -19968 -7680 -11776 5632 -18432 -12800 3072 -10240 
    3072 -13312 -2560 -8192 512 -1536 -2560 -3072 -15360 4608 -6656 4096 -5632 -12800 -1024 2048 -4096 3584 -1024 6656 -8192 -2048 -10240 -11776 -20480 4096 -19968 -1536 -9728 -10240 -9728 -6144 -3584 -7680 -16384 -10240 -12800 -5120 -18432 1024 4608 -13312 -8704 -4096 -5632 
-1024 -17408 -512 -9728 512 -2560 -6144 -512 -11776 -12288 -12288 512 -4608 -6144 -5632 2048 -1024 -4608 -4608 2560 -15360 -3072 -18944 -7680 -16384  0 -10752 -6144 -9216 4096 -5120 1536 -5632 -7680 -6656 -19968 -5120 -1536 -7680 3584 3584 -13824 -6656 12288 -4096 
    5120 -2560 10752 -1024 4096 6656 3584 512 -9216 -512 -13312 8192 1536 3072 1024 1536 6656 4096 -1024 15360 3072 -2560 -10752 1024 -4608 4096 -6656 -4608 -3072 10752 -4096 -2048 4608 -9728 -512 -7680 -18432 -7680 -512 6144 9216 -15872 -5632 3584 -9728 
    6144 -8192 2560  0 11776 -3072 -1536 -1024 2560 3584 -3072 6656 -2560 -1536 5632 8192 10240 2048 7168 19456 7168 8192 5120 6656 -5632 10752 -4096 4608 -1024 5120 1024 5120 -1536 -4608 4608 -11776 1024 3584 6144 -1536 10240 -14848 -5632 5632 -3584 
15872 4608 22528 17408 18432 12288 7168 8704 1536 12288 1024 24064 18944 9216 10240 17920 12288 17920 13824 17920 8704 15872 10240 10752 512 9216 -8704 16384 12800 10240 12288 8192 18432 7168 2048 5632 4608 3584 9216 10240 22528  0 1536 17408 1536 
-5120 -28160 -6144 -11776 512 -5632 -15360 -16896 -11776 -12800 -21504 -6144 -4608 -17920 -23040 -11776 -13312 -11776 -19968 -9216 -20992 -13824 -21504 -12288 -18944 -12288 -21504 -11264 -8192 -12800 -14336 -2560 -11776 -8704 -10752 -18432 -13312 -13824 -15872 -14848  0 -25600 -12800 -10752 -12800 
    -512 -11776  0 -4096 9216  0 -12288 -512 -512 -3584 -9728 8704 -2560 -6656 -4096 512 2560 512 6656 7168 -8192 -8704 -6144 -5120 -18432 -3584 -5120 -1024 512 5632 -14848 3072 -6656 -9728 -3072 -12800 -8704 -6656 -5632 -5632 1536 -12800 -6656 -3584 -5120 
    6656 4096 12288 7680 10240 9216 -3584 7680 8704 9728 3584 17920 2048 7680 4096 4096 13312 12800 12288 24064 10240 11264 2048 11776 -10240 13312 -4608 8704 13824 11264 6144 3584 12800 11776 -512 3072 -4096 12288 3584 5632 17408 -10752 -3584 20992 -1536 
    3584 -10752 10752 -2560 11264 1536 -2048 -6144 -12288 2048 -4096 -1024 -10240 -4096 -16896 -3072  0 -8192 4096 4096 -4608 512 -6144 -1024 -6144 6656 -13312 -1024 -6656 3584 -8704 6656 -2048 -2048 -1536 -10240 -5632 -4096 -9728 -3584 1536 -12800 -5120 -1536 -4096 
b:45 
47.1621 
-32.8494 
30.0294 
-8.9893 
-5.28092 
4.61713 
-16.9991 
19.4085 
19.5158 
-17.1755 
4.64882 
-5.27878 
-8.95621 
29.9769 
-32.8287 
-110.201 
74.2029 
-65.0509 
18.8271 
12.4264 
-12.0408 
40.8423 
-42.3031 
-42.5339 
41.2273 
-12.1228 
12.4332 
18.7435 
-64.9325 
74.1606 
-34.9376 
165.339 
-744.538 
611.168 
-174.154 
-182.337 
496.668 
-151.891 
    -159.9 
497.949 
-180.916 
-174.056 
609.544 
-743.03 
165.089 
p: 

そしてGDBからスタックトレース:

bspline_fitting: /usr/include/eigen3/Eigen/src/Core/Block.h:122: Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Block(XprType&, Eigen::Index) [with XprType = Eigen::Matrix<double, -1, 1>; int BlockRows = 1; int BlockCols = 1; bool InnerPanel = false; Eigen::Index = long int]: Assertion `(i>=0) && (((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i<xpr.rows()) ||((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && i<xpr.cols()))' failed. 
Thread 1 "bspline_fitting" received signal SIGABRT, Aborted. 
0x00007ffff534e860 in raise() from /usr/lib/libc.so.6 
(gdb) where 
#0 0x00007ffff534e860 in raise() from /usr/lib/libc.so.6 
#1 0x00007ffff534fec9 in abort() from /usr/lib/libc.so.6 
#2 0x00007ffff53470bc in __assert_fail_base() from /usr/lib/libc.so.6 
#3 0x00007ffff5347133 in __assert_fail() from /usr/lib/libc.so.6 
#4 0x00005555559e7405 in Eigen::Block<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 1, 1, false>::Block (this=0x7fffffffd530, xpr=..., i=-4591537738753454899) at /usr/include/eigen3/Eigen/src/Core/Block.h:120 
#5 0x00005555559ded86 in Eigen::DenseBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >::row (this=0x7fffffffd4a0, i=-4591537738753454899) at /usr/include/eigen3/Eigen/src/Core/../plugins/BlockMethods.h:861 
#6 0x00005555559e3f0f in Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >::_solve_impl<Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const>, Eigen::Matrix<double, -1, 1, 0, -1, 1> > (this=0x7fffffffdaa0, rhs=..., dst=...) at /usr/include/eigen3/Eigen/src/QR/FullPivHouseholderQR.h:561 
#7 0x00005555559dc75c in Eigen::internal::Assignment<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> >, Eigen::internal::assign_op<double, double>, Eigen::internal::Dense2Dense, void>::run (
    dst=..., src=...) at /usr/include/eigen3/Eigen/src/Core/Solve.h:147 
#8 0x00005555559d4f4c in Eigen::internal::call_assignment_no_alias<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> >, Eigen::internal::assign_op<double, double> > (dst=..., src=..., func=...) 
    at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:836 
#9 0x00005555559cd8de in Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >::_set_noalias<Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> > > (this=0x7fffffffd730, other=...) 
    at /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:728 
#10 0x00005555559cd76f in Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >::_init1<Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> >, Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> > > (this=0x7fffffffd730, other=...) at /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:812 
#11 0x00005555559c4d73 in Eigen::Matrix<double, -1, 1, 0, -1, 1>::Matrix<Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> > > (this=0x7fffffffd730, x=...) at /usr/include/eigen3/Eigen/src/Core/Matrix.h:296 
#12 0x00005555559ba6fe in Eigen::DenseBase<Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> > >::eval (this=0x7fffffffd990) at /usr/include/eigen3/Eigen/src/Core/DenseBase.h:406 
#13 0x00005555559aceaf in Eigen::operator<< <Eigen::Solve<Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const> > > (s=..., m=...) at /usr/include/eigen3/Eigen/src/Core/IO.h:220 
#14 0x00005555559a2046 in vlw::o::exact_newton::converge<optimization::cinpact_scenario<std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>, glm::vec<2, double, (glm::qualifier)0>, double>::cinpact_k_c_w_with_lls_and_exact_newton_and_wolfe()::{lambda()#1}, optimization::cinpact_scenario<std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>, glm::vec<2, double, (glm::qualifier)0>, double>::cinpact_k_c_w_with_lls_and_exact_newton_and_wolfe()::{lambda(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&)#2}, glm::vec<2, double, (glm::qualifier)0>, double>(optimization::cinpact_scenario<std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>, glm::vec<2, double, (glm::qualifier)0>, double>::cinpact_k_c_w_with_lls_and_exact_newton_and_wolfe()::{lambda()#1}, optimization::cinpact_scenario<std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>, glm::vec<2, double, (glm::qualifier)0>, double>::cinpact_k_c_w_with_lls_and_exact_newton_and_wolfe()::{lambda(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&)#2}, vlw::o::non_linear_least_squares_problem<glm::vec<2, double, (glm::qualifier)0>, double>&, unsigned long, vlw::o::non_linear_least_squares_problem) (step_finished=..., alpha_search=..., problem=..., max_iterations=200, threshold=1.0000000000000001e-05) 
    at /media/Crypt/School-Repos/curve-optimization/vlw/vlw/optimization/exact_newton.hpp:130 
#15 0x000055555599945e in optimization::cinpact_scenario<std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>, glm::vec<2, double, (glm::qualifier)0>, double>::cinpact_k_c_w_with_lls_and_exact_newton_and_wolfe() (this=0x555556143090) at /media/Crypt/School-Repos/curve-optimization/src/cinpact_scenario.hpp:825 
#16 0x0000555555994586 in optimization::cinpact_scenario<std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>, glm::vec<2, double, (glm::qualifier)0>, double>::perform7() (this=0x555556143090) at /media/Crypt/School-Repos/curve-optimization/src/cinpact_scenario.hpp:818 
#17 0x0000555555923332 in CurveWindow::perform7 (this=0x7fffffffe090) at /media/Crypt/School-Repos/curve-optimization/src/main.cpp:887 
#18 0x0000555555921ac1 in CurveWindow::keyPressEvent (this=0x7fffffffe090, ev=0x7fffffffde30) at /media/Crypt/School-Repos/curve-optimization/src/main.cpp:683 
#19 0x00007ffff67d5a35 in QWindow::event(QEvent*)() from /usr/lib/libQt5Gui.so.5 
#20 0x0000555555a67d01 in OpenGLWindow::event (this=0x7fffffffe090, event=0x7fffffffde30) at /media/Crypt/School-Repos/curve-optimization/src/openglwindow.cpp:106 
#21 0x00007ffff625806b in QCoreApplication::notify(QObject*, QEvent*)() from /usr/lib/libQt5Core.so.5 
#22 0x00007ffff62581e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*)() from /usr/lib/libQt5Core.so.5 
#23 0x00007ffff67c6012 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*)() from /usr/lib/libQt5Gui.so.5 
#24 0x00007ffff67cb166 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)() from /usr/lib/libQt5Gui.so.5 
#25 0x00007ffff67a2bbc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)() from /usr/lib/libQt5Gui.so.5 
#26 0x00007fffeef5015d in ??() from /usr/lib/libQt5XcbQpa.so.5 
#27 0x00007ffff625682b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)() from /usr/lib/libQt5Core.so.5 
#28 0x00007ffff625fb18 in QCoreApplication::exec()() from /usr/lib/libQt5Core.so.5 
#29 0x000055555592354d in main (argc=1, argv=0x7fffffffe238) at /media/Crypt/School-Repos/curve-optimization/src/main.cpp:914 
(gdb) up 
#1 0x00007ffff534fec9 in abort() from /usr/lib/libc.so.6 
(gdb) 
#2 0x00007ffff53470bc in __assert_fail_base() from /usr/lib/libc.so.6 
(gdb) 
#3 0x00007ffff5347133 in __assert_fail() from /usr/lib/libc.so.6 
(gdb) 
#4 0x00005555559e7405 in Eigen::Block<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 1, 1, false>::Block (this=0x7fffffffd530, xpr=..., i=-4591537738753454899) at /usr/include/eigen3/Eigen/src/Core/Block.h:120 
120   eigen_assert((i>=0) && (
(gdb) 
#5 0x00005555559ded86 in Eigen::DenseBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >::row (this=0x7fffffffd4a0, i=-4591537738753454899) at /usr/include/eigen3/Eigen/src/Core/../plugins/BlockMethods.h:861 
861  return RowXpr(derived(), i); 
(gdb) 
#6 0x00005555559e3f0f in Eigen::FullPivHouseholderQR<Eigen::Matrix<double, -1, -1, 0, -1, -1> >::_solve_impl<Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const>, Eigen::Matrix<double, -1, 1, 0, -1, 1> > (this=0x7fffffffdaa0, rhs=..., dst=...) at /usr/include/eigen3/Eigen/src/QR/FullPivHouseholderQR.h:561 
561   c.row(k).swap(c.row(m_rows_transpositions.coeff(k))); 
(gdb) print k 
$1 = 0 
(gdb) print m_rows_transpositions.coeff(k) 
$2 = (const Eigen::PlainObjectBase<Eigen::Matrix<long, 1, -1, 1, 1, -1> >::Scalar &) @0x555556143a80: -4591537738753454899 
+1

[最小、完全、および検証可能な例](https://stackoverflow.com/help/mcve)を提供できますか?できるだけシンプルな 'main()' – lakeweb

+1

私は2日前に同じ質問に答えました:https://stackoverflow.com/questions/47800872、[auto](http://eigen.tuxfamily.org) /dox/TopicPitfalls.html)。 – ggael

+0

ありがとう@ggael - それはそれでした。私は答えとしてあなたのコメントを記入することはできませんが、実際に答えたら、私はそれを幸せに答えとしてマークします。 –

答えて

0

これは私の二重の失敗でした。

  1. 私は、ドキュメントを読んでいない - https://eigen.tuxfamily.org/dox/TopicPitfalls.html
  2. 私は正常すでにそれで答えと質問答えが見つかりませんでした:あなたが代わりにautoを使用する場合は、基本的にWhat is the correct way to solve a least square equation with eigen?

を適切な行列型を使用すると、実際に抽象式である型を取得します。これは問題を引き起こし、時々パフォーマンスが参照をぶら下げることがあります。どのタイプのコンパイラが推測し、そのタイプを本当に使用したいのか分からない限り、autoは使わないでください。

関連する問題