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]);
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 
perm
idx_t idx_t idx_t idx_t idx_t * perm
Definition: include/metis.h:223
gk_strdup
char * gk_strdup(char *orgstr)
Duplicates a string.
Definition: string.c:372
main
int main(int argc, char *argv[])
Definition: cmpfillin.c:23
imalloc
#define imalloc
Definition: gklib_rename.h:42
params_t
Definition: fis.c:15
vanilla::params
static const SmartProjectionParams params
Definition: smartFactorScenarios.h:69
ReadGraph
graph_t * ReadGraph(params_t *params)
Definition: programs/io.c:22
iperm
idx_t idx_t idx_t idx_t idx_t idx_t * iperm
Definition: include/metis.h:223
metisbin.h
ReadPOVector
void ReadPOVector(graph_t *graph, char *filename, idx_t *vector)
Definition: programs/io.c:407
FreeGraph
#define FreeGraph
Definition: rename.h:98
METISTITLE
#define METISTITLE
Definition: libmetis/defs.h:18
PRIDX
#define PRIDX
Definition: include/metis.h:107
ComputeFillIn
void ComputeFillIn(graph_t *graph, idx_t *perm, idx_t *iperm, size_t *r_maxlnz, size_t *r_opc)
Definition: smbfactor.c:21
graph
NonlinearFactorGraph graph
Definition: doc/Code/OdometryExample.cpp:2
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
graph_t
Definition: libmetis/struct.h:82
idx_t
int32_t idx_t
Definition: include/metis.h:101


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:15