Blame view
fvn_sparse/UMFPACK/Source/umf_report_perm.c
1.99 KB
422234dc3
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
/* ========================================================================== */ /* === UMF_report_perm ====================================================== */ /* ========================================================================== */ /* -------------------------------------------------------------------------- */ /* UMFPACK Copyright (c) Timothy A. Davis, CISE, */ /* Univ. of Florida. All Rights Reserved. See ../Doc/License for License. */ /* web: http://www.cise.ufl.edu/research/sparse/umfpack */ /* -------------------------------------------------------------------------- */ #include "umf_internal.h" #define PRINTF4U(params) { if (user || prl >= 4) PRINTF (params) ; } GLOBAL Int UMF_report_perm ( Int n, const Int P [ ], Int W [ ], /* workspace of size n */ Int prl, Int user ) { Int i, k, valid, prl1 ; ASSERT (prl >= 3) ; PRINTF4U (("permutation vector, n = "ID". ", n)) ; if (n <= 0) { PRINTF (("ERROR: length of permutation is <= 0 ")) ; return (UMFPACK_ERROR_n_nonpositive) ; } if (!P) { /* if P is (Int *) NULL, this is the identity permutation */ PRINTF (("(not present) ")) ; return (UMFPACK_OK) ; } if (!W) { PRINTF (("ERROR: out of memory ")) ; return (UMFPACK_ERROR_out_of_memory) ; } PRINTF4 ((" ")) ; for (i = 0 ; i < n ; i++) { W [i] = TRUE ; } prl1 = prl ; for (k = 0 ; k < n ; k++) { i = P [k] ; PRINTF4 ((" "ID" : "ID" ", INDEX (k), INDEX (i))) ; valid = (i >= 0 && i < n) ; if (valid) { valid = W [i] ; W [i] = FALSE ; } if (!valid) { /* out of range or duplicate entry */ PRINTF (("ERROR: invalid ")) ; return (UMFPACK_ERROR_invalid_permutation) ; } PRINTF4 ((" ")) ; if (prl == 4 && k == 9 && n > 10) { PRINTF ((" ... ")) ; prl-- ; } } prl = prl1 ; PRINTF4 ((" permutation vector ")) ; PRINTF4U (("OK ")) ; return (UMFPACK_OK) ; } |