28 using Eigen::Matrix3f;
29 using Eigen::MatrixXf;
35 int main(
int argc,
char **argv) {
37 const unsigned int repeats = 10;
48 MatrixXf M100 = MatrixXf::Random(100,100);
52 for (
unsigned int i = 0; i < repeats; ++i ) {
57 for (
unsigned int i = 0; i < repeats; ++i ) {
58 M3 = Matrix3f::Random();
61 times[0] += stopwatch.split();
64 for (
unsigned int i = 0; i < repeats; ++i ) {
65 M100 = MatrixXf::Random(100,100);
67 M100I = M100.inverse();
68 times[1] += stopwatch.split();
71 for (
unsigned int i = 0; i < repeats; ++i ) {
72 M100 = MatrixXf::Random(100,100);
74 M100I = M100.fullPivLu().inverse();
75 times[2] += stopwatch.split();
79 std::cout << std::endl;
80 std::cout <<
"************** Eigen3 Inverse ***************" << std::endl;
81 std::cout << std::endl;
82 std::cout <<
" 3x3 (direct by val) : " << format(
static_cast<double>(times[0])/
static_cast<double>(repeats)) << std::endl;
83 std::cout <<
" 100x100 (PPivLU by val) : " << format(
static_cast<double>(times[1])/
static_cast<double>(repeats)) << std::endl;
84 std::cout <<
" 100x100 (FPivLU by val) : " << format(
static_cast<double>(times[2])/
static_cast<double>(repeats)) << std::endl;
85 std::cout << std::endl;