Sign in

CADCAE / eigen · Files

Logo

GitLab

  • Back to group
  • Project
  • Activity
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • eigen
  • doc
  • examples
  • Tutorial_ArrayClass_addition.cpp
  • init & last commit
    b689729d
    yangda authored
    2019-11-04 11:46:45 +0800  
    Browse Code ยป
Tutorial_ArrayClass_addition.cpp 400 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#include <Eigen/Dense>
#include <iostream>

using namespace Eigen;
using namespace std;

int main()
{
  ArrayXXf a(3,3);
  ArrayXXf b(3,3);
  a << 1,2,3,
       4,5,6,
       7,8,9;
  b << 1,2,3,
       1,2,3,
       1,2,3;
       
  // Adding two arrays
  cout << "a + b = " << endl << a + b << endl << endl;

  // Subtracting a scalar from an array
  cout << "a - 2 = " << endl << a - 2 << endl;
}