Skip to content

Commit f82cf29

Browse files
committed
[iss-108]
2 parents 4089aef + 1d70c13 commit f82cf29

13 files changed

Lines changed: 59 additions & 2525 deletions

sbg/multidim_inter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ bool MultiDimInter::operator>(const MultiDimInter& other) const
9898
return !(*this == other && *this < other);
9999
}
100100

101-
102101
std::ostream &operator<<(std::ostream &out, const MultiDimInter &mdi)
103102
{
104103
std::size_t sz = mdi.arity();

sbg/ord_pwmap.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ OrdPWMap::OrdPWMap(const Map& m) : pieces_() {
5656
}
5757
OrdPWMap::OrdPWMap(const OrdMapCollection& pieces)
5858
: pieces_(std::move(pieces)) {}
59-
OrdPWMap::OrdPWMap(const OrdPWMap& pw) : pieces_(pw.pieces_) {}
6059

6160
member_imp(OrdPWMap::Iterator, OrdPWMap::OrdMapCollection::const_iterator, it);
6261

@@ -102,11 +101,13 @@ bool OrdPWMap::operator==(const PWMapStrategy& other) const
102101
{
103102
OrdPWMapCRef othr = static_cast<OrdPWMapCRef>(other);
104103

105-
if (dom() != othr.dom())
104+
if (dom() != othr.dom()) {
106105
return false;
106+
}
107107

108-
if (pieces_ == othr.pieces_)
108+
if (pieces_ == othr.pieces_) {
109109
return true;
110+
}
110111

111112
OrdMapCollection short_pw = pieces_;
112113
OrdMapCollection long_pw = othr.pieces_;
@@ -225,7 +226,7 @@ void OrdPWMap::processAdd(const Map& m1, const Map& m2,
225226

226227
PWMapStratPtr OrdPWMap::clone() const
227228
{
228-
return std::make_unique<OrdPWMap>(*this);
229+
return std::make_unique<OrdPWMap>(pieces_);
229230
}
230231

231232
// PWMap functions -------------------------------------------------------------
@@ -418,11 +419,11 @@ PWMapStratPtr OrdPWMap::concatenation(const PWMapStrategy& other) const
418419
res.reserve(pieces_.size() + othr.pieces_.size());
419420

420421
if (isEmpty()) {
421-
return std::make_unique<OrdPWMap>(othr);
422+
return std::make_unique<OrdPWMap>(othr.pieces_);
422423
}
423424

424425
if (other.isEmpty()) {
425-
return std::make_unique<OrdPWMap>(*this);
426+
return std::make_unique<OrdPWMap>(pieces_);
426427
}
427428

428429
if (pieces_.back().second.first < othr.pieces_.front().second.first) {
@@ -600,7 +601,6 @@ PWMapStratPtr OrdPWMap::firstInv(const Set& subdom) const
600601
}
601602

602603
std::sort(res.begin(), res.end(), operator<);
603-
604604
return std::make_unique<OrdPWMap>(std::move(res));
605605
}
606606

@@ -724,8 +724,10 @@ void OrdPWMap::processMapsOrd(
724724
++si_prev;
725725
++si_curr;
726726
}
727-
if (indexes.empty())
727+
728+
if (indexes.empty()) {
728729
break;
730+
}
729731
}
730732
}
731733

@@ -765,8 +767,8 @@ PWMapStratPtr OrdPWMap::offsetDom(const PWMapStrategy& off) const
765767
Set ith_dom = off.image(t_m.dom());
766768

767769
if (!ith_dom.isEmpty()){
768-
Map res_map(ith_dom, t_m.exp());
769-
Internal::emplaceBack(res, res_map);
770+
Map res_map(ith_dom, t_m.exp());
771+
Internal::emplaceBack(res, res_map);
770772
}
771773
continue;
772774
}

