1 /* ========================================================================== */
2 /* === UMFPACK_report_perm ================================================== */
3 /* ========================================================================== */
4 
5 /* -------------------------------------------------------------------------- */
6 /* Copyright (c) 2005-2012 by Timothy A. Davis, http://www.suitesparse.com.   */
7 /* All Rights Reserved.  See ../Doc/License.txt for License.                  */
8 /* -------------------------------------------------------------------------- */
9 
10 /*
11     User-callable.  Prints a permutation vector.  See umfpack_report_perm.h
12     for details.
13 
14     Dynamic memory usage:  Allocates a size max(np,1)*sizeof(Int) workspace via
15     a single call to UMF_malloc and then frees all of it via UMF_free on return.
16 */
17 
18 #include "umf_internal.h"
19 #include "umf_report_perm.h"
20 #include "umf_malloc.h"
21 #include "umf_free.h"
22 
UMFPACK_report_perm(Int np,const Int Perm[],const double Control[UMFPACK_CONTROL])23 GLOBAL Int UMFPACK_report_perm
24 (
25     Int np,
26     const Int Perm [ ],
27     const double Control [UMFPACK_CONTROL]
28 )
29 {
30     Int prl, *W, status ;
31 
32     prl = GET_CONTROL (UMFPACK_PRL, UMFPACK_DEFAULT_PRL) ;
33 
34     if (prl <= 2)
35     {
36 	return (UMFPACK_OK) ;
37     }
38 
39     W = (Int *) UMF_malloc (MAX (np,1), sizeof (Int)) ;
40     status = UMF_report_perm (np, Perm, W, prl, 1) ;
41     (void) UMF_free ((void *) W) ;
42     return (status) ;
43 }
44