cmpfillin.c
Go to the documentation of this file.
1 /*
2  * Copyright 1997, Regents of the University of Minnesota
3  *
4  * cmpfillin.c
5  *
6  * This file takes a graph and a fill-reducing ordering and computes
7  * the fillin.
8  *
9  * Started 9/1/2004
10  * George
11  *
12  * $Id: cmpfillin.c 9982 2011-05-25 17:18:00Z karypis $
13  *
14  */
15 
16 #include "metisbin.h"
17 
18 
19 
20 /*************************************************************************
21 * Let the game begin
22 **************************************************************************/
23 int main(int argc, char *argv[])
24 {
25  idx_t i;
26  idx_t *perm, *iperm;
27  graph_t *graph;
29  size_t maxlnz, opc;
30 
31  if (argc != 3) {
32  printf("Usage: %s <GraphFile> <PermFile\n", argv[0]);
33  exit(0);
34  }
35 
36  params.filename = gk_strdup(argv[1]);
37  graph = ReadGraph(&params);
38  if (graph->nvtxs <= 0) {
39  printf("Empty graph. Nothing to do.\n");
40  exit(0);
41  }
42  if (graph->ncon != 1) {
43  printf("Ordering can only be applied to graphs with one constraint.\n");
44  exit(0);
45  }
46 
47 
48  /* Read the external iperm vector */
49  perm = imalloc(graph->nvtxs, "main: perm");
50  iperm = imalloc(graph->nvtxs, "main: iperm");
51  ReadPOVector(graph, argv[2], iperm);
52 
53  for (i=0; i<graph->nvtxs; i++)
54  perm[iperm[i]] = i;
55 
56  printf("**********************************************************************\n");
57  printf("%s", METISTITLE);
58  printf("Graph Information ---------------------------------------------------\n");
59  printf(" Name: %s, #Vertices: %"PRIDX", #Edges: %"PRIDX"\n\n", argv[1],
60  graph->nvtxs, graph->nedges/2);
61  printf("Fillin... -----------------------------------------------------------\n");
62 
63  ComputeFillIn(graph, perm, iperm, &maxlnz, &opc);
64 
65  printf(" Nonzeros: %6.3le \tOperation Count: %6.3le\n", (double)maxlnz, (double)opc);
66 
67 
68  printf("**********************************************************************\n");
69 
70  FreeGraph(&graph);
71 }
72 
73 
Definition: fis.c:15
#define imalloc
Definition: gklib_rename.h:42
#define FreeGraph
Definition: rename.h:98
char * filename
Definition: fis.c:18
idx_t nvtxs
idx_t idx_t idx_t idx_t idx_t idx_t * iperm
#define METISTITLE
Definition: libmetis/defs.h:18
NonlinearFactorGraph graph
static const SmartProjectionParams params
#define PRIDX
idx_t nedges
int32_t idx_t
idx_t idx_t idx_t idx_t idx_t * perm
idx_t ncon
char * gk_strdup(char *orgstr)
Duplicates a string.
Definition: string.c:372
graph_t * ReadGraph(params_t *params)
Definition: programs/io.c:22
void ReadPOVector(graph_t *graph, char *filename, idx_t *vector)
Definition: programs/io.c:407
int main(int argc, char *argv[])
Definition: cmpfillin.c:23
void ComputeFillIn(graph_t *graph, idx_t *perm, idx_t *iperm, size_t *r_maxlnz, size_t *r_opc)
Definition: smbfactor.c:21


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:01