Matrix generation cleanup

1. Convert a CompressedRowSparseMatrix constructor which
takes a TripletSparseMatrix as input into a factory method
which allows the input to be transposed.

2. Move the random matrix creation routine for CompressedRowSparseMatrix
from being a standalone function to a static method.

3. Add a corresponding random matrix generation static method to
TripletSparseMatrix.

4. Add a new constructor to TripletSparseMatrix, which takes as input
the row, col and values arrays.

Change-Id: Iec7b184646818f432a5e6822bea3b2f3128a82aa
diff --git a/internal/ceres/unsymmetric_linear_solver_test.cc b/internal/ceres/unsymmetric_linear_solver_test.cc
index 95797c5..a670f00 100644
--- a/internal/ceres/unsymmetric_linear_solver_test.cc
+++ b/internal/ceres/unsymmetric_linear_solver_test.cc
@@ -69,7 +69,8 @@
         options.type == DENSE_NORMAL_CHOLESKY) {
       transformed_A.reset(new DenseSparseMatrix(*A_));
     } else if (options.type == SPARSE_NORMAL_CHOLESKY) {
-      CompressedRowSparseMatrix* crsm =  new CompressedRowSparseMatrix(*A_);
+      CompressedRowSparseMatrix* crsm =
+          CompressedRowSparseMatrix::FromTripletSparseMatrix(*A_);
       // Add row/column blocks structure.
       for (int i = 0; i < A_->num_rows(); ++i) {
         crsm->mutable_row_blocks()->push_back(1);