|
Packit |
ea1746 |
// Ceres Solver - A fast non-linear least squares minimizer
|
|
Packit |
ea1746 |
// Copyright 2015 Google Inc. All rights reserved.
|
|
Packit |
ea1746 |
// http://ceres-solver.org/
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// Redistribution and use in source and binary forms, with or without
|
|
Packit |
ea1746 |
// modification, are permitted provided that the following conditions are met:
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
ea1746 |
// this list of conditions and the following disclaimer.
|
|
Packit |
ea1746 |
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
ea1746 |
// this list of conditions and the following disclaimer in the documentation
|
|
Packit |
ea1746 |
// and/or other materials provided with the distribution.
|
|
Packit |
ea1746 |
// * Neither the name of Google Inc. nor the names of its contributors may be
|
|
Packit |
ea1746 |
// used to endorse or promote products derived from this software without
|
|
Packit |
ea1746 |
// specific prior written permission.
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
ea1746 |
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
ea1746 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
ea1746 |
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
Packit |
ea1746 |
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
Packit |
ea1746 |
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
Packit |
ea1746 |
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
Packit |
ea1746 |
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
Packit |
ea1746 |
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
Packit |
ea1746 |
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
Packit |
ea1746 |
// POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// Author: sameeragarwal@google.com (Sameer Agarwal)
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
#include <algorithm>
|
|
Packit |
ea1746 |
#include <cctype>
|
|
Packit |
ea1746 |
#include <string>
|
|
Packit |
ea1746 |
#include "ceres/types.h"
|
|
Packit |
ea1746 |
#include "glog/logging.h"
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
namespace ceres {
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
using std::string;
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
#define CASESTR(x) case x: return #x
|
|
Packit |
ea1746 |
#define STRENUM(x) if (value == #x) { *type = x; return true;}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
static void UpperCase(string* input) {
|
|
Packit |
ea1746 |
std::transform(input->begin(), input->end(), input->begin(), ::toupper);
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* LinearSolverTypeToString(LinearSolverType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(DENSE_NORMAL_CHOLESKY);
|
|
Packit |
ea1746 |
CASESTR(DENSE_QR);
|
|
Packit |
ea1746 |
CASESTR(SPARSE_NORMAL_CHOLESKY);
|
|
Packit |
ea1746 |
CASESTR(DENSE_SCHUR);
|
|
Packit |
ea1746 |
CASESTR(SPARSE_SCHUR);
|
|
Packit |
ea1746 |
CASESTR(ITERATIVE_SCHUR);
|
|
Packit |
ea1746 |
CASESTR(CGNR);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToLinearSolverType(string value, LinearSolverType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(DENSE_NORMAL_CHOLESKY);
|
|
Packit |
ea1746 |
STRENUM(DENSE_QR);
|
|
Packit |
ea1746 |
STRENUM(SPARSE_NORMAL_CHOLESKY);
|
|
Packit |
ea1746 |
STRENUM(DENSE_SCHUR);
|
|
Packit |
ea1746 |
STRENUM(SPARSE_SCHUR);
|
|
Packit |
ea1746 |
STRENUM(ITERATIVE_SCHUR);
|
|
Packit |
ea1746 |
STRENUM(CGNR);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* PreconditionerTypeToString(PreconditionerType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(IDENTITY);
|
|
Packit |
ea1746 |
CASESTR(JACOBI);
|
|
Packit |
ea1746 |
CASESTR(SCHUR_JACOBI);
|
|
Packit |
ea1746 |
CASESTR(CLUSTER_JACOBI);
|
|
Packit |
ea1746 |
CASESTR(CLUSTER_TRIDIAGONAL);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToPreconditionerType(string value, PreconditionerType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(IDENTITY);
|
|
Packit |
ea1746 |
STRENUM(JACOBI);
|
|
Packit |
ea1746 |
STRENUM(SCHUR_JACOBI);
|
|
Packit |
ea1746 |
STRENUM(CLUSTER_JACOBI);
|
|
Packit |
ea1746 |
STRENUM(CLUSTER_TRIDIAGONAL);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* SparseLinearAlgebraLibraryTypeToString(
|
|
Packit |
ea1746 |
SparseLinearAlgebraLibraryType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(SUITE_SPARSE);
|
|
Packit |
ea1746 |
CASESTR(CX_SPARSE);
|
|
Packit |
ea1746 |
CASESTR(EIGEN_SPARSE);
|
|
Packit |
ea1746 |
CASESTR(NO_SPARSE);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToSparseLinearAlgebraLibraryType(
|
|
Packit |
ea1746 |
string value,
|
|
Packit |
ea1746 |
SparseLinearAlgebraLibraryType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(SUITE_SPARSE);
|
|
Packit |
ea1746 |
STRENUM(CX_SPARSE);
|
|
Packit |
ea1746 |
STRENUM(EIGEN_SPARSE);
|
|
Packit |
ea1746 |
STRENUM(NO_SPARSE);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* DenseLinearAlgebraLibraryTypeToString(
|
|
Packit |
ea1746 |
DenseLinearAlgebraLibraryType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(EIGEN);
|
|
Packit |
ea1746 |
CASESTR(LAPACK);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToDenseLinearAlgebraLibraryType(
|
|
Packit |
ea1746 |
string value,
|
|
Packit |
ea1746 |
DenseLinearAlgebraLibraryType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(EIGEN);
|
|
Packit |
ea1746 |
STRENUM(LAPACK);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* TrustRegionStrategyTypeToString(TrustRegionStrategyType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(LEVENBERG_MARQUARDT);
|
|
Packit |
ea1746 |
CASESTR(DOGLEG);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToTrustRegionStrategyType(string value,
|
|
Packit |
ea1746 |
TrustRegionStrategyType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(LEVENBERG_MARQUARDT);
|
|
Packit |
ea1746 |
STRENUM(DOGLEG);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* DoglegTypeToString(DoglegType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(TRADITIONAL_DOGLEG);
|
|
Packit |
ea1746 |
CASESTR(SUBSPACE_DOGLEG);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToDoglegType(string value, DoglegType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(TRADITIONAL_DOGLEG);
|
|
Packit |
ea1746 |
STRENUM(SUBSPACE_DOGLEG);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* MinimizerTypeToString(MinimizerType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(TRUST_REGION);
|
|
Packit |
ea1746 |
CASESTR(LINE_SEARCH);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToMinimizerType(string value, MinimizerType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(TRUST_REGION);
|
|
Packit |
ea1746 |
STRENUM(LINE_SEARCH);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* LineSearchDirectionTypeToString(LineSearchDirectionType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(STEEPEST_DESCENT);
|
|
Packit |
ea1746 |
CASESTR(NONLINEAR_CONJUGATE_GRADIENT);
|
|
Packit |
ea1746 |
CASESTR(LBFGS);
|
|
Packit |
ea1746 |
CASESTR(BFGS);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToLineSearchDirectionType(string value,
|
|
Packit |
ea1746 |
LineSearchDirectionType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(STEEPEST_DESCENT);
|
|
Packit |
ea1746 |
STRENUM(NONLINEAR_CONJUGATE_GRADIENT);
|
|
Packit |
ea1746 |
STRENUM(LBFGS);
|
|
Packit |
ea1746 |
STRENUM(BFGS);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* LineSearchTypeToString(LineSearchType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(ARMIJO);
|
|
Packit |
ea1746 |
CASESTR(WOLFE);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToLineSearchType(string value, LineSearchType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(ARMIJO);
|
|
Packit |
ea1746 |
STRENUM(WOLFE);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* LineSearchInterpolationTypeToString(
|
|
Packit |
ea1746 |
LineSearchInterpolationType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(BISECTION);
|
|
Packit |
ea1746 |
CASESTR(QUADRATIC);
|
|
Packit |
ea1746 |
CASESTR(CUBIC);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToLineSearchInterpolationType(
|
|
Packit |
ea1746 |
string value,
|
|
Packit |
ea1746 |
LineSearchInterpolationType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(BISECTION);
|
|
Packit |
ea1746 |
STRENUM(QUADRATIC);
|
|
Packit |
ea1746 |
STRENUM(CUBIC);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* NonlinearConjugateGradientTypeToString(
|
|
Packit |
ea1746 |
NonlinearConjugateGradientType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(FLETCHER_REEVES);
|
|
Packit |
ea1746 |
CASESTR(POLAK_RIBIERE);
|
|
Packit |
ea1746 |
CASESTR(HESTENES_STIEFEL);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToNonlinearConjugateGradientType(
|
|
Packit |
ea1746 |
string value,
|
|
Packit |
ea1746 |
NonlinearConjugateGradientType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(FLETCHER_REEVES);
|
|
Packit |
ea1746 |
STRENUM(POLAK_RIBIERE);
|
|
Packit |
ea1746 |
STRENUM(HESTENES_STIEFEL);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* CovarianceAlgorithmTypeToString(
|
|
Packit |
ea1746 |
CovarianceAlgorithmType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(DENSE_SVD);
|
|
Packit |
ea1746 |
CASESTR(SPARSE_QR);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToCovarianceAlgorithmType(
|
|
Packit |
ea1746 |
string value,
|
|
Packit |
ea1746 |
CovarianceAlgorithmType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(DENSE_SVD);
|
|
Packit |
ea1746 |
STRENUM(SPARSE_QR);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* NumericDiffMethodTypeToString(
|
|
Packit |
ea1746 |
NumericDiffMethodType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(CENTRAL);
|
|
Packit |
ea1746 |
CASESTR(FORWARD);
|
|
Packit |
ea1746 |
CASESTR(RIDDERS);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToNumericDiffMethodType(
|
|
Packit |
ea1746 |
string value,
|
|
Packit |
ea1746 |
NumericDiffMethodType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(CENTRAL);
|
|
Packit |
ea1746 |
STRENUM(FORWARD);
|
|
Packit |
ea1746 |
STRENUM(RIDDERS);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* VisibilityClusteringTypeToString(
|
|
Packit |
ea1746 |
VisibilityClusteringType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(CANONICAL_VIEWS);
|
|
Packit |
ea1746 |
CASESTR(SINGLE_LINKAGE);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool StringToVisibilityClusteringType(
|
|
Packit |
ea1746 |
string value,
|
|
Packit |
ea1746 |
VisibilityClusteringType* type) {
|
|
Packit |
ea1746 |
UpperCase(&value);
|
|
Packit |
ea1746 |
STRENUM(CANONICAL_VIEWS);
|
|
Packit |
ea1746 |
STRENUM(SINGLE_LINKAGE);
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
const char* TerminationTypeToString(TerminationType type) {
|
|
Packit |
ea1746 |
switch (type) {
|
|
Packit |
ea1746 |
CASESTR(CONVERGENCE);
|
|
Packit |
ea1746 |
CASESTR(NO_CONVERGENCE);
|
|
Packit |
ea1746 |
CASESTR(FAILURE);
|
|
Packit |
ea1746 |
CASESTR(USER_SUCCESS);
|
|
Packit |
ea1746 |
CASESTR(USER_FAILURE);
|
|
Packit |
ea1746 |
default:
|
|
Packit |
ea1746 |
return "UNKNOWN";
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
#undef CASESTR
|
|
Packit |
ea1746 |
#undef STRENUM
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool IsSchurType(LinearSolverType type) {
|
|
Packit |
ea1746 |
return ((type == SPARSE_SCHUR) ||
|
|
Packit |
ea1746 |
(type == DENSE_SCHUR) ||
|
|
Packit |
ea1746 |
(type == ITERATIVE_SCHUR));
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool IsSparseLinearAlgebraLibraryTypeAvailable(
|
|
Packit |
ea1746 |
SparseLinearAlgebraLibraryType type) {
|
|
Packit |
ea1746 |
if (type == SUITE_SPARSE) {
|
|
Packit |
ea1746 |
#ifdef CERES_NO_SUITESPARSE
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
#else
|
|
Packit |
ea1746 |
return true;
|
|
Packit |
ea1746 |
#endif
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
if (type == CX_SPARSE) {
|
|
Packit |
ea1746 |
#ifdef CERES_NO_CXSPARSE
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
#else
|
|
Packit |
ea1746 |
return true;
|
|
Packit |
ea1746 |
#endif
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
if (type == EIGEN_SPARSE) {
|
|
Packit |
ea1746 |
#ifdef CERES_USE_EIGEN_SPARSE
|
|
Packit |
ea1746 |
return true;
|
|
Packit |
ea1746 |
#else
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
#endif
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
LOG(WARNING) << "Unknown sparse linear algebra library " << type;
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
bool IsDenseLinearAlgebraLibraryTypeAvailable(
|
|
Packit |
ea1746 |
DenseLinearAlgebraLibraryType type) {
|
|
Packit |
ea1746 |
if (type == EIGEN) {
|
|
Packit |
ea1746 |
return true;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
if (type == LAPACK) {
|
|
Packit |
ea1746 |
#ifdef CERES_NO_LAPACK
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
#else
|
|
Packit |
ea1746 |
return true;
|
|
Packit |
ea1746 |
#endif
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
LOG(WARNING) << "Unknown dense linear algebra library " << type;
|
|
Packit |
ea1746 |
return false;
|
|
Packit |
ea1746 |
}
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
} // namespace ceres
|