Reply to topic

Wrong matrix size and operator <<

User avatar VictorL
Registered Member
Posts
7
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
7
Karma
0
OS
I got two good answers on StackOverflow :
http://stackoverflow.com/questions/2316 ... de-compile

Bye!

 
Reply to topic

Bookmarks



Who is online

Registered users: aav1307, andreas_k, Baidu [Spider], Bing [Bot], bszlrd, claydoh, davidemme, Google [Bot], google01103, gregormi, kamathraghavendra, koriun, Majestic-12 [Bot], mmolch, nuttshell, pedrorodriguez, rumangerst, TheraHedwig, Yahoo [Bot]