Skip to content

Instantly share code, notes, and snippets.

@jefftrull
Created April 23, 2018 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jefftrull/d3f9e6594983d92412b8d35857c619d4 to your computer and use it in GitHub Desktop.
Save jefftrull/d3f9e6594983d92412b8d35857c619d4 to your computer and use it in GitHub Desktop.
// demonstrating use of Eigen::Map
#include <iostream>
#include <vector>
#include <Eigen/Dense>
int main() {
using namespace Eigen;
std::vector<float> foo{1.0, 2.0, 3.0, 4.0};
Map<Matrix<float, Dynamic, 1>> foom(foo.data(), foo.size());
IOFormat OctaveFmt(StreamPrecision, 0, ", ", ";\n", "", "", "[", "]");
std::cout << "foo as row vector=\n" << foom.format(OctaveFmt) << "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment