<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>SuperLU: SRC/slamch.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>SRC/slamch.c File Reference</h1>Determines single precision machine parameters and other service routines. <a href="#_details">More...</a>
<p>
<code>#include <stdio.h></code><br>
<code>#include "<a class="el" href="slu__Cnames_8h-source.html">slu_Cnames.h</a>"</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#ca1e6c3771fa0306e1dad2b11d22a8e5">TRUE_</a> (1)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#d4986ecbba005b963f63a85f7c8c281d">FALSE_</a> (0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#c6afabdc09a49a433ee19d8a9486056d">min</a>(a, b) ((a) <= (b) ? (a) : (b))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#ffe776513b24d84b39af8ab0930fef7f">max</a>(a, b) ((a) >= (b) ? (a) : (b))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#3aa069ac3980707dae1e0530f50d59e4">abs</a>(x) ((x) >= 0 ? (x) : -(x))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#d1f46d2294c121413c66c8777190a874">dabs</a>(x) (double)abs(x)</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#5458a369e694e54bb5758774f492b6cb">slamch_</a> (char *cmach)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#865afb9b3184a99ab01e8d34b147f227">slamc1_</a> (int *beta, int *t, int *rnd, int *ieee1)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#13ac82b8c5bbb0c2392aefba4177e4fc">slamc2_</a> (int *beta, int *t, int *rnd, float *eps, int *emin, float *rmin, int *emax, float *rmax)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#a422da346f4ae26603bbc9b657191e5f">slamc3_</a> (float *a, float *b)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#0f5092460355cf3d3461688e37cc70a0">slamc4_</a> (int *emin, float *start, int *base)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#ed7eefa5a851c36909eee77beed124b0">slamc5_</a> (int *beta, int *p, int *emin, int *ieee, int *emax, float *rmax)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="slamch_8c.html#ace5d2e6dbf9c872b611447aa01539c8">pow_ri</a> (float *ap, int *bp)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<pre>
-- LAPACK auxiliary routine (version 2.0) --
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
Courant Institute, Argonne National Lab, and Rice University
October 31, 1992
</pre> <hr><h2>Define Documentation</h2>
<a class="anchor" name="3aa069ac3980707dae1e0530f50d59e4"></a><!-- doxytag: member="slamch.c::abs" ref="3aa069ac3980707dae1e0530f50d59e4" args="(x)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define abs </td>
<td>(</td>
<td class="paramtype">x </td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> ((x) >= 0 ? (x) : -(x))</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="d1f46d2294c121413c66c8777190a874"></a><!-- doxytag: member="slamch.c::dabs" ref="d1f46d2294c121413c66c8777190a874" args="(x)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define dabs </td>
<td>(</td>
<td class="paramtype">x </td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> (double)abs(x)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="d4986ecbba005b963f63a85f7c8c281d"></a><!-- doxytag: member="slamch.c::FALSE_" ref="d4986ecbba005b963f63a85f7c8c281d" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define FALSE_ (0) </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="ffe776513b24d84b39af8ab0930fef7f"></a><!-- doxytag: member="slamch.c::max" ref="ffe776513b24d84b39af8ab0930fef7f" args="(a, b)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define max </td>
<td>(</td>
<td class="paramtype">a, <tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">b </td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> ((a) >= (b) ? (a) : (b))</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="c6afabdc09a49a433ee19d8a9486056d"></a><!-- doxytag: member="slamch.c::min" ref="c6afabdc09a49a433ee19d8a9486056d" args="(a, b)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define min </td>
<td>(</td>
<td class="paramtype">a, <tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">b </td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> ((a) <= (b) ? (a) : (b))</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="ca1e6c3771fa0306e1dad2b11d22a8e5"></a><!-- doxytag: member="slamch.c::TRUE_" ref="ca1e6c3771fa0306e1dad2b11d22a8e5" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define TRUE_ (1) </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ace5d2e6dbf9c872b611447aa01539c8"></a><!-- doxytag: member="slamch.c::pow_ri" ref="ace5d2e6dbf9c872b611447aa01539c8" args="(float *ap, int *bp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double pow_ri </td>
<td>(</td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>ap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>bp</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="865afb9b3184a99ab01e8d34b147f227"></a><!-- doxytag: member="slamch.c::slamc1_" ref="865afb9b3184a99ab01e8d34b147f227" args="(int *beta, int *t, int *rnd, int *ieee1)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int slamc1_ </td>
<td>(</td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>beta</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>t</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>rnd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>ieee1</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<pre>
Purpose
=======</pre><p>
<pre> SLAMC1 determines the machine parameters given by BETA, T, RND, and
IEEE1.</pre><p>
<pre> Arguments
=========</pre><p>
<pre> BETA (output) INT
The base of the machine.</pre><p>
<pre> T (output) INT
The number of ( BETA ) digits in the mantissa.</pre><p>
<pre> RND (output) INT
Specifies whether proper rounding ( RND = .TRUE. ) or
chopping ( RND = .FALSE. ) occurs in addition. This may not</pre><p>
<pre> be a reliable guide to the way in which the machine performs</pre><p>
<pre> its arithmetic.</pre><p>
<pre> IEEE1 (output) INT
Specifies whether rounding appears to be done in the IEEE
'round to nearest' style.</pre><p>
<pre> Further Details
===============</pre><p>
<pre> The routine is based on the routine ENVRON by Malcolm and
incorporates suggestions by Gentleman and Marovich. See</pre><p>
<pre> Malcolm M. A. (1972) Algorithms to reveal properties of
floating-point arithmetic. Comms. of the ACM, 15, 949-951.</pre><p>
<pre> Gentleman W. M. and Marovich S. B. (1974) More on algorithms
that reveal properties of floating point arithmetic units.
Comms. of the ACM, 17, 276-277.</pre><p>
<pre> =====================================================================
</pre>
</div>
</div><p>
<a class="anchor" name="13ac82b8c5bbb0c2392aefba4177e4fc"></a><!-- doxytag: member="slamch.c::slamc2_" ref="13ac82b8c5bbb0c2392aefba4177e4fc" args="(int *beta, int *t, int *rnd, float *eps, int *emin, float *rmin, int *emax, float *rmax)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int slamc2_ </td>
<td>(</td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>beta</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>t</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>rnd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>eps</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>emin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>rmin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>emax</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>rmax</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<pre>
Purpose
=======</pre><p>
<pre> SLAMC2 determines the machine parameters specified in its argument
list.</pre><p>
<pre> Arguments
=========</pre><p>
<pre> BETA (output) INT
The base of the machine.</pre><p>
<pre> T (output) INT
The number of ( BETA ) digits in the mantissa.</pre><p>
<pre> RND (output) INT
Specifies whether proper rounding ( RND = .TRUE. ) or
chopping ( RND = .FALSE. ) occurs in addition. This may not</pre><p>
<pre> be a reliable guide to the way in which the machine performs</pre><p>
<pre> its arithmetic.</pre><p>
<pre> EPS (output) FLOAT
The smallest positive number such that</pre><p>
<pre> fl( 1.0 - EPS ) .LT. 1.0,</pre><p>
<pre> where fl denotes the computed value.</pre><p>
<pre> EMIN (output) INT
The minimum exponent before (gradual) underflow occurs.</pre><p>
<pre> RMIN (output) FLOAT
The smallest normalized number for the machine, given by
BASE**( EMIN - 1 ), where BASE is the floating point value</pre><p>
<pre> of BETA.</pre><p>
<pre> EMAX (output) INT
The maximum exponent before overflow occurs.</pre><p>
<pre> RMAX (output) FLOAT
The largest positive number for the machine, given by
BASE**EMAX * ( 1 - EPS ), where BASE is the floating point</pre><p>
<pre> value of BETA.</pre><p>
<pre> Further Details
===============</pre><p>
<pre> The computation of EPS is based on a routine PARANOIA by
W. Kahan of the University of California at Berkeley.</pre><p>
<pre> =====================================================================
</pre>
</div>
</div><p>
<a class="anchor" name="a422da346f4ae26603bbc9b657191e5f"></a><!-- doxytag: member="slamch.c::slamc3_" ref="a422da346f4ae26603bbc9b657191e5f" args="(float *a, float *b)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double slamc3_ </td>
<td>(</td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>b</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<pre>
Purpose
=======</pre><p>
<pre> SLAMC3 is intended to force A and B to be stored prior to doing</pre><p>
<pre> the addition of A and B , for use in situations where optimizers</pre><p>
<pre> might hold one of these in a register.</pre><p>
<pre> Arguments
=========</pre><p>
<pre> A, B (input) FLOAT
The values A and B.</pre><p>
<pre> =====================================================================
</pre>
</div>
</div><p>
<a class="anchor" name="0f5092460355cf3d3461688e37cc70a0"></a><!-- doxytag: member="slamch.c::slamc4_" ref="0f5092460355cf3d3461688e37cc70a0" args="(int *emin, float *start, int *base)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int slamc4_ </td>
<td>(</td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>emin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>start</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>base</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<pre>
Purpose
=======</pre><p>
<pre> SLAMC4 is a service routine for SLAMC2.</pre><p>
<pre> Arguments
=========</pre><p>
<pre> EMIN (output) EMIN
The minimum exponent before (gradual) underflow, computed by</pre><p>
<pre> setting A = START and dividing by BASE until the previous A
can not be recovered.</pre><p>
<pre> START (input) FLOAT
The starting point for determining EMIN.</pre><p>
<pre> BASE (input) INT
The base of the machine.</pre><p>
<pre> =====================================================================
</pre>
</div>
</div><p>
<a class="anchor" name="ed7eefa5a851c36909eee77beed124b0"></a><!-- doxytag: member="slamch.c::slamc5_" ref="ed7eefa5a851c36909eee77beed124b0" args="(int *beta, int *p, int *emin, int *ieee, int *emax, float *rmax)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int slamc5_ </td>
<td>(</td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>beta</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>emin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>ieee</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>emax</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float * </td>
<td class="paramname"> <em>rmax</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<pre>
Purpose
=======</pre><p>
<pre> SLAMC5 attempts to compute RMAX, the largest machine floating-point
number, without overflow. It assumes that EMAX + <a class="el" href="slamch_8c.html#3aa069ac3980707dae1e0530f50d59e4">abs(EMIN)</a> sum
approximately to a power of 2. It will fail on machines where this
assumption does not hold, for example, the Cyber 205 (EMIN = -28625,</pre><p>
<pre> EMAX = 28718). It will also fail if the value supplied for EMIN is
too large (i.e. too close to zero), probably with overflow.</pre><p>
<pre> Arguments
=========</pre><p>
<pre> BETA (input) INT
The base of floating-point arithmetic.</pre><p>
<pre> P (input) INT
The number of base BETA digits in the mantissa of a
floating-point value.</pre><p>
<pre> EMIN (input) INT
The minimum exponent before (gradual) underflow.</pre><p>
<pre> IEEE (input) INT
A logical flag specifying whether or not the arithmetic
system is thought to comply with the IEEE standard.</pre><p>
<pre> EMAX (output) INT
The largest exponent before overflow</pre><p>
<pre> RMAX (output) FLOAT
The largest machine floating-point number.</pre><p>
<pre> =====================================================================</pre><p>
<pre> First compute LEXP and UEXP, two powers of 2 that bound
<a class="el" href="slamch_8c.html#3aa069ac3980707dae1e0530f50d59e4">abs(EMIN)</a>. We then assume that EMAX + <a class="el" href="slamch_8c.html#3aa069ac3980707dae1e0530f50d59e4">abs(EMIN)</a> will sum
approximately to the bound that is closest to <a class="el" href="slamch_8c.html#3aa069ac3980707dae1e0530f50d59e4">abs(EMIN)</a>.
(EMAX is the exponent of the required number RMAX).
</pre>
</div>
</div><p>
<a class="anchor" name="5458a369e694e54bb5758774f492b6cb"></a><!-- doxytag: member="slamch.c::slamch_" ref="5458a369e694e54bb5758774f492b6cb" args="(char *cmach)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float slamch_ </td>
<td>(</td>
<td class="paramtype">char * </td>
<td class="paramname"> <em>cmach</em> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<pre>
Purpose
=======</pre><p>
<pre> SLAMCH determines single precision machine parameters.</pre><p>
<pre> Arguments
=========</pre><p>
<pre> CMACH (input) CHARACTER*1
Specifies the value to be returned by SLAMCH:
= 'E' or 'e', SLAMCH := eps
= 'S' or 's , SLAMCH := sfmin
= 'B' or 'b', SLAMCH := base
= 'P' or 'p', SLAMCH := eps*base
= 'N' or 'n', SLAMCH := t
= 'R' or 'r', SLAMCH := rnd
= 'M' or 'm', SLAMCH := emin
= 'U' or 'u', SLAMCH := rmin
= 'L' or 'l', SLAMCH := emax
= 'O' or 'o', SLAMCH := rmax</pre><p>
<pre> where</pre><p>
<pre> eps = relative machine precision
sfmin = safe minimum, such that 1/sfmin does not overflow
base = base of the machine
prec = eps*base
t = number of (base) digits in the mantissa
rnd = 1.0 when rounding occurs in addition, 0.0 otherwise
emin = minimum exponent before (gradual) underflow
rmin = underflow threshold - base**(emin-1)
emax = largest exponent before overflow
rmax = overflow threshold - (base**emax)*(1-eps)</pre><p>
<pre> =====================================================================
</pre>
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Nov 22 10:23:48 2010 for SuperLU by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>