Bugzilla – Attachment 725 Details for
Bug 1283
Bad assertion error in debug mode and wrong result in release mode while evaluating product involving dynamic-size block
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
Program demonstrating issue
main.cpp (text/x-csrc), 1.31 KB, created by
twan_koolen
on 2016-08-29 20:03:13 UTC
(
hide
)
Description:
Program demonstrating issue
Filename:
MIME Type:
Creator:
twan_koolen
Created:
2016-08-29 20:03:13 UTC
Size:
1.31 KB
patch
obsolete
>#include <iostream> >#include <Eigen/Core> > >using namespace Eigen; > >int main() { > const int k = 3; > const int n = 2; > const int m = 2; > > assert(k >= m); > > typedef Matrix<double, 1, k> MatType; > MatType a = MatType::Random(1, k); >// auto a_block = a.block<1, m>(0, 0); // fine > auto a_block = a.block(0, 0, 1, m); // 1 x m dynamic-size block of 1 x k matrix > > MatrixXd b(m, n); > b.setRandom(); > > std::cout << "a rows: " << a.rows() << ", cols: " << a.cols() << std::endl; > std::cout << "a_block rows: " << a_block.rows() << ", cols: " << a_block.cols() << std::endl; > std::cout << "b rows: " << b.rows() << ", cols: " << b.cols() << std::endl; > > MatrixXd c = a_block * b; > std::cout << "c rows: " << c.rows() << ", cols: " << c.cols() << std::endl; > > MatrixXd d(c.rows(), c.cols()); > std::cout << "d rows: " << d.rows() << ", cols: " << d.cols() << std::endl; > d = a_block * b; // Assertion failed: ((i>=0) && ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i<xpr.rows()) ||((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && i<xpr.cols()))), function Block, file /Users/twan/code/eigen/Eigen/src/Core/Block.h, line 122. > > // output before assertion error: > // a rows: 1, cols: 3 > // a_block rows: 1, cols: 2 > // b rows: 2, cols: 2 > // c rows: 1, cols: 2 > // d rows: 1, cols: 2 > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1283
: 725