Arithmetic Operations - Shivix/MatLib GitHub Wiki

Matrix has all basic arithmetic operators overloaded to perform matrix arithmetic.

MatLib::matrix<float, 3, 3> exampleMatrix = {{{{0, 1, 2},
                                               {3, 4, 5},
                                               {6, 7, 8}
}}};
MatLib::matrix<float, 3, 3> exampleMatrix2 = {{{{0, 1, 2},
                                                {3, 4, 5},
                                                {6, 7, 8}
}}};
auto resultMatrix = exampleMatrix * exampleMatrix2;
auto resultMatrix = exampleMatrix / exampleMatrix2;
auto resultMatrix = exampleMatrix + exampleMatrix2;
auto resultMatrix = exampleMatrix - exampleMatrix2;

All arithmetic assignment operators (e.g. =+) are implemented also.