LoginSignup
0
0

More than 3 years have passed since last update.

wemosでeigen

Last updated at Posted at 2019-07-09

概要

wemosでeigenやってみた。
行列で九九やってみた。

結果

image

サンプルコード

#include <vector>
#include <Eigen.h>
#include <Eigen/LU>
#include <Eigen/Dense>

using namespace Eigen;
void print_m(const Eigen::MatrixXd &X)
{
    int i,
        j,
        nrow,
        ncol;
    nrow = X.rows();
    ncol = X.cols();
    Serial.print("nrow: ");
    Serial.println(nrow);
    Serial.print("ncol: ");
    Serial.println(ncol);
    for (i = 0; i < nrow; i++)
    {
        for (j = 0; j < ncol; j++)
        {
            Serial.print(X(i, j), 6);
            Serial.print(", ");
        }
        Serial.println();
    }
}
void setup()
{
    MatrixXd a;
    MatrixXd b;
    MatrixXd c;
    Serial.begin(9600);
    a = MatrixXd(9, 1);
    a << 1, 2, 3, 4, 5, 6, 7, 8, 9;
    print_m(a);
    b = MatrixXd(1, 9);
    b << 1, 2, 3, 4, 5, 6, 7, 8, 9;
    print_m(b);
    c = a * b;
    print_m(c);
}
void loop()
{
    delay(300);
}

以上。

0
0
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
0
0