tut_arithmetic_matrix_mul.cpp File Reference
#include <iostream>
#include <Eigen/Dense>

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
4  {
5  Eigen::Matrix2d mat;
6  mat << 1, 2, 3, 4;
7  Eigen::Vector2d u(-1, 1), v(2, 0);
8  std::cout << "Here is mat*mat:\n" << mat * mat << std::endl;
9  std::cout << "Here is mat*u:\n" << mat * u << std::endl;
10  std::cout << "Here is u^T*mat:\n" << u.transpose() * mat << std::endl;
11  std::cout << "Here is u^T*v:\n" << u.transpose() * v << std::endl;
12  std::cout << "Here is u*v^T:\n" << u * v.transpose() << std::endl;
13  std::cout << "Let's multiply mat by itself" << std::endl;
14  mat = mat * mat;
15  std::cout << "Now mat is mat:\n" << mat << std::endl;
16 }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
Eigen::SparseMatrix< double > mat
Definition: EigenUnitTest.cpp:10
TransposeReturnType transpose()
Definition: SparseMatrixBase.h:358

References Eigen::SparseMatrixBase< Derived >::transpose(), and v.