sbg/ord_pwmap.hpp

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class OrdPWMap : public PWMapStrategy {
4848
OrdPWMap(const Set& s);
4949
OrdPWMap(const Map& m);
5050
OrdPWMap(const OrdMapCollection& pieces);
51-
OrdPWMap(const OrdPWMap& pw);
5251

5352
class Iterator : public PWMapStrategy::Iterator {
5453
member_class(OrdMapCollection::const_iterator, it);
@@ -119,56 +118,56 @@ class OrdPWMap : public PWMapStrategy {
119118
* @brief Calculates the minAdjMap core, which contains the entire main process of the function.
120119
*/
121120
void processMinAdjMap(
122-
const Map& m1,
123-
const Map& m2,
124-
Set& set_in,
125-
Set& set_out,
126-
OrdMapCollection& ord_pwmap,
127-
NAT& global_pos) const;
121+
const Map& m1,
122+
const Map& m2,
123+
Set& set_in,
124+
Set& set_out,
125+
OrdMapCollection& ord_pwmap,
126+
NAT& global_pos) const;
128127

129128
/**
130129
* @brief Calculates the minus core, which contains the entire main process of the function.
131130
*/
132131
void processMinus(
133-
const Map& m1,
134-
const Map& m2,
135-
Set& set_in,
136-
Set& set_out,
137-
OrdMapCollection& ord_pwmap,
138-
NAT& global_pos) const;
132+
const Map& m1,
133+
const Map& m2,
134+
Set& set_in,
135+
Set& set_out,
136+
OrdMapCollection& ord_pwmap,
137+
NAT& global_pos) const;
139138

140139
/**
141140
* @brief Calculates the add core, which contains the entire main process of the function.
142141
*/
143142
void processAdd(
144-
const Map& m1,
145-
const Map& m2,
146-
Set& set_in,
147-
Set& set_out,
148-
OrdMapCollection& ord_pwmap,
149-
NAT& global_pos) const;
143+
const Map& m1,
144+
const Map& m2,
145+
Set& set_in,
146+
Set& set_out,
147+
OrdMapCollection& ord_pwmap,
148+
NAT& global_pos) const;
150149

151150
/**
152151
* @brief Calculates the equalImage core, which contains the entire main process of the function.
153152
*/
154153
void processEqualImage(
155-
const Map& m1,
156-
const Map& m2,
157-
Set& set_in,
158-
Set& set_out,
159-
OrdMapCollection& ord_pwmap,
160-
NAT& global_pos) const;
154+
const Map& m1,
155+
const Map& m2,
156+
Set& set_in,
157+
Set& set_out,
158+
OrdMapCollection& ord_pwmap,
159+
NAT& global_pos) const;
161160

162161
/**
163162
* @brief Calculates the lessImage core, which contains the entire main process of the function.
164163
*/
165164
void processLessImage(
166-
const Map& m1,
167-
const Map& m2,
168-
Set& set_in,
169-
Set& set_out,
170-
OrdMapCollection& ord_pwmap,
171-
NAT& global_pos) const;
165+
const Map& m1,
166+
const Map& m2,
167+
Set& set_in,
168+
Set& set_out,
169+
OrdMapCollection& ord_pwmap,
170+
NAT& global_pos) const;
172171

173172
/**
174173
* @brief Type used in the 'processMapsOrd' declaration to reduce its size.

sbg/ord_set.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ SetStratPtr OrderedSet::intersection(const SetStrategy& other) const
355355
if (long_max < short_min)
356356
break;
357357

358-
if (doInt(short_elem,long_elem)) {
358+
if (doInt(short_elem, long_elem)) {
359359
const SetPiece inter = long_elem.intersection(short_elem);
360360
result.emplaceHint(global_pos, inter);
361361
}

sbg/ord_unidim_dense_set.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ unsigned int OrdUnidimDenseSet::cardinal() const
191191
{
192192
unsigned int result = 0;
193193

194-
for (const SetPiece& mdi : pieces_)
194+
for (const SetPiece& mdi : pieces_) {
195195
result += mdi.cardinal();
196+
}
196197

197198
return result;
198199
}

sbg/pwmap_fact.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
1818
******************************************************************************/
1919

20-
#include "sbg/pwmap_fact.hpp"
2120
#include "sbg/dom_ord_pwmap.hpp"
21+
#include "sbg/pwmap_fact.hpp"
2222
#include "sbg/ord_pwmap.hpp"
2323
#include "sbg/unord_pwmap.hpp"
2424

