More pre-ordering support.

1. CX_SPARSE supports pre-ordering of the jacobian.
2. Add support for constrained approximate minimum degree ordering
   for SuiteSparse versions >= 4.2.0
3. Using 2, support for pre-ordering for SPARSE_SCHUR when used
   with SUITE_SPARSE.
4. Using 2, support for user orderings in SPARSE_NORMAL_CHOLESKY.
5. Minor cleanups in documentation and code all around.
6. Test update and refactoring.

Change-Id: Ibfe3ac95d59d54ab14d1d60a07f767688070f29f
diff --git a/internal/ceres/cxsparse.h b/internal/ceres/cxsparse.h
index d34b635..6004301 100644
--- a/internal/ceres/cxsparse.h
+++ b/internal/ceres/cxsparse.h
@@ -70,14 +70,49 @@
   // with Free. May return NULL if the compression or allocation fails.
   cs_di* CreateSparseMatrix(TripletSparseMatrix* A);
 
+  // B = A'
+  //
+  // The returned matrix should be deallocated with Free when not used
+  // anymore.
+  cs_di* TransposeMatrix(cs_di* A);
+
+  // C = A * B
+  //
+  // The returned matrix should be deallocated with Free when not used
+  // anymore.
+  cs_di* MatrixMatrixMultiply(cs_di* A, cs_di* B);
+
   // Computes a symbolic factorization of A that can be used in SolveCholesky.
+  //
   // The returned matrix should be deallocated with Free when not used anymore.
   cs_dis* AnalyzeCholesky(cs_di* A);
 
+  // Computes a symbolic factorization of A that can be used in
+  // SolveCholesky, but does not compute a fill-reducing ordering.
+  //
+  // The returned matrix should be deallocated with Free when not used anymore.
+  cs_dis* AnalyzeCholeskyWithNaturalOrdering(cs_di* A);
+
+  // Computes a symbolic factorization of A that can be used in
+  // SolveCholesky. The difference from AnalyzeCholesky is that this
+  // function first detects the block sparsity of the matrix using
+  // information about the row and column blocks and uses this block
+  // sparse matrix to find a fill-reducing ordering. This ordering is
+  // then used to find a symbolic factorization. This can result in a
+  // significant performance improvement AnalyzeCholesky on block
+  // sparse matrices.
+  //
+  // The returned matrix should be deallocated with Free when not used
+  // anymore.
   cs_dis* BlockAnalyzeCholesky(cs_di* A,
                                const vector<int>& row_blocks,
                                const vector<int>& col_blocks);
 
+  // Compute an fill-reducing approximate minimum degree ordering of
+  // the matrix A. ordering should be non-NULL and should point to
+  // enough memory to hold the ordering for the rows of A.
+  void ApproximateMinimumDegreeOrdering(cs_di* A, int* ordering);
+
   void Free(cs_di* sparse_matrix);
   void Free(cs_dis* symbolic_factorization);