![]() |
Prev | Next |
integer f2cad::initds_(doublereal *dos, integer *nos, doublereal *eta);
initds.f
to compute the minimum value of
m
such that
\[
\sum_{i=m}^{i=n} | a_i | \leq \eta
\]
Note that there are
m
terms in the rest of the summation; i.e.,
\[
\sum_{i=1}^{m-1} a_i
\]
# include <f2cad/initds.hpp>
test_result initds(void)
{ bool ok = true;
// a_0, a_1, a_2, a_3, a_4, a_5
doublereal a[] = { 1e0, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5};
integer n = sizeof(a) / sizeof(a[0]);
doublereal eta = 1e-3;
integer m = f2cad::initds_(a, &n, &eta);
ok &= (m == 4);
if( ok )
return test_pass;
return test_fail;
}