~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/sandbox/pysparse/umfpack/umf_report_perm.c

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

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