Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp File Reference

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 5 of file Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp.

6 {
7  Eigen::MatrixXf mat(2,4);
9 
10  mat << 1, 2, 6, 9,
11  3, 1, 7, 2;
12 
13  v << 0,
14  1;
15 
16  //add v to each column of m
17  mat.colwise() += v;
18 
19  std::cout << "Broadcasting result: " << std::endl;
20  std::cout << mat << std::endl;
21 }
Array< int, Dynamic, 1 > v
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182