`
soboer
  • 浏览: 1311727 次
文章分类
社区版块
存档分类
最新评论

鞍点

 
阅读更多
template<class Type>
void minmax(Type *s, int m, int n){
int *row=new Type[m], *col=new Type[n];
int i, j;
for (i=0; i<m; i++) {
row[i]=*(s+i*n);
for (j=0; j<n; j++)
if (row[i]>*(s+i*n+j)) row[i]=*(s+i*n+j); //行中最小
}
for (j=0; j<n; j++) {
col[j]=*(s+j*m);
for (i=0; i<m; i++)
if (col[j]<*(s+i*n+j)) col[j]=*(s+i*n+j); //列中最大
}
for (i=0; i<m; i++)
for (j=0; j<n; j++)
if (row[i]==col[j])
cout<<"The saddle point is at ("<<i<<", "<<j<<")./n";
delete []row;
delete []col;
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics