Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 colpack (1.0.10-2) unstable; urgency=medium
 .
   * bump to dh10
   * bump policy
   * remove unnecessary build dependency
   * prune inappropriate files from examples (squelching reproducability &
     multiarch issues)
   * harden
   * secure repo URLs
Author: Barak A. Pearlmutter <bap@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2017-08-19

--- colpack-1.0.10.orig/Main/Main.cpp
+++ colpack-1.0.10/Main/Main.cpp
@@ -1,39 +1,130 @@
-/* Notes:
- * - This code will crash if the matrix only has patterns (no value)
-//*/
-
 #include "ColPackHeaders.h"
-
+#include <getopt.h>
 using namespace ColPack;
-using namespace std;
-
-
+void official_example(std::string gname);
+void usage(std::string appname);
 
-#include "extra.h" //This .h file contains functions that are used in the below examples:
-					//ReadMM(), MatrixMultiplication...(), Times2Plus1point5(), displayMatrix() and displayCompressedRowMatrix()
-#include "stat.h"
+int main(int argc, char* argv[]) {
+    if(argc==1){
+        std::cout<<"using --help or -h for more details"<<endl;
+        exit(1);
+    }
+
+    std::string gname(""),order(""),color("");
+    while(1){
+        static struct option long_options[]={
+            {"graph", required_argument, 0, 'g'},
+            {"file" , required_argument, 0, 'f'},
+            {"order", required_argument, 0, 'o'},
+            {"color", required_argument, 0, 'c'},
+            {"help",  no_argument,       0, 'h'},
+            {0,0,0,0}
+        };
+        int c,option_index=0;
+        c=getopt_long(argc,argv,"g:f:o:d:h",
+                    long_options, &option_index);
+        if(c==-1)
+            break;
+        switch(c) {
+            case 'h':
+                usage(argv[0]);
+                exit(1);
+            case 'g':
+            case 'f':
+                gname=optarg;
+                break;
+            case 'o':
+                order=optarg;
+                break;
+            case 'c':
+                color=optarg;
+                break;
+            default:
+                std::cout<<"using --help or -h for more details"<<std::endl;
+                exit(1);
+        }
+    }
+
+    if(gname.empty() && order.empty() && color.empty() && optind<argc && argc-optind<=3)
+        switch(argc-optind){
+            case 3:
+                color=argv[optind+2];
+            case 2:
+                order=argv[optind+1];
+            case 1:
+                gname=argv[optind];
+                break;
+            default:
+                std::cout<<"using --help or -h for more details"<<std::endl;
+                exit(1);
+        }
+    if(gname.empty())
+        official_example("Graphs/bcsstk01.mtx");
+    else if(order.empty() || color.empty())
+        official_example(gname);
+    else{
+        GraphColoringInterface *g = new GraphColoringInterface(SRC_FILE, gname.c_str(), "AUTO_DETECTED");
+        g->Coloring(order.c_str(), color.c_str());
+        std::cout<<"graph :"<<gname<<std::endl;
+        std::cout<<"order :"<<order<<std::endl;
+        std::cout<<"color :"<<color<<std::endl;
+        std::cout<<"result:"<<g->GetVertexColorCount()<<std::endl;
+        delete g;
+    }
+    return 0;
+}
 
-int main(int argc, const char* argv[]) {
-	vector<string> Orderings;
-	Orderings.push_back("NATURAL");
-	Orderings.push_back("LARGEST_FIRST");
-	Orderings.push_back("DYNAMIC_LARGEST_FIRST");
-	Orderings.push_back("SMALLEST_LAST");
-	Orderings.push_back("INCIDENCE_DEGREE");
-	Orderings.push_back("RANDOM");
+void usage(std::string appname){
+    std::cerr<<std::endl;
+    std::cerr<<std::endl;
+    std::cerr<<std::endl;
+    std::cerr<<"Welcome to use ColPack!"<<std::endl;
+    std::cerr<<"### USAGE "<<std::endl;
+    std::cerr<<"$"<<appname<<" <GraphName> [order_option] [coloring_option]"<<std::endl;
+    std::cerr<<"$"<<appname<<" --graph <GraphName> [--order <order_option>] [--color <coloring_option>]"<<std::endl;
+    std::cerr<<"$"<<appname<<" -g <GraphName> [-o <order_option>] [-c <coloring_option>]"<<std::endl;
+    std::cerr<<std::endl;
+    std::cerr<<"-g or --graph can be changed to -f --file in case needed."<<std::endl;
+    std::cerr<<std::endl;
+    std::cerr<<"### HELP "<<std::endl;
+    std::cerr<<"$"<<appname<<" -h"<<std::endl;
+    std::cerr<<"$"<<appname<<" --help"<<std::endl;
+    std::cerr<<std::endl;
+    std::cerr<<"### OPTIONs "<<std::endl;
+    std::cerr<<"order: NATURAL, LARGEST_FIRST, DYNAMIC_LARGEST_FIRST, SMALLEST_LAST, INCIDENCE_DEGREE, RANDOM"<<std::endl;
+    std::cerr<<"color: DISTANCE_ONE, ACYCLIC, ACYCLIC_FOR_INDIRECT_RECOVERY, STAR, RESTRICTED_STAR, DISTANCE_TWO"<<std::endl;
+    std::cerr<<std::endl;
+    std::cerr<<"### EXAMPLE "<<std::endl;
+    std::cerr<<"$"<<appname<<" Graphs/bcsstk01.mtx"<<std::endl; 
+    std::cerr<<"$"<<appname<<" Graphs/bcsstk01.mtx LARGEST_FIRST DISTANCE_ONE"<<std::endl; 
+    std::cerr<<"$"<<appname<<" --graph Graphs/bcsstk01.mtx --order SMALLEST_LAST -d DISTANCE_TWO"<<std::endl; 
+    std::cerr<<"$"<<appname<<" -f Graphs/bcsstk01.mtx -o RANDOM -distance DISTANCE_ONE"<<std::endl; 
+    std::cerr<<std::endl;
+    std::cerr<<std::endl;
+    std::cerr<<std::endl;
+    return;
+}
 
-	vector<string> Colorings;
-	Colorings.push_back("EXPLICIT_COVERING__STAR_BICOLORING");
-	Colorings.push_back("EXPLICIT_COVERING__MODIFIED_STAR_BICOLORING");
-	Colorings.push_back("IMPLICIT_COVERING__STAR_BICOLORING");
-	Colorings.push_back("IMPLICIT_COVERING__GREEDY_STAR_BICOLORING");
+void official_example(std::string gname){
 
-	map<string, bool> stat_flags;
-	stat_flags["output_append"]=true;
-	stat_flags["NumberOfColors"]=true;
-	stat_flags["Time"]=true;
+    std::cout<<"List common coloring result for example graph:"<<gname<<std::endl;
+    std::cout<<"using --help or -h for more details"<<std::endl;
+    GraphColoringInterface * g = new GraphColoringInterface(SRC_FILE, gname.c_str(), "AUTO_DETECTED");
+    string orderpool[6]={"NATURAL", "LARGEST_FIRST", "DYNAMIC_LARGEST_FIRST", "SMALLEST_LAST", "INCIDENCE_DEGREE", "RANDOM"};
+    string colorpool[6]={"DISTANCE_ONE", "ACYCLIC", "ACYCLIC_FOR_INDIRECT_RECOVERY", "STAR", "RESTRICTED_STAR", "DISTANCE_TWO"};
+    std::vector<std::string> order(orderpool,orderpool+6);
+    std::vector<std::string> color(colorpool,colorpool+6);
+    std::cout<<std::endl;    
+    for(std::vector<std::string>::const_iterator itc=color.begin(); itc!=color.end(); itc++){
+        std::cout<<"#"<<*itc<<" Result: "<<std::endl;
+        for(std::vector<std::string>::const_iterator ito=order.begin(); ito!=order.end(); ito++){
+            g->Coloring(ito->c_str(), itc->c_str());
+            std::cout<<g->GetVertexColorCount()<<"  : ("<<*ito<<")"<<std::endl;
+        }
+        std::cout<<std::endl;
+    }
+    delete g;
+    return;
+}
 
-	toFileBiC("/home/nguyend/Desktop/Duck/Research/Prog/graph/MM_collection/", "test1", Orderings,  Colorings,  stat_flags );
 
-	return 0;
-}
--- colpack-1.0.10.orig/README.md
+++ colpack-1.0.10/README.md
@@ -6,6 +6,65 @@ http://cscapes.cs.purdue.edu/coloringpag
 ColPack's project home page:
 http://cscapes.cs.purdue.edu/coloringpage/
 
