2010-06-28 18:42:09 +01:00
|
|
|
#include <Eigen/Dense>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
int main() {
|
2021-12-07 19:57:38 +00:00
|
|
|
Eigen::ArrayXXf m(2, 2);
|
2023-12-05 21:22:55 +00:00
|
|
|
|
2010-07-12 22:45:57 +01:00
|
|
|
// assign some values coefficient by coefficient
|
2010-06-28 18:42:09 +01:00
|
|
|
m(0, 0) = 1.0;
|
|
|
|
|
m(0, 1) = 2.0;
|
2010-07-12 22:45:57 +01:00
|
|
|
m(1, 0) = 3.0;
|
|
|
|
|
m(1, 1) = m(0, 1) + m(1, 0);
|
2023-12-05 21:22:55 +00:00
|
|
|
|
2010-07-12 22:45:57 +01:00
|
|
|
// print values to standard output
|
2021-12-07 19:57:38 +00:00
|
|
|
std::cout << m << std::endl << std::endl;
|
2023-12-05 21:22:55 +00:00
|
|
|
|
2010-06-28 18:42:09 +01:00
|
|
|
// using the comma-initializer is also allowed
|
|
|
|
|
m << 1.0, 2.0, 3.0, 4.0;
|
2023-12-05 21:22:55 +00:00
|
|
|
|
2010-07-12 22:45:57 +01:00
|
|
|
// print values to standard output
|
2021-12-07 19:57:38 +00:00
|
|
|
std::cout << m << std::endl;
|
2010-06-28 18:42:09 +01:00
|
|
|
}
|