sbg/unord_pwmap.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ Set UnordPWMap::preImage(const Set& subcodom) const
224224
{
225225
Set res = SET_FACT.createSet();
226226

227-
for (const Map& m : pieces_)
227+
for (const Map& m : pieces_) {
228228
res = res.disjointCup(m.preImage(subcodom));
229+
}
229230

230231
return res;
231232
}
@@ -234,8 +235,9 @@ PWMapStratPtr UnordPWMap::inverse() const
234235
{
235236
PWMapStratPtr res = std::make_unique<UnordPWMap>();
236237

237-
for (const Map& m : pieces_)
238+
for (const Map& m : pieces_) {
238239
res->emplaceBack(m.minInv());
240+
}
239241

240242
return res;
241243
}
@@ -285,8 +287,9 @@ Set UnordPWMap::fixedPoints() const
285287
{
286288
Set res = SET_FACT.createSet();
287289

288-
for (const Map& m : pieces_)
290+
for (const Map& m : pieces_) {
289291
res = res.disjointCup(m.fixedPoints());
292+
}
290293

291294
return res;
292295
}
@@ -471,8 +474,9 @@ PWMapStratPtr UnordPWMap::offsetDom(const MD_NAT& off) const
471474
{
472475
UnordMapCollection res;
473476

474-
for (const Map& m : pieces_)
477+
for (const Map& m : pieces_) {
475478
pushBack(res, Map(m.dom().offset(off), m.exp()));
479+
}
476480

477481
return std::make_unique<UnordPWMap>(res);
478482
}
@@ -510,8 +514,9 @@ PWMapStratPtr UnordPWMap::offsetImage(const Exp& off) const
510514
{
511515
UnordMapCollection res;
512516

513-
for (const Map& m : pieces_)
517+
for (const Map& m : pieces_) {
514518
pushBack(res, Map(m.dom(), off + m.exp()));
519+
}
515520

516521
return std::make_unique<UnordPWMap>(res);
517522
}

sbg/unord_set.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ unsigned int UnorderedSet::cardinal() const
158158
{
159159
unsigned int result = 0;
160160

161-
for (const SetPiece& mdi : pieces_)
161+
for (const SetPiece& mdi : pieces_) {
162162
result += mdi.cardinal();
163+
}
163164

164165
return result;
165166
}

test/TestRL2.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ equation
2121
end TestRL2;
2222
*/
2323

24-
N = 10000;
24+
N = 1000000;
2525

2626
F1 = N;
2727
F2 = N-1+F1;

test/performance/CMakeLists.txt

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
1-
# Add executable
2-
add_executable(
3-
sbg-performance
4-
)
5-
6-
target_sources(
7-
sbg-performance
8-
PRIVATE
9-
main.cpp
10-
pw_map_perf.cpp
11-
set_perf.cpp
12-
)
13-
14-
target_compile_options(sbg-performance PRIVATE "-Wall")
15-
16-
# Link the library
17-
target_link_libraries(sbg-performance
18-
PRIVATE
19-
sbg-dev
20-
sbg-eval-lib
21-
${GOOGLE_TEST_LIB}
22-
${GOOGLE_MOCK_LIB}
23-
pthread
24-
)
25-
26-
target_include_directories(sbg-performance PRIVATE ${GOOGLE_TEST_INCLUDE} ${PROJECT_SOURCE_DIR})
27-
28-
target_link_directories(sbg-performance PRIVATE ${GOOGLE_TEST_INSTALL}/lib)
29-
30-
add_subdirectory(boost)
31-
32-
# Set output directory for executable
33-
set_target_properties(sbg-performance PROPERTIES
34-
RUNTIME_OUTPUT_DIRECTORY
35-
${BIN_DIR}
36-
)
37-
38-
add_custom_target(run-performance-test
39-
COMMAND echo "Running Performance Tests."
40-
COMMAND cd ${BIN_DIR} && ./sbg-performance
41-
)
42-
43-
add_dependencies(run-performance-test sbg-performance)
44-
451
# SBG Benchmark
462
add_executable(sbg-benchmark benchmark_main.cpp)
473

0 commit comments

Comments
 (0)