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
|
/* ========================================================================== */
/* === UMF_report_perm ====================================================== */
/* ========================================================================== */
/* -------------------------------------------------------------------------- */
/* UMFPACK Version 4.1 (Apr. 30, 2003), Copyright (c) 2003 by Timothy A. */
/* Davis. All Rights Reserved. See ../README for License. */
/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */
/* 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\n\n")) ;
return (UMFPACK_ERROR_n_nonpositive) ;
}
if (!P)
{
/* if P is (Int *) NULL, this is the identity permutation */
PRINTF (("(not present)\n\n")) ;
return (UMFPACK_OK) ;
}
if (!W)
{
PRINTF (("ERROR: out of memory\n\n")) ;
return (UMFPACK_ERROR_out_of_memory) ;
}
PRINTF4 (("\n")) ;
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\n\n")) ;
return (UMFPACK_ERROR_invalid_permutation) ;
}
PRINTF4 (("\n")) ;
if (prl == 4 && k == 9 && n > 10)
{
PRINTF ((" ...\n")) ;
prl-- ;
}
}
prl = prl1 ;
PRINTF4 ((" permutation vector ")) ;
PRINTF4U (("OK\n\n")) ;
return (UMFPACK_OK) ;
}
|