Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ lincpp Public

simple linear algebra c++ header only library for educational purpose :D

License

Notifications You must be signed in to change notification settings

vitingr/lincpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

lincpp

simple linear algebra c++ header only library - educational purpose

Features

  • Matrix multiplication
  • Matrix transpose
  • Matrix Inversion

Usage

#include "mat.hpp"
using namespace lin;
int main(int argc, char* argv[]){
 
 //definition Mat<type> name(rows, cols);
 Mat<double> n(2,2);
 
 // fill matrix with value
 n = 0;
 // | 0.0 0.0 |
 // | 0.0 0.0 |
 
 n = {0.0, 1.0, 2.0, 3.0};
 // | 0.0 1.0 |
 // | 2.0 3.0 |
 
 n = n.T(); // matrix transpose
 // | 0.0 2.0 |
 // | 1.0 3.0 |
 
 n = n.I() // matrix identity
 // | 1.0 0.0 |
 // | 0.0 1.0 |
 
 // multiplication by scalar
 n = n*2.5;
 // | 2.5 0.0 |
 // | 0.0 2.5 |
 
 // division by scalar
 n = n/5;
 // | 0.5 0.0 |
 // | 0.0 0.5 |
 
 // matrix multiplication
 n = n*n.I();
 // | 0.5 0.0 |
 // | 0.0 0.5 |
 
 // Matrix sum and subtraction
 n = n - n*0.1;
 // | 0.4 0.0 |
 // | 0.0 0.4 |
 
 bool success;
 n = n.inverse(success); // matrix inverse
 
 // element access n(row, col)
 n(1,0) = 20;
 // | 0.4 0.0 |
 // | 20.0 0.4 |
 
 
}

About

simple linear algebra c++ header only library for educational purpose :D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /