|
ColPack
|
#include <iostream>#include <fstream>#include <sstream>#include <string>#include <iomanip>#include <ctime>#include <cstdlib>#include <stdarg.h>#include <list>#include <set>#include <map>#include <vector>#include "ColPackHeaders.h"
Go to the source code of this file.
Defines | |
| #define | DOT 1 |
| #define | NEATO 2 |
| #define | TWOPI 3 |
| #define | CIRCO 4 |
| #define | FDP 5 |
Functions | |
| int | WriteMatrixMarket_ADOLCInput (string s_postfix, int i_mode,...) |
| Write out to the file ADOLC Input using Matrix Market format. | |
| int | ConvertHarwellBoeingDouble (string &num_string) |
| Convert a number string under Harwell-Boeing format to the format that C++ can understand. | |
| string | itoa (int i) |
| vector< string > | getListOfColors (string s_InputFile) |
| int | buildDotWithoutColor (ColPack::GraphColoringInterface &g, vector< string > &ListOfColors, string fileName) |
| int | buildDotWithColor (ColPack::GraphColoringInterface &g, vector< string > &ListOfColors, string fileName) |
| Build dot file with colors, also highlight StarColoringConflicts. | |
| int | buildDotWithoutColor (ColPack::BipartiteGraphPartialColoringInterface &g, vector< string > &ListOfColors, string fileName) |
| int | buildDotWithColor (ColPack::BipartiteGraphPartialColoringInterface &g, vector< string > &ListOfColors, string fileName) |
| int | buildDotWithoutColor (ColPack::BipartiteGraphBicoloringInterface &g, vector< string > &ListOfColors, string fileName) |
| int | buildDotWithColor (ColPack::BipartiteGraphBicoloringInterface &g, vector< string > &ListOfColors, string fileName) |
| int | ReadRowCompressedFormat (string s_InputFile, unsigned int ***uip3_SparsityPattern, int &rowCount, int &columnCount) |
| Read a Row Compressed Format file. | |
| bool | isValidOrdering (vector< int > &ordering, int offset=0) |
| Test and make sure that this is a valid ordering. | |
| void | randomOrdering (vector< int > &ordering) |
| string | toUpper (string input) |
| Convert all the characters in input to upper case, ' ', '\ t', '\ n' will be converted to '_'. | |
| int | ConvertRowCompressedFormat2SparseSolversFormat_StructureOnly (unsigned int **uip2_HessianSparsityPattern, unsigned int ui_rowCount, unsigned int **ip2_RowIndex, unsigned int **ip2_ColumnIndex) |
| Build the index struture from Row Compressed Format to Sparse Solvers Format. | |
| int | ConvertCoordinateFormat2RowCompressedFormat (unsigned int *uip1_RowIndex, unsigned int *uip1_ColumnIndex, double *dp1_HessianValue, int i_RowCount, int i_NonZeroCount, unsigned int ***dp3_Pattern, double ***dp3_Values) |
| Convert Coordinate Format to Row Compressed Format. | |
| void | ConvertFileDIMACSFormat2MatrixMarketFormat (string fileNameNoExt) |
| Covert file with DIMACS format to Matrix Market format. | |
| int | ConvertMatrixMarketFormat2RowCompressedFormat (string s_InputFile, unsigned int ***uip3_SparsityPattern, double ***dp3_Value, int &rowCount, int &columnCount) |
| Read the sparse matrix from Matrix-Market-format file and convert to Row Compressed format (used by ADIC) "uip3_SparsityPattern" & "dp3_Value". | |
| int | ConvertRowCompressedFormat2CSR (unsigned int **uip2_SparsityPattern_RowCompressedFormat, int i_rowCount, int **ip_RowIndex, int **ip_ColumnIndex) |
| Convert Row Compressed format (used by ADOL-C) to zero-based indexing, 3-array variation CSR format (used by ADIC) | |
| int | ConvertRowCompressedFormat2ADIC (unsigned int **uip2_SparsityPattern_RowCompressedFormat, int i_rowCount, double **dp2_Value, std::list< std::set< int > > &lsi_SparsityPattern, std::list< std::vector< double > > &lvd_Value) |
| int | MatrixMultiplication_VxS (unsigned int **uip3_SparsityPattern, double **dp3_Value, int rowCount, int columnCount, double **dp2_seed, int colorCount, double ***dp3_CompressedMatrix) |
| Multiply the original sparse matrix (uip3_SparsityPattern,dp3_Value) (in compress sparse row format) with the seed matrix dp2_seed and store the result in "dp3_CompressedMatrix". | |
| int | MatrixMultiplication_VxS__usingVertexPartialColors (std::list< std::set< int > > &lsi_SparsityPattern, std::list< std::vector< double > > &lvd_Value, int columnCount, vector< int > &vi_VertexPartialColors, int colorCount, double ***dp3_CompressedMatrix) |
| int | MatrixMultiplication_SxV (unsigned int **uip3_SparsityPattern, double **dp3_Value, int rowCount, int columnCount, double **dp2_seed, int colorCount, double ***dp3_CompressedMatrix) |
| Multiply the seed matrix dp2_seed with the original sparse matrix (uip3_SparsityPattern,dp3_Value) (in compress sparse row format) and store the result in "dp3_CompressedMatrix". | |
| bool | CompressedRowMatricesAreEqual (double **dp3_Value, double **dp3_NewValue, int rowCount, bool compare_exact=1, bool print_all=0) |
| Compare dp3_Value with dp3_NewValue and see if all the values are equal. | |
| bool | ADICMatricesAreEqual (std::list< std::vector< double > > &lvd_Value, std::list< std::vector< double > > &lvd_NewValue, bool compare_exact=1, bool print_all=0) |
| int | Times2Plus1point5 (double **dp2_Values, int i_RowCount, int i_ColumnCount) |
| just manipulate the value of dp2_Values a little bit. Each non-zero entry in the matrix * 2 + 1.5. | |
| int | Times2 (double **dp2_Values, int i_RowCount, int i_ColumnCount) |
| just manipulate the value of dp2_Values a little bit. Each non-zero entry in the matrix * 2. | |
| int | GenerateValues (unsigned int **uip2_SparsityPattern, int rowCount, double ***dp3_Value) |
| Allocate memory and generate random values for dp3_Value. | |
| int | GenerateValuesForSymmetricMatrix (unsigned int **uip2_SparsityPattern, int rowCount, double ***dp3_Value) |
| Allocate memory and generate random values for dp3_Value of a Symmetric Matrix. | |
| int | DisplayADICFormat_Sparsity (std::list< std::set< int > > &lsi_SparsityPattern) |
| int | DisplayADICFormat_Value (std::list< std::vector< double > > &lvd_Value) |
| int | displayGraph (map< int, map< int, bool > > *graph, vector< int > *vi_VertexColors=NULL, int i_RunInBackground=false, int filter=DOT) |
| int | buildDotWithoutColor (map< int, map< int, bool > > *graph, vector< string > &ListOfColors, string fileName) |
| int | buildDotWithColor (map< int, map< int, bool > > *graph, vector< int > *vi_VertexColors, vector< string > &ListOfColors, string fileName) |
| #define CIRCO 4 |
Definition at line 54 of file extra.h.
Referenced by displayGraph().
| #define FDP 5 |
Definition at line 55 of file extra.h.
Referenced by ColPack::GraphColoring::BuildStarFromColorCombination_forChecking(), and displayGraph().
| #define NEATO 2 |
Definition at line 52 of file extra.h.
Referenced by displayGraph().
| #define TWOPI 3 |
Definition at line 53 of file extra.h.
Referenced by displayGraph().
| bool ADICMatricesAreEqual | ( | std::list< std::vector< double > > & | lvd_Value, |
| std::list< std::vector< double > > & | lvd_NewValue, | ||
| bool | compare_exact = 1, |
||
| bool | print_all = 0 |
||
| ) |
| int buildDotWithColor | ( | ColPack::GraphColoringInterface & | g, |
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
Build dot file with colors, also highlight StarColoringConflicts.
!!! TO DO: improve this function so that it can detect conflicts of all coloring types
Definition at line 608 of file extra.cpp.
References _UNKNOWN, ColPack::GraphCore::GetEdges(), ColPack::GraphColoring::GetStarColoringConflicts(), ColPack::GraphColoring::GetVertexColors(), ColPack::GraphCore::GetVertices(), itoa(), and STEP_DOWN.

| int buildDotWithColor | ( | ColPack::BipartiteGraphPartialColoringInterface & | g, |
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
Definition at line 421 of file extra.cpp.
References ColPack::BipartiteGraphCore::GetEdges(), ColPack::BipartiteGraphPartialColoring::GetLeftVertexColors(), ColPack::BipartiteGraphCore::GetLeftVertices(), ColPack::BipartiteGraphPartialColoring::GetRightVertexColors(), ColPack::BipartiteGraphCore::GetRightVertexCount(), itoa(), and STEP_DOWN.

| int buildDotWithColor | ( | ColPack::BipartiteGraphBicoloringInterface & | g, |
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
| int buildDotWithColor | ( | map< int, map< int, bool > > * | graph, |
| vector< int > * | vi_VertexColors, | ||
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
Definition at line 267 of file extra.cpp.
References _UNKNOWN, and itoa().
Referenced by displayGraph().


| int buildDotWithoutColor | ( | ColPack::GraphColoringInterface & | g, |
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
Definition at line 570 of file extra.cpp.
References ColPack::GraphCore::GetEdges(), ColPack::GraphCore::GetVertices(), itoa(), and STEP_DOWN.

| int buildDotWithoutColor | ( | ColPack::BipartiteGraphPartialColoringInterface & | g, |
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
Definition at line 384 of file extra.cpp.
References ColPack::BipartiteGraphCore::GetEdges(), ColPack::BipartiteGraphCore::GetLeftVertices(), itoa(), and STEP_DOWN.

| int buildDotWithoutColor | ( | ColPack::BipartiteGraphBicoloringInterface & | g, |
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
| int buildDotWithoutColor | ( | map< int, map< int, bool > > * | graph, |
| vector< string > & | ListOfColors, | ||
| string | fileName | ||
| ) |
Definition at line 231 of file extra.cpp.
References itoa().
Referenced by displayGraph().


| bool CompressedRowMatricesAreEqual | ( | double ** | dp3_Value, |
| double ** | dp3_NewValue, | ||
| int | rowCount, | ||
| bool | compare_exact = 1, |
||
| bool | print_all = 0 |
||
| ) |
Compare dp3_Value with dp3_NewValue and see if all the values are equal.
If (compare_exact == 0) num1 and num2 are consider equal if 0.99 <= num1/num2 <= 1.02 If (print_all == 1) all cases of non-equal will be print out. Normally (when print_all == 0), this rountine will stop after the first non-equal.
Definition at line 1371 of file extra.cpp.
Referenced by main().

| int ConvertCoordinateFormat2RowCompressedFormat | ( | unsigned int * | uip1_RowIndex, |
| unsigned int * | uip1_ColumnIndex, | ||
| double * | dp1_HessianValue, | ||
| int | i_RowCount, | ||
| int | i_NonZeroCount, | ||
| unsigned int *** | dp3_Pattern, | ||
| double *** | dp3_Values | ||
| ) |
Convert Coordinate Format to Row Compressed Format.
dp3_Pattern and dp3_Values will be allocated memory (using malloc) and populated with the matrix structure in Row Compressed Format
Input: (Coordinate Format)
Output: (Row Compressed Format)
Definition at line 836 of file extra.cpp.
Referenced by ColPack::HessianRecovery::IndirectRecover_CoordinateFormat_unmanaged().

| void ConvertFileDIMACSFormat2MatrixMarketFormat | ( | string | fileNameNoExt | ) |
Covert file with DIMACS format to Matrix Market format.
DIMACS graph format: http://www.dis.uniroma1.it/~challenge9/format.shtml#graph Note: DIMACS graph format is for directed graph => the equivalent matrix is squared and non-systemic
Read input from file "<fileNameNoExt>.gr" (DIMACS graph format) and generate file "<fileNameNoExt>.mtx" (Matrix Market format)
| int ConvertHarwellBoeingDouble | ( | string & | num_string | ) |
Convert a number string under Harwell-Boeing format to the format that C++ can understand.
For example: -6.310289677458059D-07 to -6.310289677458059E-07
Essentially, this function just search backward for the letter D and replace it with E
Return value:
Definition at line 343 of file extra.cpp.
Referenced by ColPack::GraphInputOutput::ReadHarwellBoeingAdjacencyGraph().

| int ConvertMatrixMarketFormat2RowCompressedFormat | ( | string | s_InputFile, |
| unsigned int *** | uip3_SparsityPattern, | ||
| double *** | dp3_Value, | ||
| int & | rowCount, | ||
| int & | columnCount | ||
| ) |
Read the sparse matrix from Matrix-Market-format file and convert to Row Compressed format (used by ADIC) "uip3_SparsityPattern" & "dp3_Value".
Read in a matrix from matrix-market format file and create a matrix stored in compressed sparse row format The Matrix-Market-format has 3 values in each row, the row index, column index and numerical value of each nonzero. The last 4 parameters of this routine are output parameters (unsigned int *** uip3_SparsityPattern, double*** dp3_Value,int &rowCount, int &columnCount)
Definition at line 1046 of file extra.cpp.
References ColPack::f(), mm_is_coordinate, mm_is_general, mm_is_integer, mm_is_pattern, mm_is_real, mm_is_symmetric, mm_read_banner(), mm_typecode_to_str(), and Pause().
Referenced by main().


| int ConvertRowCompressedFormat2ADIC | ( | unsigned int ** | uip2_SparsityPattern_RowCompressedFormat, |
| int | i_rowCount, | ||
| double ** | dp2_Value, | ||
| std::list< std::set< int > > & | lsi_SparsityPattern, | ||
| std::list< std::vector< double > > & | lvd_Value | ||
| ) |
| int ConvertRowCompressedFormat2CSR | ( | unsigned int ** | uip2_SparsityPattern_RowCompressedFormat, |
| int | i_rowCount, | ||
| int ** | ip_RowIndex, | ||
| int ** | ip_ColumnIndex | ||
| ) |
| int ConvertRowCompressedFormat2SparseSolversFormat_StructureOnly | ( | unsigned int ** | uip2_HessianSparsityPattern, |
| unsigned int | ui_rowCount, | ||
| unsigned int ** | ip2_RowIndex, | ||
| unsigned int ** | ip2_ColumnIndex | ||
| ) |
Build the index struture from Row Compressed Format to Sparse Solvers Format.
ip2_RowIndex and ip2_ColumnIndex will be allocated memory (using malloc) and populated with the matrix structure in Sparse Solvers Format
Input:
Output:
Definition at line 798 of file extra.cpp.
References Pause().
Referenced by ColPack::HessianRecovery::DirectRecover_SparseSolversFormat_unmanaged(), and ColPack::HessianRecovery::IndirectRecover_SparseSolversFormat_unmanaged().


| int DisplayADICFormat_Sparsity | ( | std::list< std::set< int > > & | lsi_SparsityPattern | ) |
| int DisplayADICFormat_Value | ( | std::list< std::vector< double > > & | lvd_Value | ) |
| int displayGraph | ( | map< int, map< int, bool > > * | graph, |
| vector< int > * | vi_VertexColors = NULL, |
||
| int | i_RunInBackground = false, |
||
| int | filter = DOT |
||
| ) |
Definition at line 198 of file extra.cpp.
References buildDotWithColor(), buildDotWithoutColor(), CIRCO, FDP, getListOfColors(), itoa(), NEATO, and TWOPI.
Referenced by ColPack::GraphColoring::BuildStarFromColorCombination_forChecking().


| int GenerateValues | ( | unsigned int ** | uip2_SparsityPattern, |
| int | rowCount, | ||
| double *** | dp3_Value | ||
| ) |
| int GenerateValuesForSymmetricMatrix | ( | unsigned int ** | uip2_SparsityPattern, |
| int | rowCount, | ||
| double *** | dp3_Value | ||
| ) |
| vector<string> getListOfColors | ( | string | s_InputFile | ) |
Definition at line 362 of file extra.cpp.
Referenced by displayGraph().

| bool isValidOrdering | ( | vector< int > & | ordering, |
| int | offset = 0 |
||
| ) |
Test and make sure that this is a valid ordering.
This routine will test for:
Definition at line 716 of file extra.cpp.
Referenced by ColPack::GraphOrdering::CheckVertexOrdering().

| string itoa | ( | int | i | ) |
Definition at line 353 of file extra.cpp.
Referenced by buildDotWithColor(), buildDotWithoutColor(), and displayGraph().

| int MatrixMultiplication_SxV | ( | unsigned int ** | uip3_SparsityPattern, |
| double ** | dp3_Value, | ||
| int | rowCount, | ||
| int | columnCount, | ||
| double ** | dp2_seed, | ||
| int | colorCount, | ||
| double *** | dp3_CompressedMatrix | ||
| ) |
Multiply the seed matrix dp2_seed with the original sparse matrix (uip3_SparsityPattern,dp3_Value) (in compress sparse row format) and store the result in "dp3_CompressedMatrix".
(*dp3_CompressedMatrix) = dp2_seed * (*dp3_Value)
Definition at line 1284 of file extra.cpp.
Referenced by main().

| int MatrixMultiplication_VxS | ( | unsigned int ** | uip3_SparsityPattern, |
| double ** | dp3_Value, | ||
| int | rowCount, | ||
| int | columnCount, | ||
| double ** | dp2_seed, | ||
| int | colorCount, | ||
| double *** | dp3_CompressedMatrix | ||
| ) |
Multiply the original sparse matrix (uip3_SparsityPattern,dp3_Value) (in compress sparse row format) with the seed matrix dp2_seed and store the result in "dp3_CompressedMatrix".
(*dp3_CompressedMatrix) = (*dp3_Value) * dp2_seed
Definition at line 1246 of file extra.cpp.
References Pause().
Referenced by main().


| int MatrixMultiplication_VxS__usingVertexPartialColors | ( | std::list< std::set< int > > & | lsi_SparsityPattern, |
| std::list< std::vector< double > > & | lvd_Value, | ||
| int | columnCount, | ||
| vector< int > & | vi_VertexPartialColors, | ||
| int | colorCount, | ||
| double *** | dp3_CompressedMatrix | ||
| ) |
| void randomOrdering | ( | vector< int > & | ordering | ) |
Definition at line 909 of file extra.cpp.
Referenced by ColPack::BipartiteGraphPartialOrdering::ColumnRandomOrdering(), ColPack::BipartiteGraphOrdering::RandomOrdering(), ColPack::GraphOrdering::RandomOrdering(), and ColPack::BipartiteGraphPartialOrdering::RowRandomOrdering().

| int ReadRowCompressedFormat | ( | string | s_InputFile, |
| unsigned int *** | uip3_SparsityPattern, | ||
| int & | rowCount, | ||
| int & | columnCount | ||
| ) |
Read a Row Compressed Format file.
Read a Row Compressed Format file Line 1: <# of rows> <# of columns> <# of non-zeros> Line 2-(# of non-zeros + 1): <# of non-zeros in that row> <index of the 1st non-zero> <index of the 2nd non-zero> ... <index of the (# of non-zeros in that row)th non-zero>
| int Times2 | ( | double ** | dp2_Values, |
| int | i_RowCount, | ||
| int | i_ColumnCount | ||
| ) |
| int Times2Plus1point5 | ( | double ** | dp2_Values, |
| int | i_RowCount, | ||
| int | i_ColumnCount | ||
| ) |
| string toUpper | ( | string | input | ) |
Convert all the characters in input to upper case, ' ', '\ t', '\ n' will be converted to '_'.
Definition at line 920 of file extra.cpp.
Referenced by ColPack::BipartiteGraphBicoloringInterface::Bicoloring(), ColPack::BipartiteGraphOrdering::OrderVertices(), ColPack::BipartiteGraphPartialOrdering::OrderVertices(), ColPack::GraphOrdering::OrderVertices(), and ColPack::BipartiteGraphPartialColoringInterface::PartialDistanceTwoColoring().

| int WriteMatrixMarket_ADOLCInput | ( | string | s_postfix, |
| int | i_mode, | ||
| ... | |||
| ) |
Write out to the file ADOLC Input using Matrix Market format.
Input parameters:
Definition at line 29 of file extra.cpp.
Referenced by ColPack::GraphColoringInterface::GraphColoringInterface(), and ColPack::HessianRecovery::IndirectRecover_CoordinateFormat_unmanaged().
