1
1
/* ========================================================================== */
2
/* === klu_scale ============================================================ */
2
/* === KLU_scale ============================================================ */
3
3
/* ========================================================================== */
5
5
/* Scale a matrix and check to see if it is valid. Can be called by the user.
6
* This is called by klu_factor and klu_refactor. Returns TRUE if the input
6
* This is called by KLU_factor and KLU_refactor. Returns TRUE if the input
7
7
* matrix is valid, FALSE otherwise. If the W input argument is non-NULL,
8
8
* then the input matrix is checked for duplicate entries.
17
17
#include "klu_internal.h"
19
int KLU_scale /* return TRUE if successful, FALSE otherwise */
19
Int KLU_scale /* return TRUE if successful, FALSE otherwise */
21
21
/* inputs, not modified */
22
int scale, /* 0: none, 1: sum, 2: max */
24
int Ap [ ], /* size n+1, column pointers */
25
int Ai [ ], /* size nz, row indices */
22
Int scale, /* 0: none, 1: sum, 2: max */
24
Int Ap [ ], /* size n+1, column pointers */
25
Int Ai [ ], /* size nz, row indices */
27
27
/* outputs, not defined on input */
28
28
double Rs [ ], /* size n, can be NULL if scale <= 0 */
29
29
/* workspace, not defined on input or output */
30
int W [ ], /* size n, can be NULL */
30
Int W [ ], /* size n, can be NULL */
31
31
/* --------------- */
37
int row, col, p, pend, check_duplicates ;
37
Int row, col, p, pend, check_duplicates ;
39
/* ---------------------------------------------------------------------- */
41
/* ---------------------------------------------------------------------- */
39
43
if (Common == NULL)
52
56
Az = (Entry *) Ax ;
54
if (n <= 0 || (Ap == NULL) || (Ai == NULL) || (Az == NULL))
58
if (n <= 0 || Ap == NULL || Ai == NULL || Az == NULL ||
59
(scale > 0 && Rs == NULL))
56
/* Ap, Ai, and Ax must be present, and n must be > 0 */
61
/* Ap, Ai, Ax and Rs must be present, and n must be > 0 */
57
62
Common->status = KLU_INVALID ;