Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/ceres/internal/ceres/linear_least_squares_problems.cc')
-rw-r--r--extern/ceres/internal/ceres/linear_least_squares_problems.cc44
1 files changed, 18 insertions, 26 deletions
diff --git a/extern/ceres/internal/ceres/linear_least_squares_problems.cc b/extern/ceres/internal/ceres/linear_least_squares_problems.cc
index 7c523d399e1..299051c5bcf 100644
--- a/extern/ceres/internal/ceres/linear_least_squares_problems.cc
+++ b/extern/ceres/internal/ceres/linear_least_squares_problems.cc
@@ -101,7 +101,7 @@ LinearLeastSquaresProblem* LinearLeastSquaresProblem0() {
int counter = 0;
for (int i = 0; i < 3; ++i) {
- for (int j = 0; j< 2; ++j) {
+ for (int j = 0; j < 2; ++j) {
Ai[counter] = i;
Aj[counter] = j;
++counter;
@@ -132,7 +132,6 @@ LinearLeastSquaresProblem* LinearLeastSquaresProblem0() {
return problem;
}
-
/*
A = [1 0 | 2 0 0
3 0 | 0 4 0
@@ -187,9 +186,8 @@ LinearLeastSquaresProblem* LinearLeastSquaresProblem1() {
int num_cols = 5;
LinearLeastSquaresProblem* problem = new LinearLeastSquaresProblem;
- TripletSparseMatrix* A = new TripletSparseMatrix(num_rows,
- num_cols,
- num_rows * num_cols);
+ TripletSparseMatrix* A =
+ new TripletSparseMatrix(num_rows, num_cols, num_rows * num_cols);
problem->b.reset(new double[num_rows]);
problem->D.reset(new double[num_cols]);
problem->num_eliminate_blocks = 2;
@@ -404,7 +402,6 @@ LinearLeastSquaresProblem* LinearLeastSquaresProblem2() {
return problem;
}
-
/*
A = [1 0
3 0
@@ -620,8 +617,7 @@ bool DumpLinearLeastSquaresProblemToConsole(const SparseMatrix* A,
LOG(INFO) << "A^T: \n" << AA.transpose();
if (D != NULL) {
- LOG(INFO) << "A's appended diagonal:\n"
- << ConstVectorRef(D, A->num_cols());
+ LOG(INFO) << "A's appended diagonal:\n" << ConstVectorRef(D, A->num_cols());
}
if (b != NULL) {
@@ -659,10 +655,8 @@ bool DumpLinearLeastSquaresProblemToTextFile(const string& filename_base,
string matlab_script;
StringAppendF(&matlab_script,
"function lsqp = load_trust_region_problem()\n");
- StringAppendF(&matlab_script,
- "lsqp.num_rows = %d;\n", A->num_rows());
- StringAppendF(&matlab_script,
- "lsqp.num_cols = %d;\n", A->num_cols());
+ StringAppendF(&matlab_script, "lsqp.num_rows = %d;\n", A->num_rows());
+ StringAppendF(&matlab_script, "lsqp.num_cols = %d;\n", A->num_cols());
{
string filename = filename_base + "_A.txt";
@@ -670,8 +664,8 @@ bool DumpLinearLeastSquaresProblemToTextFile(const string& filename_base,
CHECK(fptr != nullptr);
A->ToTextFile(fptr);
fclose(fptr);
- StringAppendF(&matlab_script,
- "tmp = load('%s', '-ascii');\n", filename.c_str());
+ StringAppendF(
+ &matlab_script, "tmp = load('%s', '-ascii');\n", filename.c_str());
StringAppendF(
&matlab_script,
"lsqp.A = sparse(tmp(:, 1) + 1, tmp(:, 2) + 1, tmp(:, 3), %d, %d);\n",
@@ -679,26 +673,25 @@ bool DumpLinearLeastSquaresProblemToTextFile(const string& filename_base,
A->num_cols());
}
-
if (D != NULL) {
string filename = filename_base + "_D.txt";
WriteArrayToFileOrDie(filename, D, A->num_cols());
- StringAppendF(&matlab_script,
- "lsqp.D = load('%s', '-ascii');\n", filename.c_str());
+ StringAppendF(
+ &matlab_script, "lsqp.D = load('%s', '-ascii');\n", filename.c_str());
}
if (b != NULL) {
string filename = filename_base + "_b.txt";
WriteArrayToFileOrDie(filename, b, A->num_rows());
- StringAppendF(&matlab_script,
- "lsqp.b = load('%s', '-ascii');\n", filename.c_str());
+ StringAppendF(
+ &matlab_script, "lsqp.b = load('%s', '-ascii');\n", filename.c_str());
}
if (x != NULL) {
string filename = filename_base + "_x.txt";
WriteArrayToFileOrDie(filename, x, A->num_cols());
- StringAppendF(&matlab_script,
- "lsqp.x = load('%s', '-ascii');\n", filename.c_str());
+ StringAppendF(
+ &matlab_script, "lsqp.x = load('%s', '-ascii');\n", filename.c_str());
}
string matlab_filename = filename_base + ".m";
@@ -716,12 +709,11 @@ bool DumpLinearLeastSquaresProblem(const string& filename_base,
int num_eliminate_blocks) {
switch (dump_format_type) {
case CONSOLE:
- return DumpLinearLeastSquaresProblemToConsole(A, D, b, x,
- num_eliminate_blocks);
+ return DumpLinearLeastSquaresProblemToConsole(
+ A, D, b, x, num_eliminate_blocks);
case TEXTFILE:
- return DumpLinearLeastSquaresProblemToTextFile(filename_base,
- A, D, b, x,
- num_eliminate_blocks);
+ return DumpLinearLeastSquaresProblemToTextFile(
+ filename_base, A, D, b, x, num_eliminate_blocks);
default:
LOG(FATAL) << "Unknown DumpFormatType " << dump_format_type;
}