Skip to content

Commit 542025a

Browse files
committed
Moved solver out of header
1 parent bdc6fb3 commit 542025a

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

src/optimization/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
add_library(MetricOptimizationLib
22
area.cpp
33
constraint.cpp
4+
common.cpp
45
cone_metric.cpp
56
convergence.cpp
67
embedding.cpp

src/optimization/common.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "common.hh"
2+
3+
#ifdef USE_SUITESPARSE
4+
#include <Eigen/CholmodSupport>
5+
#endif
6+
7+
namespace CurvatureMetric {
8+
9+
10+
VectorX solve_psd_system(const MatrixX& A, const VectorX&b)
11+
{
12+
#ifdef USE_SUITESPARSE
13+
Eigen::CholmodSupernodalLLT<MatrixX> solver;
14+
#else
15+
Eigen::SimplicialLDLT<MatrixX> solver;
16+
#endif
17+
18+
solver.compute(A);
19+
return solver.solve(b);
20+
}
21+
22+
}

src/optimization/common.hh

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
#include "spdlog/sinks/basic_file_sink.h"
1818
#include "spdlog/sinks/ostream_sink.h"
1919

20-
#ifdef USE_SUITESPARSE
21-
#include <Eigen/CholmodSupport>
22-
#endif
23-
2420
namespace CurvatureMetric {
2521

2622
/// *************************
@@ -406,17 +402,7 @@ compute_condition_number(
406402
return sigma_1 / sigma_n;
407403
}
408404

409-
inline VectorX solve_psd_system(const MatrixX& A, const VectorX&b)
410-
{
411-
#ifdef USE_SUITESPARSE
412-
Eigen::CholmodSupernodalLLT<MatrixX> solver;
413-
#else
414-
Eigen::SimplicialLDLT<MatrixX> solver;
415-
#endif
416-
417-
solver.compute(A);
418-
return solver.solve(b);
419-
}
405+
VectorX solve_psd_system(const MatrixX& A, const VectorX&b);
420406

421407
/// ********************
422408
/// Data Type Conversion

0 commit comments

Comments
 (0)