ergo
template_lapack_labad.h
Go to the documentation of this file.
1
/* Ergo, version 3.8, a program for linear scaling electronic structure
2
* calculations.
3
* Copyright (C) 2019 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
4
* and Anastasia Kruchinina.
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*
19
* Primary academic reference:
20
* Ergo: An open-source program for linear-scaling electronic structure
21
* calculations,
22
* Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
23
* Kruchinina,
24
* SoftwareX 7, 107 (2018),
25
* <http://dx.doi.org/10.1016/j.softx.2018.03.005>
26
*
27
* For further information about Ergo, see <http://www.ergoscf.org>.
28
*/
29
30
/* This file belongs to the template_lapack part of the Ergo source
31
* code. The source files in the template_lapack directory are modified
32
* versions of files originally distributed as CLAPACK, see the
33
* Copyright/license notice in the file template_lapack/COPYING.
34
*/
35
36
37
#ifndef TEMPLATE_LAPACK_LABAD_HEADER
38
#define TEMPLATE_LAPACK_LABAD_HEADER
39
40
41
template
<
class
Treal>
42
int
template_lapack_labad
(Treal *small, Treal *large)
43
{
44
/* -- LAPACK auxiliary routine (version 3.0) --
45
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
46
Courant Institute, Argonne National Lab, and Rice University
47
October 31, 1992
48
49
50
Purpose
51
=======
52
53
DLABAD takes as input the values computed by DLAMCH for underflow and
54
overflow, and returns the square root of each of these values if the
55
log of LARGE is sufficiently large. This subroutine is intended to
56
identify machines with a large exponent range, such as the Crays, and
57
redefine the underflow and overflow limits to be the square roots of
58
the values computed by DLAMCH. This subroutine is needed because
59
DLAMCH does not compensate for poor arithmetic in the upper half of
60
the exponent range, as is found on a Cray.
61
62
Arguments
63
=========
64
65
SMALL (input/output) DOUBLE PRECISION
66
On entry, the underflow threshold as computed by DLAMCH.
67
On exit, if LOG10(LARGE) is sufficiently large, the square
68
root of SMALL, otherwise unchanged.
69
70
LARGE (input/output) DOUBLE PRECISION
71
On entry, the overflow threshold as computed by DLAMCH.
72
On exit, if LOG10(LARGE) is sufficiently large, the square
73
root of LARGE, otherwise unchanged.
74
75
=====================================================================
76
77
78
If it looks like we're on a Cray, take the square root of
79
SMALL and LARGE to avoid overflow and underflow problems. */
80
81
82
if
(
template_blas_lg10
(large) > 2e3) {
83
*small =
template_blas_sqrt
(*small);
84
*large =
template_blas_sqrt
(*large);
85
}
86
87
return
0;
88
89
/* End of DLABAD */
90
91
}
/* dlabad_ */
92
93
#endif
template_blas_sqrt
Treal template_blas_sqrt(Treal x)
template_blas_lg10
Treal template_blas_lg10(Treal *x)
Definition:
template_lapack_lamch.h:60
template_lapack_labad
int template_lapack_labad(Treal *small, Treal *large)
Definition:
template_lapack_labad.h:42
source
matrix
template_lapack
lapack
template_lapack_labad.h
Generated on Sun Aug 16 2020 00:00:00 for ergo by
1.8.18