Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "ColPackHeaders.h"
00017
00018 using namespace ColPack;
00019 using namespace std;
00020
00021 #ifndef TOP_DIR
00022 #define TOP_DIR "."
00023 #endif
00024
00025
00026 string baseDir=TOP_DIR;
00027
00028 #include "extra.h"
00029
00030
00031 int main()
00032 {
00033
00034 string s_InputFile;
00035 s_InputFile = baseDir;
00036 s_InputFile += DIR_SEPARATOR; s_InputFile += "Graphs"; s_InputFile += DIR_SEPARATOR; s_InputFile += "row-compress.mtx";
00037
00038
00039
00040
00041 unsigned int *** uip3_SparsityPattern = new unsigned int **;
00042 double*** dp3_Value = new double**;
00043 int rowCount, columnCount;
00044 ConvertMatrixMarketFormatToRowCompressedFormat(s_InputFile, uip3_SparsityPattern, dp3_Value,rowCount, columnCount);
00045
00046 cout<<"just for debugging purpose, display the 2 matrices: the matrix with SparsityPattern only and the matrix with Value"<<endl;
00047 cout<<fixed<<showpoint<<setprecision(2);
00048 cout<<"(*uip3_SparsityPattern)"<<endl;
00049 displayCompressedRowMatrix((*uip3_SparsityPattern),rowCount);
00050 cout<<"(*dp3_Value)"<<endl;
00051 displayCompressedRowMatrix((*dp3_Value),rowCount);
00052 cout<<"Finish ConvertMatrixMarketFormatToRowCompressedFormat()"<<endl;
00053 Pause();
00054
00055
00056 double*** dp3_Seed = new double**;
00057 int *ip1_SeedRowCount = new int;
00058 int *ip1_SeedColumnCount = new int;
00059 int *ip1_ColorCount = new int;
00060
00061
00062
00063 BipartiteGraphPartialColoringInterface *g = new BipartiteGraphPartialColoringInterface(SRC_MEM_ADOLC, *uip3_SparsityPattern, rowCount, columnCount);
00064
00065
00066 g->PartialDistanceTwoColoring("SMALLEST_LAST", "ROW_PARTIAL_DISTANCE_TWO");
00067
00068
00069 (*dp3_Seed) = g->GetSeedMatrix(ip1_SeedRowCount, ip1_SeedColumnCount);
00070
00071
00072
00073
00074
00075 cout<<"Finish GenerateSeed()"<<endl;
00076 *ip1_ColorCount = *ip1_SeedRowCount;
00077
00078
00079 printf(" dp3_Seed %d x %d", *ip1_SeedRowCount, *ip1_SeedColumnCount);
00080 displayMatrix(*dp3_Seed, *ip1_SeedRowCount, *ip1_SeedColumnCount);
00081 Pause();
00082
00083
00084
00085
00086 double*** dp3_CompressedMatrix = new double**;
00087 cout<<"Start MatrixMultiplication()"<<endl;
00088 MatrixMultiplication_SxV(*uip3_SparsityPattern, *dp3_Value, rowCount, columnCount, *dp3_Seed, *ip1_ColorCount, dp3_CompressedMatrix);
00089 cout<<"Finish MatrixMultiplication()"<<endl;
00090
00091 displayMatrix(*dp3_CompressedMatrix,*ip1_ColorCount,columnCount);
00092 Pause();
00093
00094
00095
00096 double*** dp3_NewValue = new double**;
00097 JacobianRecovery1D* jr1d = new JacobianRecovery1D;
00098 jr1d->RecoverD2Row_RowCompressedFormat(g, *dp3_CompressedMatrix, *uip3_SparsityPattern, dp3_NewValue);
00099 cout<<"Finish Recover()"<<endl;
00100
00101 displayCompressedRowMatrix(*dp3_NewValue,rowCount);
00102 Pause();
00103
00104
00105 if (CompressedRowMatricesREqual(*dp3_Value, *dp3_NewValue, rowCount,0)) cout<< "*dp3_Value == dp3_NewValue"<<endl;
00106 else cout<< "*dp3_Value != dp3_NewValue"<<endl;
00107
00108 Pause();
00109
00110
00111
00112 free_2DMatrix(uip3_SparsityPattern, rowCount);
00113 uip3_SparsityPattern=NULL;
00114
00115 free_2DMatrix(dp3_Value, rowCount);
00116 dp3_Value=NULL;
00117
00118 delete dp3_Seed;
00119 dp3_Seed = NULL;
00120
00121 delete ip1_SeedRowCount;
00122 ip1_SeedRowCount=NULL;
00123
00124 delete ip1_SeedColumnCount;
00125 ip1_SeedColumnCount = NULL;
00126
00127 free_2DMatrix(dp3_CompressedMatrix, *ip1_ColorCount);
00128 dp3_CompressedMatrix = NULL;
00129
00130 delete ip1_ColorCount;
00131 ip1_ColorCount = NULL;
00132
00133 delete jr1d;
00134 jr1d = NULL;
00135
00136 delete dp3_NewValue;
00137 dp3_NewValue = NULL;
00138
00139 delete g;
00140 g=NULL;
00141
00142 return 0;
00143 }