From ce91b7a868f9684c75ad260d8c719ecd1c72350c Mon Sep 17 00:00:00 2001 From: kradchen Date: Mon, 29 May 2023 11:09:09 +0800 Subject: [PATCH] Add Matrix method setBlockValue --- src/Matrix.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++ src/Matrix.h | 2 ++ test/Matrix_Test.cpp | 32 +++++++++++++++++++--- 3 files changed, 94 insertions(+), 3 deletions(-) diff --git a/src/Matrix.cpp b/src/Matrix.cpp index 8043598..aec01ea 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -616,6 +616,69 @@ namespace Aurora { } + } + + bool Matrix::setBlockValue(int aDim,int aBeginIndex, int aEndIndex, double value) { + if(aDim>2 ){ + std::cerr<<"block only support 1D-3D data!"<1){ + aDim = 1; + } + if (aBeginIndex>=getDimSize(aDim) || aBeginIndex<0){ + std::cerr<<"block BeginIndx error!BeginIndx:"<=getDimSize(aDim) || aEndIndex<0){ + std::cerr<<"block EndIndex error!EndIndex:"<