Skip to content

Commit 2172696

Browse files
committed
Armadillo 12.6.2
1 parent b12b0ea commit 2172696

File tree

6 files changed

+307
-143
lines changed

6 files changed

+307
-143
lines changed

inst/include/armadillo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
#include <random>
5151
#include <functional>
5252
#include <chrono>
53+
#include <atomic>
5354

5455
#if !defined(ARMA_DONT_USE_STD_MUTEX)
5556
#include <mutex>
56-
#include <atomic>
5757
#endif
5858

5959
// #if defined(ARMA_HAVE_CXX17)

inst/include/armadillo_bits/SpValProxy_bones.hpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ template<typename T1>
2828
class SpValProxy
2929
{
3030
public:
31-
31+
3232
typedef typename T1::elem_type eT; // Convenience typedef
33-
33+
3434
friend class SpMat<eT>;
3535
friend class SpSubview<eT>;
3636

@@ -49,16 +49,17 @@ class SpValProxy
4949
//! Overload all of the potential operators.
5050

5151
//! First, the ones that could modify a value.
52-
arma_inline SpValProxy& operator=(const eT rhs);
53-
arma_inline SpValProxy& operator+=(const eT rhs);
54-
arma_inline SpValProxy& operator-=(const eT rhs);
55-
arma_inline SpValProxy& operator*=(const eT rhs);
56-
arma_inline SpValProxy& operator/=(const eT rhs);
57-
58-
arma_inline SpValProxy& operator++();
59-
arma_inline SpValProxy& operator--();
60-
arma_inline eT operator++(const int);
61-
arma_inline eT operator--(const int);
52+
inline SpValProxy& operator= (const eT rhs);
53+
inline SpValProxy& operator+=(const eT rhs);
54+
inline SpValProxy& operator-=(const eT rhs);
55+
inline SpValProxy& operator*=(const eT rhs);
56+
inline SpValProxy& operator/=(const eT rhs);
57+
58+
inline SpValProxy& operator++();
59+
inline SpValProxy& operator--();
60+
61+
inline eT operator++(const int);
62+
inline eT operator--(const int);
6263

6364
//! This will work for any other operations that do not modify a value.
6465
arma_inline operator eT() const;

inst/include/armadillo_bits/SpValProxy_meat.hpp

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -56,48 +56,43 @@ SpValProxy<T1>::operator=(const SpValProxy<T2>& rhs)
5656

5757

5858
template<typename T1>
59-
arma_inline
59+
inline
6060
SpValProxy<T1>&
6161
SpValProxy<T1>::operator=(const eT rhs)
6262
{
6363
if(rhs != eT(0)) // A nonzero element is being assigned.
6464
{
65-
6665
if(val_ptr)
6766
{
6867
// The value exists and merely needs to be updated.
6968
*val_ptr = rhs;
7069
parent.invalidate_cache();
7170
}
72-
7371
else
7472
{
7573
// The value is nonzero and must be inserted.
7674
val_ptr = &parent.insert_element(row, col, rhs);
7775
}
78-
7976
}
8077
else // A zero is being assigned.~
8178
{
82-
8379
if(val_ptr)
8480
{
8581
// The element exists, but we need to remove it, because it is being set to 0.
8682
parent.delete_element(row, col);
8783
val_ptr = nullptr;
8884
}
89-
85+
9086
// If the element does not exist, we do not need to do anything at all.
91-
9287
}
93-
88+
9489
return *this;
9590
}
9691

9792

9893

9994
template<typename T1>
100-
arma_inline
95+
inline
10196
SpValProxy<T1>&
10297
SpValProxy<T1>::operator+=(const eT rhs)
10398
{
@@ -123,7 +118,7 @@ SpValProxy<T1>::operator+=(const eT rhs)
123118

124119

125120
template<typename T1>
126-
arma_inline
121+
inline
127122
SpValProxy<T1>&
128123
SpValProxy<T1>::operator-=(const eT rhs)
129124
{
@@ -142,65 +137,58 @@ SpValProxy<T1>::operator-=(const eT rhs)
142137
val_ptr = &parent.insert_element(row, col, -rhs);
143138
}
144139
}
145-
140+
146141
return *this;
147142
}
148143

149144

150145