+# ColPack 
+
+ColPack is a package comprising of implementations of algorithms for the specialized vertex coloring problems discussed in the previous section as well as algorithms for a variety of related supporting tasks in derivative computation.
+
+### Coloring capabilities
+
+the table below gives a quick summary of all the coloring problems (on general and bipartite graphs) supported by ColPack.
+
+| General Graph Coloring | Bipartite Graph one-sided coloring | Bipartite Graph Bicoloring |  
+| ---- | ----------------- | -------------------|  
+| Distance 1 coloring  | Partial distance-2 coloring  | Star bicoloring |  
+| Distance 2 coloring | Partial distance-2 coloring  |   |  
+| Star coloring |      |   |  
+| Acyclic coloring   | |
+|  Restricted star coloring| |
+|  Triangular coloring| |
+
+All of the coloring problems listed in the above table are NP-hard. Their corresponding algorithms in ColPack are *greedy* heuristics in the sense that the algorithms progressively extend a partial coloring by processing one vertex at a time, in some order, in each step assigning a vertex the smallest allowable color. Listed beneath each coloring problem in the table is the complexity of the corresponding algorithm in ColPack. In the cases where ColPack has multiple algorithms for a problem (these are designated by the superscript †), the complexity expression corresponds to that of the fastest algorithm. In the complexity expressions,
+
+*the complexity of the corresponding algorithm can be found here [ColPack's project](http://cscapes.cs.purdue.edu/coloringpage/software.htm)*
+	
+
+
+### Ordering techniques
+
+The order in which vertices are processed in a greedy coloring algorithm determines the number of colors used by the algorithm. ColPack has implementations of various effective ordering techniques for each of the supported coloring problems. These are summarized in the table below.
+
+| General Graph Coloring | Bipartite Graph one-sided coloring | Bipartite Graph Bicoloring | 
+|---|---|---|
+| Natural          | Column Natural                     | Natural                    |
+| Largest First    | Column Largest First               | Largest First              |
+| Smallest Last    | Column Smallest Last               | Smallest Last              |
+| Incidence Degree | Column Incidence Degree            | Incidence Degree           |
+| Dynamic Largest First           | Row Natural         | Dynamic Largest First      |
+| Distance-2 Largest First        | Row Largest First   | Selective Largest First    |
+| Distance-2 Smallest Last        | Row Smallest Last   | Selective Smallest Last    |
+| Distance-2 Incidence Degree     | Row Incidence Degree| Selective Incidence Degree |
+| Distance-2 Dynamic Largest First|                     |  
+
+
+### Recovery routines
+
+Besides coloring and ordering capabilities, ColPack also has routines for recovering the numerical values of the entries of a derivative matrix from a compressed representation. In particular the following reconstruction routines are currently available:
+
+* Recovery routines for direct (via star coloring ) and substitution-based (via acyclic coloring) Hessian computation
+* Recovery routines for unidirectional, direct Jacobian computation (via column-wise or row-wise distance-2 coloring)
+* Recovery routines for bidirectional, direct Jacobian computation via star bicoloring
+
+
+### Graph construction routines
+
+Finally, as a supporting functionality, ColPack has routines for constructing bipartite graphs (for Jacobians) and adjacency graphs (for Hessians) from files specifying matrix sparsity structures in various formats, including Matrix Market, Harwell-Boeing and MeTis.
+
+### ColPack : organization
+ColPack is written in an object-oriented fashion in C++ heavily using the Standard Template Library (STL).  It is designed to be simple, modular, extensible and efficient. Figure 1 below gives an overview of the structure of the major classes of ColPack. 
+
+![ColPack Organization](http://cscapes.cs.purdue.edu/coloringpage/software_files/ColPack_structure_2.png)  
+
+
 Ubuntu Build Instructions
 =========================
 In the `ColPack` directory run the following:
@@ -14,3 +73,86 @@ In the `ColPack` directory run the follo
     ./configure --prefix=/path/to/install/
     make -j 4   #Where "4" is the number of cores on your machine
     make install
+
+
+
+
+### USAGE 
+
+	$./ColPack <GraphName> [order_option] [coloring_option]
+	$./ColPack --graph <GraphName> [--order <order_option>] [--color <coloring_option>]
+	$./ColPack -g <GraphName> [-o <order_option>] [-c <coloring_option>]
+
+-g or --graph can be changed to -f --file in case needed.
+
+### HELP 
+	$./ColPack -h
+	$./ColPack --help
+
+### OPTIONs 
+* order: `NATURAL, LARGEST_FIRST, DYNAMIC_LARGEST_FIRST, SMALLEST_LAST, INCIDENCE_DEGREE, RANDOM`  
+* color: `DISTANCE_ONE, ACYCLIC, ACYCLIC_FOR_INDIRECT_RECOVERY, STAR, RESTRICTED_STAR, DISTANCE_TWO`
+
+### EXAMPLE 
+	$./ColPack Graphs/bcsstk01.mtx
+	$./ColPack Graphs/bcsstk01.mtx LARGEST_FIRST DISTANCE_ONE
+	$./ColPack --graph Graphs/bcsstk01.mtx --order SMALLEST_LAST -d DISTANCE_TWO
+	$./ColPack -f Graphs/bcsstk01.mtx -o RANDOM -distance DISTANCE_ONE
+
+### EXAMPLE OUTPUT
+
+	ReadMatrixMarketAdjacencyGraph
+	Found file Graphs/bcsstk01.mtx
+	Graph of Market Market type: [matrix coordinate real symmetric]
+			Graph structure and VALUES will be read
+
+	#DISTANCE_ONE Result: 
+	6  : (NATURAL)
+	6  : (LARGEST_FIRST)
+	6  : (DYNAMIC_LARGEST_FIRST)
+	6  : (SMALLEST_LAST)
+	6  : (INCIDENCE_DEGREE)
+	6  : (RANDOM)
+
+	#ACYCLIC Result: 
+	8  : (NATURAL)
+	8  : (LARGEST_FIRST)
+	8  : (DYNAMIC_LARGEST_FIRST)
+	8  : (SMALLEST_LAST)
+	8  : (INCIDENCE_DEGREE)
+	8  : (RANDOM)
+
+	#ACYCLIC_FOR_INDIRECT_RECOVERY Result: 
+	8  : (NATURAL)
+	8  : (LARGEST_FIRST)
+	8  : (DYNAMIC_LARGEST_FIRST)
+	8  : (SMALLEST_LAST)
+	8  : (INCIDENCE_DEGREE)
+	8  : (RANDOM)
+
+	#STAR Result: 
+	12  : (NATURAL)
+	12  : (LARGEST_FIRST)
+	12  : (DYNAMIC_LARGEST_FIRST)
+	12  : (SMALLEST_LAST)
+	12  : (INCIDENCE_DEGREE)
+	12  : (RANDOM)
+
+	#RESTRICTED_STAR Result: 
+	15  : (NATURAL)
+	15  : (LARGEST_FIRST)
+	15  : (DYNAMIC_LARGEST_FIRST)
+	15  : (SMALLEST_LAST)
+	15  : (INCIDENCE_DEGREE)
+	15  : (RANDOM)
+
+	#DISTANCE_TWO Result: 
+	15  : (NATURAL)
+	15  : (LARGEST_FIRST)
+	15  : (DYNAMIC_LARGEST_FIRST)
+	15  : (SMALLEST_LAST)
+	15  : (INCIDENCE_DEGREE)
+	15  : (RANDOM)
+
+
+
--- colpack-1.0.10.orig/configure.ac
+++ colpack-1.0.10/configure.ac
@@ -36,43 +36,42 @@ AC_CONFIG_FILES(Makefile)
 AM_PROG_AR
 LT_INIT
 
-AC_MSG_CHECKING(Build examples)
+AC_MSG_CHECKING([Build examples])
 AC_ARG_ENABLE([examples],
      [AS_HELP_STRING([--enable-examples],[Build examples])],
-     [case "${enableval}" in
-       yes) examples=true ;;
-       no)  examples=false ;;
-       *) AC_MSG_ERROR([bad value ${enableval} for --enable-examples]) ;;
-     esac],[examples=false])
-     AM_CONDITIONAL([EXAMPLES], [test x$examples = xtrue])
+     [AS_CASE([${enableval}],
+       [yes],[examples=true],
+       [no],[examples=false],
+       [AC_MSG_ERROR([bad value ${enableval} for --enable-examples])])],
+     [examples=false])
+AM_CONDITIONAL([EXAMPLES], [test x$examples = xtrue])
+AC_MSG_RESULT([$examples])
 
