LoginSignup
4
3

More than 5 years have passed since last update.

Mac+XcodeでEigenを使う

Posted at

EigenはC++で使える線形代数ライブラリです。

Xcodeを使う

usr/local/include あたりにHeader Search Pathsを設定

Screen Shot 2016-01-10 at 3.58.50 PM.png

ダウンロードしたブツのEigen以下を設置

Screen Shot 2016-01-10 at 4.06.26 PM.png

#include <iostream>

#include <Eigen/Core>
#include <Eigen/Geometry>


int main() {
    using namespace Eigen;

    Matrix3d A, B;

    A << 3.0, 6.0, 3.0,
    2.0, 1.0, 2.0,
    1.0, 2.0, 1.0;
    int k = 0;

    B << 1.0, 0.0, 0.0,
    -A(k+1,k)/A(k,k), 1.0, 0.0,
    -A(k+2,k)/A(k,k), 0.0, 1.0;


    std::cout << "m\n" << B * A << std::endl;
}
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3