SCM Repository

[matrix] Diff of /pkg/src/Metis_utils.c
 [matrix] / pkg / src / Metis_utils.c

Diff of /pkg/src/Metis_utils.c

revision 351, Tue Nov 23 15:40:28 2004 UTC revision 692, Mon Apr 18 14:34:33 2005 UTC
# Line 2  Line 2
2  #include "metis.h"  #include "metis.h"
3  #include "Metis_utils.h"  #include "Metis_utils.h"
4
5
6
7    /**
8     * Establish a fill-reducing permutation for the sparse symmetric
9     * matrix of order n represented by the column pointers Tp and row
10     * indices Ti.
11     *
12     * @param n  order of the sparse symmetric matrix
13     * @param Tp  column pointers (total length n + 1)
14     * @param Ti  row indices (total length Tp[n])
15     * @param Perm array of length n to hold the permutation
16     * @param iPerm array of length n to hold the inverse permutation
17     *
18     */
19  void ssc_metis_order(int n, const int Tp [], const int Ti [],  void ssc_metis_order(int n, const int Tp [], const int Ti [],
20                       int Perm[], int iPerm[])                       int Perm[], int iPerm[])
21  {  {
# Line 12  Line 26
27          *adj = Calloc(2 * (Tp[n] - n), idxtype);          *adj = Calloc(2 * (Tp[n] - n), idxtype);
28
29                                    /* check row indices for correct range */
30        for (j = 0; j < Tp[n]; j++)
31          if (Ti[j] < 0 || Ti[j] >= n)
32            error(_("row index Ti[%d] = %d is out of range [0,%d]"),
33                  j, Ti[j], n - 1);
34                                  /* temporarily use perm to store lengths */                                  /* temporarily use perm to store lengths */
35      memset(perm, 0, sizeof(idxtype) * n);      AZERO(perm, n);
36      for (j = 0; j < n; j++) {      for (j = 0; j < n; j++) {
37          int ip, p2 = Tp[j+1];          int ip, p2 = Tp[j+1];
38          for (ip = Tp[j]; ip < p2; ip++) {          for (ip = Tp[j]; ip < p2; ip++) {

Legend:
 Removed from v.351 changed lines Added in v.692