Skip to content

Commit 26335d2

Browse files
committed
Merge branch 'add-reversed' into 'master'
add sentinel See merge request correaa/boost-multi!1555
2 parents 1a48eb3 + 70e61ca commit 26335d2

14 files changed

Lines changed: 645 additions & 277 deletions

File tree

.gitlab-ci-correaa.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ vs2022-shell c++17:
405405
script:
406406
# - choco --version
407407
# - choco install -y visualstudio2019community poshgit
408-
- dir C:\local\
409408
- $env:Path += ";C:/vcpkg/installed/x64-windows/bin;${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin;C:\Program Files\CMake\bin;C:\Program Files\7-Zip;C:\local\boost_1_86_0\lib"
410409
# - git clone --depth=1 https://github.com/microsoft/vcpkg.git
411410
# - .\vcpkg\bootstrap-vcpkg.bat
@@ -445,7 +444,6 @@ vs2022-shell cudatk-17:
445444
interruptible: true
446445
script:
447446
- whoami
448-
- dir C:\local\
449447
- $env:Path += ";C:/vcpkg/installed/x64-windows/bin;${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin;C:\Program Files\CMake\bin;C:\Program Files\7-Zip;C:\local\boost_1_86_0\lib"
450448
# - git clone --depth=1 https://github.com/microsoft/vcpkg.git
451449
# - .\vcpkg\bootstrap-vcpkg.bat
@@ -467,7 +465,6 @@ vs2022-shell cudatk:
467465
interruptible: true
468466
script:
469467
- whoami
470-
- dir C:\local\
471468
- $env:Path += ";C:/vcpkg/installed/x64-windows/bin;${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin;C:\Program Files\CMake\bin;C:\Program Files\7-Zip;C:\local\boost_1_86_0\lib"
472469
# - git clone --depth=1 https://github.com/microsoft/vcpkg.git
473470
# - .\vcpkg\bootstrap-vcpkg.bat
@@ -491,7 +488,6 @@ vs2022-shell cuda:
491488
# - choco --version
492489
# - choco install -y visualstudio2019community poshgit
493490
- whoami
494-
- dir C:\local\
495491
- nvidia-smi
496492
- $env:Path += ";C:/vcpkg/installed/x64-windows/bin;${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin;C:\Program Files\CMake\bin;C:\Program Files\7-Zip;C:\local\boost_1_86_0\lib"
497493
# - git clone --depth=1 https://github.com/microsoft/vcpkg.git

