diff --git a/src/Function2D.cpp b/src/Function2D.cpp index 207686e..7906834 100644 --- a/src/Function2D.cpp +++ b/src/Function2D.cpp @@ -359,6 +359,12 @@ Matrix Aurora::max(const Matrix &aMatrix, const Matrix &aOther) { } } +Matrix Aurora::max(const Matrix &aMatrix, const double aValue){ + double *output = malloc(1); + output[0] = aValue; + return max(aMatrix,Matrix::New(output, 1,1,1)); +} + Matrix Aurora::sum(const Matrix &aMatrix, FunctionDirection direction) { if (aMatrix.getDimSize(2)>1 ) { std::cerr<< "sum() not support 3D data!" diff --git a/src/Function2D.h b/src/Function2D.h index c57aa24..ab2be23 100644 --- a/src/Function2D.h +++ b/src/Function2D.h @@ -51,7 +51,7 @@ namespace Aurora */ Matrix min(const Matrix &aMatrix, const Matrix &aOther); - /** + /** * 比较两个矩阵,求对应位置的最大值,不支持三维 * @attention 矩阵形状不一样时,如A为[MxN],则B应为标量或[1xN]的行向量 * @param aMatrix 目标矩阵1 @@ -60,6 +60,15 @@ namespace Aurora */ Matrix max(const Matrix &aMatrix, const Matrix &aOther); + /** + * 比较矩阵和产量,求对应位置的最大值 + * @attention 矩阵形状不一样时,如A为[MxN],则B应为标量或[1xN]的行向量 + * @param aMatrix 目标矩阵1 + * @param aOther 目标矩阵2 + * @return 最大值矩阵 + */ + Matrix max(const Matrix &aMatrix, const double aValue); + /** * 求矩阵和,可按行、列、单元, 目前不支持三维 * @param aMatrix 目标矩阵