49 #ifndef KLU2_SCALE_HPP
50 #define KLU2_SCALE_HPP
52 #include "klu2_internal.h"
54 template <
typename Entry,
typename Int>
70 KLU_common<Entry, Int> *Common
75 Int row, col, p, pend, check_duplicates ;
85 Common->status = KLU_OK ;
96 if (n <= 0 || Ap == NULL || Ai == NULL || Az == NULL ||
97 (
scale > 0 && Rs == NULL))
100 Common->status = KLU_INVALID ;
103 if (Ap [0] != 0 || Ap [n] < 0)
106 Common->status = KLU_INVALID ;
109 for (col = 0 ; col < n ; col++)
111 if (Ap [col] > Ap [col+1])
114 Common->status = KLU_INVALID ;
126 for (row = 0 ; row < n ; row++)
133 check_duplicates = (W != (Int *) NULL) ;
134 if (check_duplicates)
136 for (row = 0 ; row < n ; row++)
142 for (col = 0 ; col < n ; col++)
145 for (p = Ap [col] ; p < pend ; p++)
148 if (row < 0 || row >= n)
151 Common->status = KLU_INVALID ;
154 if (check_duplicates)
159 Common->status = KLU_INVALID ;
166 KLU2_ABS (a, Az [p]) ;
175 Rs [row] = MAX (Rs [row], a) ;
183 for (row = 0 ; row < n ; row++)
186 PRINTF ((
"Rs [%d] = %g\n", row, Rs [row])) ;
190 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.