-AC_MSG_CHECKING(OpenMP)
+AC_MSG_CHECKING([OpenMP])
 AC_ARG_ENABLE([openmp],
      [AS_HELP_STRING([--enable-openmp],[Enable OpenMP])],
-     [case "${enableval}" in
-       yes) openmp=true ;;
-       no)  openmp=false ;;
-       *) AC_MSG_ERROR([bad value ${enableval} for --enable-openmp]) ;;
-     esac],[openmp=false])
-     AM_CONDITIONAL([ENABLE_OPENMP], [test x$openmp = xtrue])
+     [AS_CASE([${enableval}],
+       [yes],[openmp=true],
+       [no],[openmp=false],
+       [AC_MSG_ERROR([bad value ${enableval} for --enable-openmp])])],
+     [openmp=false])
+AM_CONDITIONAL([ENABLE_OPENMP], [test x$openmp = xtrue])
+AC_MSG_RESULT([$openmp])
 
 AC_OUTPUT
 
 # echo configuration
-echo \
-"
------------------------------------------------------------------------------
-Configuration:
-
-  C compiler:                       ${CC}
-  C++ compiler:                     ${CXX}
-  Linker:                           ${LD}
-  Source code location:             `pwd`
-  Install path:                     ${prefix}
-
-  CFLAGS:                           ${CFLAGS}
-  CXXFLAGS:                         ${CXXFLAGS}
-
-  Use OpenMP:                       ${openmp}
-  Build examples:                   ${examples}
-"
+AS_ECHO(["-----------------------------------------------------------------------------"])
+AS_ECHO(["Configuration:"])
+AS_ECHO([""])
+AS_ECHO(["  C compiler:                       ${CC}"])
+AS_ECHO(["  C++ compiler:                     ${CXX}"])
+AS_ECHO(["  Linker:                           ${LD}"])
+AS_ECHO(["  Source code location:             `pwd`"])
+AS_ECHO(["  Install path:                     ${prefix}"])
+AS_ECHO([""])
+AS_ECHO(["  CFLAGS:                           ${CFLAGS}"])
+AS_ECHO(["  CXXFLAGS:                         ${CXXFLAGS}"])
+AS_ECHO([""])
+AS_ECHO(["  Use OpenMP:                       ${openmp}"])
+AS_ECHO(["  Build examples:                   ${examples}"])
