This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Wrong matrix size and operator <<

Tags: None
(comma "," separated)
User avatar
VictorL
Registered Member
Posts
14
Karma
0
OS

Wrong matrix size and operator <<

Fri Apr 18, 2014 10:26 pm
Hi,

How does this compile/run without error ? :o

Code: Select all
#include <iostream>
#include <stdio.h>
#include <Eigen/Dense>

int
main (int argc, char *argv[])
{
   typedef Eigen::Matrix<double, 5, 3/*FIXME: Should be 5*/> Matrix5;

   Matrix5 langrange_coefs;
   langrange_coefs <<    2,0,0,1,1, 
                  0,2,0,1,1,
                  0,0,2,2,2,
                  0,1,2,0,0,
                  0,1,1,0,0; // We filled a 5*5 matrix in a 5*3 matrix

   //std::cout << "langrange_coefs:\n" << langrange_coefs << std::endl;
   return (0);
}


Without the printing; no error happens; with the printing; it throws a seg fault.

Bye
User avatar
VictorL
Registered Member
Posts
14
Karma
0
OS
I got two good answers on StackOverflow :
http://stackoverflow.com/questions/2316 ... de-compile

Bye!


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell