Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <Eigen/Dense>
00003 
00004 using namespace std;
00005 int main()
00006 {
00007   Eigen::MatrixXf mat(2,4);
00008   Eigen::VectorXf v(2);
00009   
00010   mat << 1, 2, 6, 9,
00011          3, 1, 7, 2;
00012          
00013   v << 0,
00014        1;
00015        
00016   //add v to each column of m
00017   mat.colwise() += v;
00018   
00019   std::cout << "Broadcasting result: " << std::endl;
00020   std::cout << mat << std::endl;
00021 }


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:33:55