From b2bacd8894b940abd9df6476a6e39e6a7ab61cf3 Mon Sep 17 00:00:00 2001 From: kradchen Date: Tue, 16 May 2023 10:00:53 +0800 Subject: [PATCH] Add Matrix-Vector and Matrix-Matrix product function mul to Matrix class. --- src/Matrix.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++ src/Matrix.h | 17 ++++++++++ test/Matrix_Test.cpp | 28 ++++++++++++++++ 3 files changed, 125 insertions(+) diff --git a/src/Matrix.cpp b/src/Matrix.cpp index ea24216..b5314b9 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -1,5 +1,6 @@ #include "Matrix.h" +#include #include #include #include @@ -833,6 +834,85 @@ namespace Aurora { return Matrix::New(newBuffer,aMatrix); } + Matrix Matrix::mul(const Matrix& aOther){ + if (isNull() || aOther.isNull()){ + std::cerr<<"Mul operation fail, Matrix is null!"<1 || aOther.getDimSize(2)>1){ + std::cerr<<"In matrix mul operation not support 3d data!"< 1){ + std::cerr<<"In matrix mul operation Left vector must be a column vector!"<