weird matrix multiplication results (eigen)

1
2
3
4
5
6
7
8
9
10
11
	Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> test(3, 2);
	test <<
		1, 2,
		3, 4,
		5, 6;

	Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> m = test.transpose();
	Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> an = m * test;
	cout << "matrix:" << endl << test << endl << endl;
	cout << "matrix T:" << endl << m << endl << endl;
	cout << "matrix T*matrix:" << endl << an << endl << endl;


output:

matrix:
1 2
3 4
5 6

matrix T:
1 3 5
2 4 6

matrix T*matrix:
35 44
44 56


shoulnd't matrix T*mtrix(0,0) = 32 not 35?

here's how i calculate those matrices manually:
(0,0) = (1 * 1) + (3 * 3) + ( 5 * 5 ) = 1 + 6 + 25 = 32
(0,1) = (1 * 2) + ( 3 * 4 ) + ( 5 * 6 ) = 2 + 12 + 30 = 44
(1,0) = (2 * 1) + ( 4 * 3 ) + ( 6 * 5 ) = 2 + 12 + 30 = 44
(1,1) = (2*2) + (4*4) + (6*6) = 4 + 16 + 36 = 56

what am i doing wrong here?
Am I wrong or is eigen wrong here?
Thanks!
You write:
(3 * 3) = 6
oh god, thank you so much.
I checked my calculations so many times, just so many times and I guess for me 3 * 3 started being 6 instead of 9.
Topic archived. No new replies allowed.