Add new max function

This commit is contained in:
kradchen
2023-05-19 13:44:00 +08:00
parent 3b894d24bf
commit e32367b7dc
2 changed files with 16 additions and 1 deletions

View File

@@ -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!"

View File

@@ -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 目标矩阵