From dbd69936bdc55f83681a249a21d61c37f87efaa8 Mon Sep 17 00:00:00 2001 From: kradchen Date: Fri, 5 May 2023 15:03:22 +0800 Subject: [PATCH] Add forceReshape to Matrix --- src/Matrix.cpp | 5 +++++ src/Matrix.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/Matrix.cpp b/src/Matrix.cpp index b806c5f..7de7d2e 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -300,6 +300,11 @@ namespace Aurora { return ret; } + void Matrix::forceReshape(int rows, int columns, int slices) + { + mInfo = {rows,columns,slices}; + } + bool Matrix::compareShape(const Matrix &other) const { if (mInfo[2] == 1 && other.mInfo[2] == 1) { if (mInfo[0]==1 && other.mInfo[1] == 1 && mInfo[1] == other.mInfo[0]) return true; diff --git a/src/Matrix.h b/src/Matrix.h index 3edf183..dded537 100644 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -233,6 +233,8 @@ namespace Aurora { return false; } + void forceReshape(int rows, int columns, int slices); + private: ValueType mValueType = Normal; std::shared_ptr mData;