Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.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(4);
00009   
00010   mat << 1, 2, 6, 9,
00011          3, 1, 7, 2;
00012          
00013   v << 0,1,2,3;
00014        
00015   //add v to each row of m
00016   mat.rowwise() += v;
00017   
00018   std::cout << "Broadcasting result: " << std::endl;
00019   std::cout << mat << std::endl;
00020 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:27