Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "ColPackHeaders.h"
00009
00010 using namespace ColPack;
00011 using namespace std;
00012
00013 int main()
00014 {
00015 double*** dp3_Seed = new double**;
00016 int *ip1_SeedRowCount = new int;
00017 int *ip1_SeedColumnCount = new int;
00018 int i_RowCount, i_MaxNonZerosInRows;
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 i_RowCount = 5;
00032 i_MaxNonZerosInRows = 2;
00033 unsigned int **uip2_HessianSparsityPattern = new unsigned int *[i_RowCount];
00034 for(int i=0;i<5;i++) uip2_HessianSparsityPattern[i] = new unsigned int[i_MaxNonZerosInRows + 1];
00035 uip2_HessianSparsityPattern[0][0] = 1; uip2_HessianSparsityPattern[0][1] = 1;
00036 uip2_HessianSparsityPattern[1][0] = 2; uip2_HessianSparsityPattern[1][1] = 0; uip2_HessianSparsityPattern[1][2] = 2;
00037 uip2_HessianSparsityPattern[2][0] = 2; uip2_HessianSparsityPattern[2][1] = 1; uip2_HessianSparsityPattern[2][2] = 3;
00038 uip2_HessianSparsityPattern[3][0] = 2; uip2_HessianSparsityPattern[3][1] = 2; uip2_HessianSparsityPattern[3][2] = 4;
00039 uip2_HessianSparsityPattern[4][0] = 1; uip2_HessianSparsityPattern[4][1] = 3;
00040
00041
00042
00043
00044
00045 GraphColoringInterface * g = new GraphColoringInterface(SRC_MEM_ADOLC, uip2_HessianSparsityPattern, i_RowCount);
00046
00047
00048 g->Coloring("SMALLEST_LAST", "STAR");
00049
00050
00051 (*dp3_Seed) = g->GetSeedMatrix(ip1_SeedRowCount, ip1_SeedColumnCount);
00052
00053
00054
00055
00056 cout<<"Finish GenerateSeed()"<<endl;
00057
00058
00059 g->PrintGraphStructure();
00060 g->PrintVertexColors();
00061 g->PrintVertexColoringMetrics();
00062 double **Seed = *dp3_Seed;
00063 int rows = g->GetVertexCount();
00064 int cols = g->GetVertexColorCount();
00065 cout<<"Seed matrix: ("<<rows<<","<<cols<<")"<<endl;
00066 for(int i=0; i<rows; i++) {
00067 for(int j=0; j<cols; j++) {
00068 cout<<setw(6)<<Seed[i][j];
00069 }
00070 cout<<endl;
00071 }
00072
00073
00074 Pause();
00075
00076
00077 delete g;
00078 g = NULL;
00079
00080
00081 delete dp3_Seed;
00082 dp3_Seed = NULL;
00083 Seed = NULL;
00084
00085
00086 delete ip1_SeedRowCount;
00087 ip1_SeedRowCount = NULL;
00088
00089
00090 delete ip1_SeedColumnCount;
00091 ip1_SeedColumnCount = NULL;
00092
00093
00094 free_2DMatrix(uip2_HessianSparsityPattern, i_RowCount);
00095 uip2_HessianSparsityPattern = NULL;
00096
00097 return(_TRUE);
00098 }