include/boost/multi/adaptors/blas/copy.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,20 @@ struct copy_it {
4040
using iterator_category = std::output_iterator_tag;
4141
using iterator_type = copy_it;
4242

43+
explicit copy_it(It it) : it_{it} {}
44+
45+
copy_it() = default;
46+
copy_it(copy_it const&) = default;
47+
copy_it(copy_it&&) = default;
48+
auto operator=(copy_it const&) -> copy_it& = default;
49+
auto operator=(copy_it&&) -> copy_it& = default;
50+
~copy_it() = default;
51+
4352
friend auto operator-(copy_it const& c1, copy_it const& c2) { return c1.it_ - c2.it_; }
4453

54+
auto operator==(copy_it const& other) const -> bool { return it_ == other.it_; }
55+
auto operator!=(copy_it const& other) const -> bool { return it_ != other.it_; }
56+
4557
template<class It1DOut>
4658
friend constexpr auto copy_n(copy_it first, difference_type count, It1DOut result) -> It1DOut {
4759
return blas::copy_n(first.it_, count, result);
@@ -58,6 +70,12 @@ struct copy_it {
5870
return other.it_ - self.it_;
5971
}
6072
constexpr auto operator*() const -> value_type { return *it_; }
73+
74+
constexpr auto operator++() const -> copy_it&;
75+
constexpr auto operator--() const -> copy_it&;
76+
77+
constexpr auto operator++(int) const -> copy_it;
78+
constexpr auto operator--(int) const -> copy_it;
6179
};
6280

6381
template<class A1D> [[nodiscard]]

include/boost/multi/adaptors/blas/gemm.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,25 +197,30 @@ class gemm_iterator {
197197
friend class gemm_range;
198198

199199
public:
200+
gemm_iterator() = default;
200201
gemm_iterator(gemm_iterator const&) = default;
201202
gemm_iterator(gemm_iterator&&) noexcept = default;
202203
~gemm_iterator() = default;
203204

204-
auto operator=(gemm_iterator&&) -> gemm_iterator& = delete;
205-
auto operator=(gemm_iterator const&) -> gemm_iterator& = delete;
205+
// auto operator=(gemm_iterator&&) noexcept -> gemm_iterator&; // = delete;
206+
auto operator=(gemm_iterator const&) -> gemm_iterator&; // = delete;
207+
auto operator=(gemm_iterator&&) noexcept -> gemm_iterator&;
206208

207209
using difference_type = typename std::iterator_traits<ItA>::difference_type;
208210
using value_type = typename std::iterator_traits<ItA>::value_type;
209211
using pointer = std::nullptr_t;
210212
using reference = gemm_reference<decltype((*b_begin_).extensions())>;
211213
using iterator_category = std::random_access_iterator_tag;
212214

213-
auto operator+=(difference_type n) -> gemm_iterator& {a_it_ += n; return *this;}
214-
auto operator-=(difference_type n) -> gemm_iterator& {a_it_ -= n; return *this;}
215+
auto operator+=(difference_type n) -> gemm_iterator& { a_it_ += n; return *this; }
216+
auto operator-=(difference_type n) -> gemm_iterator& { a_it_ -= n; return *this; }
215217

216218
auto operator++() -> gemm_iterator& { return operator+=(1); } // required by random access concept requires even if not used explicitly
217219
auto operator--() -> gemm_iterator& { return operator-=(1); }
218220

221+
auto operator++(int) -> gemm_iterator { gemm_iterator ret{*this}; ++(*this); return ret; } // required by random access concept requires even if not used explicitly
222+
auto operator--(int) -> gemm_iterator { gemm_iterator ret{*this}; --(*this); return ret; }
223+
219224
friend auto operator+(gemm_iterator ret, difference_type n) { return ret += n; }
220225

221226
friend auto operator-(gemm_iterator const& a, gemm_iterator const& b) -> difference_type { // NOLINT(readability-identifier-length) BLAS naming

include/boost/multi/adaptors/blas/gemv.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,33 @@ class gemv_iterator {
8484
using reference = void;
8585
using iterator_category = std::random_access_iterator_tag;
8686

87+
gemv_iterator() = default;
88+
89+
auto operator++() -> gemv_iterator& { ++m_it_; return *this; }
90+
auto operator++(int) -> gemv_iterator { gemv_iterator ret{*this}; ++(*this); return ret; }
91+
92+
friend auto operator==(gemv_iterator const& self, gemv_iterator const& other) -> difference_type {
93+
assert(self.v_first_ == other.v_first_);
94+
return self.m_it_ == other.m_it_;
95+
}
96+
97+
friend auto operator!=(gemv_iterator const& self, gemv_iterator const& other) -> difference_type {
98+
assert(self.v_first_ == other.v_first_);
99+
return self.m_it_ != other.m_it_;
100+
}
101+
87102
friend auto operator-(gemv_iterator const& self, gemv_iterator const& other) -> difference_type {
88103
assert(self.v_first_ == other.v_first_);
89104
return self.m_it_ - other.m_it_;
90105
}
106+
91107
template<class It1DOut>
92108
friend auto copy_n(gemv_iterator first, difference_type count, It1DOut result){
93109
if constexpr(std::is_same_v<Context, void>) {blas::gemv_n( static_cast<value_type>(first.alpha_), first.m_it_, count, first.v_first_, Scalar{0.0}, result);} // NOLINT(fuchsia-default-arguments-calls)
94110
else {blas::gemv_n(first.ctxt_, static_cast<value_type>(first.alpha_), first.m_it_, count, first.v_first_, Scalar{0.0}, result);} // NOLINT(fuchsia-default-arguments-calls)
95111
return result + count;
96112
}
113+
97114
template<class It1DOut>
98115
friend auto copy(gemv_iterator first, gemv_iterator last, It1DOut result){return copy_n(first, last - first, result);}
99116
template<class It1DOut>
@@ -107,6 +124,7 @@ class gemv_iterator {
107124
#endif
108125
return copy(first, last, result);
109126
}
127+
110128
gemv_iterator(Scalar alpha, It2D m_it, It1D v_first, Context ctxt)
111129
: alpha_{alpha}, m_it_{std::move(m_it)}, v_first_{std::move(v_first)}, ctxt_{ctxt} {}
112130
auto operator*() const { return value_type{0.0}; } // could be std::complex NOLINT(fuchsia-default-arguments-calls)

include/boost/multi/adaptors/blas/herk.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ class herk_range {
7373
// {}
7474

7575
struct iterator {
76-
herk_range const* self_;
77-
Size index_;
76+
herk_range const* self_; // NOLINT(misc-non-private-member-variables-in-classes) TODO(correaa) make private
77+
Size index_; // NOLINT(misc-non-private-member-variables-in-classes) TODO(correaa) make private
78+
79+
auto operator==(iterator const&) const -> bool;
80+
auto operator!=(iterator const&) const -> bool;
7881
};
7982

8083
// // using iterator = herk_iterator<ContextPtr, Scalar, ItA>;

include/boost/multi/adaptors/fft.hpp

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class dft_range {
8282
In in_; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
8383
Direction dir_;
8484

85-
struct const_iterator : private std::decay_t<In>::const_iterator {
85+
struct const_iterator : private std::decay_t<In>::const_iterator { // NOLINT(cppcoreguidelines-pro-type-member-init,hicpp-member-init)
8686
// static constexpr auto dimensionality = In::const_iterator::dimensionality;
8787

8888
private:
@@ -91,6 +91,7 @@ class dft_range {
9191
Direction dir_;
9292

9393
public:
94+
const_iterator() = default;
9495
const_iterator(
9596
typename std::decay_t<In>::const_iterator it,
9697
bool doo, std::array<bool, std::decay_t<In>::dimensionality - 1> sub_which,
@@ -108,20 +109,33 @@ class dft_range {
108109
return static_cast<typename std::decay_t<In>::const_iterator const&>(lhs) - static_cast<typename std::decay_t<In>::const_iterator const&>(rhs);
109110
}
110111

111-
auto operator*() const {
112-
class fake_array {
113-
multi::extensions_t<dimensionality - 1> extensions_;
114-
115-
public:
116-
explicit fake_array(multi::extensions_t<dimensionality - 1> ext) : extensions_{ext} {}
117-
auto extensions() const { return extensions_; }
118-
// multi::size_t size_;
119-
auto extension() const {
120-
using std::get;
121-
return get<0>(extensions());
122-
}
123-
auto size() const { return extension().size(); }
124-
} fa{(*static_cast<typename std::decay_t<In>::const_iterator const&>(*this)).extensions()};
112+
auto operator++() -> const_iterator&;
113+
auto operator--() -> const_iterator&;
114+
115+
auto operator++(int) -> const_iterator;
116+
auto operator--(int) -> const_iterator;
117+
118+
auto operator==(const_iterator const& other) const -> bool;
119+
auto operator!=(const_iterator const& other) const -> bool;
120+
121+
// auto operator*() const -> reference;
122+
123+
class fake_array {
124+
multi::extensions_t<dimensionality - 1> extensions_;
125+
126+
public:
127+
explicit fake_array(multi::extensions_t<dimensionality - 1> ext) : extensions_{ext} {}
128+
auto extensions() const { return extensions_; }
129+
// multi::size_t size_;
130+
auto extension() const {
131+
using std::get;
132+
return get<0>(extensions());
133+
}
134+
auto size() const { return extension().size(); }
135+
};
136+
137+
auto operator*() const -> fake_array {
138+
fake_array fa{(*static_cast<typename std::decay_t<In>::const_iterator const&>(*this)).extensions()};
125139
return fa;
126140
}
127141

include/boost/multi/adaptors/fftw/test/shift.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,24 @@ class n_random_complex { // NOLINT(cppcoreguidelines-special-member-functions,h
2020
mutable std::uniform_real_distribution<> dist_{-1.0, 1.0};
2121

2222
public:
23-
n_random_complex(n_random_complex const&) = delete;
24-
auto operator=(n_random_complex const&) -> n_random_complex& = delete;
23+
n_random_complex() = default;
24+
n_random_complex(n_random_complex const&); // = delete;
25+
auto operator=(n_random_complex const&) -> n_random_complex&; // = delete;
26+
27+
constexpr auto operator==(n_random_complex const&) const;
28+
constexpr auto operator!=(n_random_complex const&) const;
2529

2630
explicit n_random_complex(std::size_t n) : n_{n} {}
2731

28-
class iterator : public boost::multi::detail::random_access_iterator<iterator, std::complex<T>, std::complex<T>, void> {
29-
n_random_complex<T> const* ptr_;
30-
std::size_t n_;
32+
class iterator : public boost::multi::detail::random_access_iterator<iterator, std::complex<T>, std::complex<T>, void> { // NOLINT(cppcoreguidelines-pro-type-member-init,hicpp-member-init)
33+
n_random_complex<T> const* ptr_; // NOLINT(cppcoreguidelines-pro-type-member-init)
34+
std::size_t n_; // NOLINT(cppcoreguidelines-pro-type-member-init)
3135

3236
public: // NOLINT(whitespace/indent) cpplint 1.6 bug
3337
using difference_type = std::ptrdiff_t;
3438

39+
iterator() = default;
40+
3541
iterator(n_random_complex<T> const* ptr, std::size_t n) : ptr_{ptr}, n_{n} {}
3642

3743
// cppcheck-suppress duplInheritedMember ; to ovewrite
@@ -40,6 +46,8 @@ class n_random_complex { // NOLINT(cppcoreguidelines-special-member-functions,h
4046
++n_;
4147
return *this;
4248
}
49+
auto operator++(int) -> iterator { iterator ret{*this}; ++(*this); return ret; }
50+
// auto operator--(int) -> iterator { iterator ret{*this}; --(*this); return ret; }
4351

4452
auto operator==(iterator const& other) const { return n_ == other.n_; }
4553
auto operator!=(iterator const& other) const { return n_ != other.n_; }

0 commit comments

Comments
 (0)