Extend support writing linear least squares problems to disk.

1. Make the mechanism for writing problems to disk, generic and
controllable using an enum DumpType visible in the API.

2. Instead of single file containing protocol buffers, now matrices can
be written in a matlab/octave friendly format. This is now the default.

3. The support for writing problems to disk is moved into
linear_least_squares_problem.cc/h

4. SparseMatrix now has a ToTextFile virtual method which is
implemented by each of its subclasses to write a (i,j,s) triplets.

5. Minor changes to simple_bundle_adjuster to enable logging at startup.
diff --git a/internal/ceres/sparse_matrix.h b/internal/ceres/sparse_matrix.h
index 962b803..562210d 100644
--- a/internal/ceres/sparse_matrix.h
+++ b/internal/ceres/sparse_matrix.h
@@ -33,6 +33,7 @@
 #ifndef CERES_INTERNAL_SPARSE_MATRIX_H_
 #define CERES_INTERNAL_SPARSE_MATRIX_H_
 
+#include <cstdio>
 #include "ceres/linear_operator.h"
 #include "ceres/internal/eigen.h"
 #include "ceres/types.h"
@@ -87,9 +88,14 @@
 
 #ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
   // Dump the sparse matrix to a proto. Destroys the contents of proto.
-  virtual void ToProto(SparseMatrixProto *proto) const = 0;
+  virtual void ToProto(SparseMatrixProto* proto) const = 0;
 #endif
 
+  // Write out the matrix as a sequence of (i,j,s) triplets. This
+  // format is useful for loading the matrix into MATLAB/octave as a
+  // sparse matrix.
+  virtual void ToTextFile(FILE* file) const = 0;
+
   // Accessors for the values array that stores the entries of the
   // sparse matrix. The exact interpreptation of the values of this
   // array depends on the particular kind of SparseMatrix being