Skip to content
This repository was archived by the owner on Aug 6, 2023. It is now read-only.

Commit 2a328fe

Browse files
committed
Ell is now a template class
1 parent f26c373 commit 2a328fe

File tree

7 files changed

+13
-17
lines changed

7 files changed

+13
-17
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ option(INSTALL_ONLY "Enable for installation only" OFF)
1212
# Note: update this to your new project's name and version
1313
project(
1414
LmiSolver
15-
VERSION 1.3.2
15+
VERSION 1.3.3
1616
LANGUAGES CXX
1717
)
1818

bench/BM_lmi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void LMI_Lazy(benchmark::State &state) {
9999

100100
while (state.KeepRunning()) {
101101
auto P = my_oracle<LmiOracle<Arr>>(F1, B1, F2, B2, Arr{1.0, -1.0, 1.0});
102-
auto E = Ell(10.0, Arr{0.0, 0.0, 0.0});
102+
auto E = Ell<Arr>(10.0, Arr{0.0, 0.0, 0.0});
103103
auto t = 1e100; // std::numeric_limits<double>::max()
104104
[[maybe_unused]] const auto rslt = cutting_plane_optim(P, E, t);
105105
}
@@ -131,7 +131,7 @@ static void LMI_old(benchmark::State &state) {
131131

132132
while (state.KeepRunning()) {
133133
auto P = my_oracle<LmiOldOracle<Arr>>(F1, B1, F2, B2, Arr{1.0, -1.0, 1.0});
134-
auto E = Ell(10.0, Arr{0.0, 0.0, 0.0});
134+
auto E = Ell<Arr>(10.0, Arr{0.0, 0.0, 0.0});
135135
auto t = 1e100; // std::numeric_limits<double>::max()
136136
[[maybe_unused]] const auto rslt = cutting_plane_optim(P, E, t);
137137
}
@@ -159,7 +159,7 @@ static void LMI_No_Trick(benchmark::State &state) {
159159

160160
while (state.KeepRunning()) {
161161
auto P = my_oracle<LmiOracle<Arr>>(F1, B1, F2, B2, Arr{1.0, -1.0, 1.0});
162-
auto E = Ell(10.0, Arr{0.0, 0.0, 0.0});
162+
auto E = Ell<Arr>(10.0, Arr{0.0, 0.0, 0.0});
163163
E.no_defer_trick = true;
164164
auto t = 1e100; // std::numeric_limits<double>::max()
165165
[[maybe_unused]] const auto rslt = cutting_plane_optim(P, E, t);

include/lmisolver/ldlt_ext.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#pragma once
33

44
#include <cstddef> // for size_t
5-
#include <utility> // for pair
65
#include <ellalgo/ell_matrix.hpp>
6+
#include <utility> // for pair
77

88
/**
99
* @brief LDLT factorization for LMI

source/ldlt_ext.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include <lmisolver/ldlt_ext.hpp>
55

66
template <typename Arr036>
7-
ldlt_ext<Arr036>::ldlt_ext(size_t N)
8-
: witness_vec(0.0, N), _n{N}, T{N} {
9-
}
7+
ldlt_ext<Arr036>::ldlt_ext(size_t N) : witness_vec(0.0, N), _n{N}, T{N} {}
108

119
/**
1210
* @brief witness that certifies $A$ is not
@@ -38,8 +36,7 @@ template <typename Arr036> auto ldlt_ext<Arr036>::witness() -> double {
3836
* @return double
3937
*/
4038
template <typename Arr036>
41-
auto ldlt_ext<Arr036>::sym_quad(const Arr036 &A) const
42-
-> double {
39+
auto ldlt_ext<Arr036>::sym_quad(const Arr036 &A) const -> double {
4340
auto res = double{};
4441
const auto &v = this->witness_vec;
4542
// const auto& [start, stop] = this->p;
@@ -67,8 +64,7 @@ using Arr = xt::xarray<double, xt::layout_type::row_major>;
6764
*
6865
* @return typename ldlt_ext<Arr036>::Mat
6966
*/
70-
template <typename Arr036>
71-
auto ldlt_ext<Arr036>::sqrt() -> Arr036 {
67+
template <typename Arr036> auto ldlt_ext<Arr036>::sqrt() -> Arr036 {
7268
assert(this->is_spd());
7369

7470
Arr036 M = xt::zeros<double>({this->_n, this->_n});

specific.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ endif(xtensor_ADDED)
1919

2020
CPMAddPackage(
2121
NAME EllAlgo
22-
GIT_TAG 1.3.3
22+
GIT_TAG 1.3.4
2323
GITHUB_REPOSITORY luk036/ellalgo-cpp
2424
OPTIONS "INSTALL_ONLY YES" # create an installable target
2525
)

test/source/test_lmi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ TEST_CASE("LMI test (stable)") {
103103
auto B2 = Arr{{14.0, 9.0, 40.0}, {9.0, 91.0, 10.0}, {40.0, 10.0, 15.0}};
104104

105105
auto P = my_oracle(F1, B1, F2, B2, std::move(c));
106-
auto E = Ell(10.0, Arr{0.0, 0.0, 0.0});
106+
auto E = Ell<Arr>(10.0, Arr{0.0, 0.0, 0.0});
107107

108108
auto t = 1e100; // std::numeric_limits<double>::max()
109109
const auto [x, ell_info] = cutting_plane_optim(P, E, t);
@@ -139,7 +139,7 @@ TEST_CASE("LMI test ") {
139139
auto B2 = Arr{{14.0, 9.0, 40.0}, {9.0, 91.0, 10.0}, {40.0, 10.0, 15.0}};
140140

141141
auto P = my_oracle(F1, B1, F2, B2, std::move(c));
142-
auto E = EllStable(10.0, Arr{0.0, 0.0, 0.0});
142+
auto E = EllStable<Arr>(10.0, Arr{0.0, 0.0, 0.0});
143143

144144
auto t = 1e100; // std::numeric_limits<double>::max()
145145
const auto [x, ell_info] = cutting_plane_optim(P, E, t);

test/source/test_lmi_old.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ TEST_CASE("LMI (old) test") {
102102
auto B2 = Arr{{14.0, 9.0, 40.0}, {9.0, 91.0, 10.0}, {40.0, 10.0, 15.0}};
103103
auto c = Arr{1.0, -1.0, 1.0};
104104
auto P = my_old_oracle(F1, std::move(B1), F2, std::move(B2), std::move(c));
105-
auto E = Ell(10.0, Arr{0.0, 0.0, 0.0});
105+
auto E = Ell<Arr>(10.0, Arr{0.0, 0.0, 0.0});
106106
auto t = 1e100; // std::numeric_limits<double>::max()
107107
const auto [x, ell_info] = cutting_plane_optim(P, E, t);
108108

@@ -127,7 +127,7 @@ TEST_CASE("LMI (old) test (stable)") {
127127
auto B2 = Arr{{14.0, 9.0, 40.0}, {9.0, 91.0, 10.0}, {40.0, 10.0, 15.0}};
128128
auto c = Arr{1.0, -1.0, 1.0};
129129
auto P = my_old_oracle(F1, std::move(B1), F2, std::move(B2), std::move(c));
130-
auto E = EllStable(10.0, Arr{0.0, 0.0, 0.0});
130+
auto E = EllStable<Arr>(10.0, Arr{0.0, 0.0, 0.0});
131131
auto t = 1e100; // std::numeric_limits<double>::max()
132132
const auto [x, ell_info] = cutting_plane_optim(P, E, t);
133133

0 commit comments

Comments
 (0)