151146
template<typename T1>
152-
arma_inline
147+
inline
153148
SpValProxy<T1>&
154149
SpValProxy<T1>::operator*=(const eT rhs)
155150
{
156151
if(rhs != eT(0))
157152
{
158-
159153
if(val_ptr)
160154
{
161155
// The value already exists and merely needs to be updated.
162156
*val_ptr *= rhs;
163157
parent.invalidate_cache();
164158
check_zero();
165159
}
166-
167160
}
168161
else
169162
{
170-
171163
if(val_ptr)
172164
{
173165
// Since we are multiplying by zero, the value can be deleted.
174166
parent.delete_element(row, col);
175167
val_ptr = nullptr;
176168
}
177-
178169
}
179-
170+
180171
return *this;
181172
}
182173

183174

184175

185176
template<typename T1>
186-
arma_inline
177+
inline
187178
SpValProxy<T1>&
188179
SpValProxy<T1>::operator/=(const eT rhs)
189180
{
190181
if(rhs != eT(0)) // I hope this is true!
191182
{
192-
193183
if(val_ptr)
194184
{
195185
*val_ptr /= rhs;
196186
parent.invalidate_cache();
197187
check_zero();
198188
}
199-
200189
}
201190
else
202191
{
203-
204192
if(val_ptr)
205193
{
206194
*val_ptr /= rhs; // That is where it gets ugly.
@@ -211,27 +199,25 @@ SpValProxy<T1>::operator/=(const eT rhs)
211199
val_ptr = nullptr;
212200
}
213201
}
214-
215202
else
216203
{
217204
eT val = eT(0) / rhs; // This may vary depending on type and implementation.
218-
205+
219206
if(val != eT(0))
220207
{
221208
// Ok, now we have to insert it.
222209
val_ptr = &parent.insert_element(row, col, val);
223210
}
224-
225211
}
226212
}
227-
213+
228214
return *this;
229215
}
230216

231217

232218

233219
template<typename T1>
234-
arma_inline
220+
inline
235221
SpValProxy<T1>&
236222
SpValProxy<T1>::operator++()
237223
{
@@ -241,19 +227,18 @@ SpValProxy<T1>::operator++()
241227
parent.invalidate_cache();
242228
check_zero();
243229
}
244-
245230
else
246231
{
247232
val_ptr = &parent.insert_element(row, col, eT(1));
248233
}
249-
234+
250235
return *this;
251236
}
252237

253238

254239

255240
template<typename T1>
256-
arma_inline
241+
inline
257242
SpValProxy<T1>&
258243
SpValProxy<T1>::operator--()
259244
{
@@ -263,19 +248,18 @@ SpValProxy<T1>::operator--()
263248
parent.invalidate_cache();
264249
check_zero();
265250
}
266-
267251
else
268252
{
269253
val_ptr = &parent.insert_element(row, col, eT(-1));
270254
}
271-
255+
272256
return *this;
273257
}
274258

275259

276260

277261
template<typename T1>
278-
arma_inline
262+
inline
279263
typename T1::elem_type
280264
SpValProxy<T1>::operator++(const int)
281265
{
@@ -285,12 +269,11 @@ SpValProxy<T1>::operator++(const int)
285269
parent.invalidate_cache();
286270
check_zero();
287271
}
288-
289272
else
290273
{
291274
val_ptr = &parent.insert_element(row, col, eT(1));
292275
}
293-
276+
294277
if(val_ptr) // It may have changed to now be 0.
295278
{
296279
return *(val_ptr) - eT(1);
@@ -304,7 +287,7 @@ SpValProxy<T1>::operator++(const int)
304287

305288

306289
template<typename T1>
307-
arma_inline
290+
inline
308291
typename T1::elem_type
309292
SpValProxy<T1>::operator--(const int)
310293
{
@@ -314,12 +297,11 @@ SpValProxy<T1>::operator--(const int)
314297
parent.invalidate_cache();
315298
check_zero();
316299
}
317-
318300
else
319301
{
320302
val_ptr = &parent.insert_element(row, col, eT(-1));
321303
}
322-
304+
323305
if(val_ptr) // It may have changed to now be 0.
324306
{
325307
return *(val_ptr) + eT(1);

0 commit comments

Comments
 (0)