/* * Copyright (C) 2020 Christopher J. Howard * * This file is part of Antkeeper source code. * * Antkeeper source code is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Antkeeper source code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Antkeeper source code. If not, see . */ #ifndef ANTKEEPER_MATH_MATRIX_OPERATORS_HPP #define ANTKEEPER_MATH_MATRIX_OPERATORS_HPP #include "math/matrix-type.hpp" #include "math/matrix-functions.hpp" namespace math { namespace matrix_operators { /// @addtogroup matrix /// @{ /// @copydoc add(const matrix&, const matrix&) template matrix operator+(const matrix& x, const matrix& y); /// @copydoc mul(const matrix&, const matrix&) template matrix operator*(const matrix& x, const matrix& y); /// @copydoc mul(const matrix&, T) template matrix operator*(const matrix& m, T s); /// @copydoc mul(const matrix&, T) template matrix operator*(T s, const matrix& m); /// @copydoc mul(const matrix&, const vector&) template vector operator*(const matrix& m, const vector& v); /// @copydoc sub(const matrix&, const matrix&) template matrix operator-(const matrix& x, const matrix& y); template inline matrix operator+(const matrix& x, const matrix& y) { return add(x, y); } template inline matrix operator*(const matrix& x, const matrix& y) { return mul(x, y); } template inline matrix operator*(const matrix& m, T s) { return mul(m, s); } template inline matrix operator*(T s, const matrix& m) { return mul(m, s); } template inline vector operator*(const matrix& m, const vector& v) { return mul(m, v); } template inline matrix operator-(const matrix& x, const matrix& y) { return sub(x, y); } /// @} } // namespace matrix_operators } // namespace math // Bring matrix operators into global namespace using namespace math::matrix_operators; #endif // ANTKEEPER_MATH_MATRIX_OPERATORS_HPP