Overview
A lightweight, dependency-free C++ linear algebra library for dense vectors and matrices. Implements vector and matrix operations including dot products, norms, transposition, and multiplication — using only the C++ standard library. Built with CMake and includes a full test suite via CTest.
Key Features
- Vector operations: addition, subtraction, dot product, norm, normalisation
- Matrix operations: multiplication, transpose, scalar operations
- Matrix × Vector and Vector × Matrix multiplication
- Zero external dependencies — C++ standard library only
- CMake build system with CTest integration
- Installable via find_package or as a subdirectory
Code Example
main.cpp
#include "tinyeigen/Vector.h"
#include "tinyeigen/Matrix.h"
int main() {
using tinyeigen::Vector;
using tinyeigen::Matrix;
// Vectors
Vector a(3);
a[0] = 1.0; a[1] = 2.0; a[2] = 3.0;
Vector b(3);
b[0] = 4.0; b[1] = 5.0; b[2] = 6.0;
Vector c = a + b; // element-wise addition
double d = a.Dot(b); // dot product → 32
double n = a.Norm(); // L2 norm → √14
Vector u = a.Normalize(); // unit vector
// Matrices
Matrix m(2, 2);
m(0, 0) = 1.0; m(0, 1) = 2.0;
m(1, 0) = 3.0; m(1, 1) = 4.0;
Matrix t = m.Transpose();
Matrix p = m * m; // matrix multiplication
return 0;
}Technologies
C++CMakeCTest