Eigen (C++)

Eigen is an efficient high-level C++ library for linear algebra related computations, which only depends on the C++ standard library.

Matrix-Vector definitions are as follows:

The fact that we only pass one number to the Explicit matrices hint that they can only be used for square matrices.

Matrices can be initialized via functions, or manually. Accessing the values are straightforward as well.

// initialize via functions
matA.setZero();
matA.setOnes();
matA.setIdentity();
matA.setConstant(value);
matA.setRandom();

// initialize manually
Eigen::Matrix2f matA;
matA << 1.3, 4.2, 7.5, 9.7;
// matA = [ 1.3  4.2 ]
//        [ 7.5  9.7 ]

// access single entry
matA(0,0) // 1.3

// access block matrix
matA(a,b,c,d) // returns block with (a,b) upper left corner, (c,d) lower right corner

// access rows and columns
matA.row(1) // [1.3  4.2]
matA.col(0) // [1.3  7.5]^T

Emacs 29.4 (Org mode 9.6.15)