Compilation error fixes
- In C you're not allowed to define variables in the middle
of the block. This was violated in curve_fitting.c by
calling ceres_init() in the beginning of main() and declaring
variables later.
- Also ifdef-ed suitesparse stuff in covariance estimation module.
This solves compilation error when you don't have suitesparse
compiled/installed.
Change-Id: I22b543c09ea01f55e127079daade99a0b781f789
diff --git a/examples/curve_fitting.c b/examples/curve_fitting.c
index a2fb5b9..5e3cd16 100644
--- a/examples/curve_fitting.c
+++ b/examples/curve_fitting.c
@@ -144,18 +144,21 @@
}
int main(int argc, char** argv) {
- ceres_init(argc, argv);
-
/* Note: Typically it is better to compact m and c into one block,
* but in this case use separate blocks to illustrate the use of
* multiple parameter blocks. */
double m = 0.0;
double c = 0.0;
+
double *parameter_pointers[] = { &m, &c };
int parameter_sizes[] = { 1, 1 };
- ceres_problem_t* problem = ceres_create_problem();
+ ceres_problem_t* problem;
int i;
+
+ ceres_init(argc, argv);
+
+ problem = ceres_create_problem();
for (i = 0; i < num_observations; ++i) {
ceres_problem_add_residual_block(
problem,
diff --git a/internal/ceres/covariance_impl.h b/internal/ceres/covariance_impl.h
index 42b262e..0be53e7 100644
--- a/internal/ceres/covariance_impl.h
+++ b/internal/ceres/covariance_impl.h
@@ -80,7 +80,9 @@
map<const double*, int> parameter_block_to_row_index_;
set<const double*> constant_parameter_blocks_;
scoped_ptr<CompressedRowSparseMatrix> covariance_matrix_;
+#ifndef CERES_NO_SUITESPARSE
SuiteSparse ss_;
+#endif
};
} // namespace internal