1
/* ========================================================================== */
2
/* === UMF_scale ============================================================ */
3
/* ========================================================================== */
5
/* -------------------------------------------------------------------------- */
6
/* UMFPACK Version 4.1 (Apr. 30, 2003), Copyright (c) 2003 by Timothy A. */
7
/* Davis. All Rights Reserved. See ../README for License. */
8
/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */
9
/* web: http://www.cise.ufl.edu/research/sparse/umfpack */
10
/* -------------------------------------------------------------------------- */
12
/* Divide a vector of stride 1 by the pivot value. */
14
#include "umf_internal.h"
27
/* ---------------------------------------------------------------------- */
28
/* compute the approximate absolute value of the pivot, and select method */
29
/* ---------------------------------------------------------------------- */
31
APPROX_ABS (s, pivot) ;
33
if (s < RECIPROCAL_TOLERANCE || IS_NAN (pivot))
35
/* ------------------------------------------------------------------ */
36
/* tiny, or zero, pivot case */
37
/* ------------------------------------------------------------------ */
39
/* The pivot is tiny, or NaN. Do not divide zero by the pivot value,
40
* and do not multiply by 1/pivot, either. */
42
for (i = 0 ; i < n ; i++)
44
/* X [i] /= pivot ; */
48
DIV (X [i], x, pivot) ;
56
/* ------------------------------------------------------------------ */
57
/* normal case. select the x/pivot or x * (1/pivot) method */
58
/* ------------------------------------------------------------------ */
60
/* The pivot is not tiny, and is not NaN. Don't bother to check for
61
* zeros in the pivot column, X. */
63
#if !defined (NRECIPROCAL) && !(defined (__GNUC__) && defined (COMPLEX))
65
/* -------------------------------------------------------------- */
66
/* multiply x by (1/pivot) */
67
/* -------------------------------------------------------------- */
69
/* Slightly less accurate, but faster. It allows the use of
70
* the level-1 BLAS dscal or zscal routine. This not used when
71
* UMFPACK is used in MATLAB (either as a built-in routine, or as
74
* Using gcc version 3.2 can cause the following code to fail for
75
* some complex matrices (not all), with or without the BLAS. This
76
* was found in Red Hat Linux 7.3 on a Dell Latitude C840 with a
77
* Pentium 4M. Thus, this code is not used when gcc is used, for
80
* It works just fine with Intel's icc compiler, version 7.0.
83
/* pivot = 1 / pivot */
86
#if defined (USE_NO_BLAS)
87
for (i = 0 ; i < n ; i++)
89
/* X [i] *= pivot ; */
91
MULT (X [i], x, pivot) ;
94
BLAS_SCAL (n, pivot, X) ;
99
/* -------------------------------------------------------------- */
100
/* divide x by the pivot */
101
/* -------------------------------------------------------------- */
103
/* This is slightly more accurate, particularly if the pivot column
104
* consists of only IEEE subnormals. Always do this if UMFPACK is
105
* being compiled as a built-in routine or mexFunction in MATLAB,
106
* or if gcc is being used with complex matrices. */
108
for (i = 0 ; i < n ; i++)
110
/* X [i] /= pivot ; */
112
DIV (X [i], x, pivot) ;