25 #ifndef KLU2_SCALE_HPP
26 #define KLU2_SCALE_HPP
28 #include "klu2_internal.h"
30 template <
typename Entry,
typename Int>
46 KLU_common<Entry, Int> *Common
51 Int row, col, p, pend, check_duplicates ;
61 Common->status = KLU_OK ;
72 if (n <= 0 ||
Ap == NULL ||
Ai == NULL || Az == NULL ||
73 (
scale > 0 && Rs == NULL))
76 Common->status = KLU_INVALID ;
79 if (
Ap [0] != 0 ||
Ap [n] < 0)
82 Common->status = KLU_INVALID ;
85 for (col = 0 ; col < n ; col++)
87 if (
Ap [col] >
Ap [col+1])
90 Common->status = KLU_INVALID ;
102 for (row = 0 ; row < n ; row++)
109 check_duplicates = (W != (Int *) NULL) ;
110 if (check_duplicates)
112 for (row = 0 ; row < n ; row++)
114 W [row] = AMESOS2_KLU2_EMPTY ;
118 for (col = 0 ; col < n ; col++)
121 for (p =
Ap [col] ; p < pend ; p++)
124 if (row < 0 || row >= n)
127 Common->status = KLU_INVALID ;
130 if (check_duplicates)
135 Common->status = KLU_INVALID ;
142 KLU2_ABS (a, Az [p]) ;
151 Rs [row] = MAX (Rs [row], a) ;
159 for (row = 0 ; row < n ; row++)
162 PRINTF ((
"Rs [%d] = %g\n", row, Rs [row])) ;
166 PRINTF ((
"Row %d of A is all zero\n", row)) ;
void scale(ArrayView< Scalar1 > vals, size_t l, size_t ld, ArrayView< Scalar2 > s)
Scales a 1-D representation of a multivector.
int Ap[]
Column offsets.
Definition: klu2_simple.cpp:52
int Ai[]
Row values.
Definition: klu2_simple.cpp:54