LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
droundup_lwork.f
Go to the documentation of this file.
1*> \brief \b DROUNDUP_LWORK
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* DOUBLE PRECISION FUNCTION DROUNDUP_LWORK( LWORK )
12*
13* .. Scalar Arguments ..
14* INTEGER LWORK
15* ..
16*
17*
18*> \par Purpose:
19* =============
20*>
21*> \verbatim
22*>
23*> DROUNDUP_LWORK deals with a subtle bug with returning LWORK as a Float.
24*> This routine guarantees it is rounded up instead of down by
25*> multiplying LWORK by 1+eps when it is necessary, where eps is the relative machine precision.
26*> E.g.,
27*>
28*> float( 9007199254740993 ) == 9007199254740992
29*> float( 9007199254740993 ) * (1.+eps) == 9007199254740994
30*>
31*> \return DROUNDUP_LWORK
32*> \verbatim
33*> DROUNDUP_LWORK >= LWORK.
34*> DROUNDUP_LWORK is guaranteed to have zero decimal part.
35*> \endverbatim
36*
37* Arguments:
38* ==========
39*
40*> \param[in] LWORK Workspace size.
41*
42* Authors:
43* ========
44*
45*> \author Weslley Pereira, University of Colorado Denver, USA
46*
47*> \ingroup roundup_lwork
48*
49*> \par Further Details:
50* =====================
51*>
52*> \verbatim
53*> This routine was inspired in the method `magma_zmake_lwork` from MAGMA.
54*> \see https://bitbucket.org/icl/magma/src/master/control/magma_zauxiliary.cpp
55*> \endverbatim
56*
57* =====================================================================
58 DOUBLE PRECISION FUNCTION droundup_lwork( LWORK )
59*
60* -- LAPACK auxiliary routine --
61* -- LAPACK is a software package provided by Univ. of Tennessee, --
62* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
63*
64* .. Scalar Arguments ..
65 INTEGER lwork
66* ..
67*
68* =====================================================================
69* ..
70* .. Intrinsic Functions ..
71 INTRINSIC epsilon, dble, int
72* ..
73* .. Executable Statements ..
74* ..
75 droundup_lwork = dble( lwork )
76*
77 IF( int( droundup_lwork ) .LT. lwork ) THEN
78* Force round up of LWORK
79 droundup_lwork = droundup_lwork * ( 1.0d+0 + epsilon(0.0d+0) )
80 ENDIF
81*
82 RETURN
83*
84* End of DROUNDUP_LWORK
85*
86 END
double precision function droundup_lwork(lwork)
DROUNDUP_LWORK