本文整理汇总了C++中valarray::min方法的典型用法代码示例。如果您正苦于以下问题:C++ valarray::min方法的具体用法?C++ valarray::min怎么用?C++ valarray::min使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类valarray
的用法示例。
在下文中一共展示了valarray::min方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateEigenSystem
bool updateEigenSystem(unsigned max_tries, unsigned max_iters) {
if (max_iters==0) max_iters = 30 * p.n;
static double lastGoodMinimumEigenValue = 1.0;
/* Try to get a valid calculation */
for (unsigned tries = 0; tries < max_tries; ++tries) {
unsigned iters = eig( p.n, C, d, B, max_iters);
if (iters < max_iters)
{ // all is well
/* find largest/smallest eigenvalues */
double minEV = d.min();
double maxEV = d.max();
/* (MK Original comment was) :Limit Condition of C to dMaxSignifKond+1
* replaced dMaxSignifKond with 1./numeric_limits<double>::epsilon()
* */
if (maxEV * numeric_limits<double>::epsilon() > minEV) {
double tmp = maxEV * numeric_limits<double>::epsilon() - minEV;
minEV += tmp;
for (unsigned i=0;i<p.n;++i) {
C[i][i] += tmp;
d[i] += tmp;
}
} /* if */
lastGoodMinimumEigenValue = minEV;
d = sqrt(d);
//flgEigensysIsUptodate = 1;
//genOfEigensysUpdate = gen;
//clockeigensum += clock() - clockeigenbegin;
return true;
} /* if cIterEig < ... */
// numerical problems, ignore them and try again
/* Addition des letzten minEW auf die Diagonale von C */
/* Add the last known good eigen value to the diagonal of C */
double summand = lastGoodMinimumEigenValue * exp((double) tries);
for (unsigned i = 0; i < p.n; ++i)
C[i][i] += summand;
} /* for iEigenCalcVers */
return false;
}
示例2: max
static double
Linfty(valarray<double> const &vec) {
return std::max(vec.max(), -vec.min());
}