author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Wed, 04 Feb 2015 13:40:57 -0800 | |
changeset 11414 | 8bdce024e490 |
parent 10968 | 2d29fee2b7b8 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6349 | 2 |
|
3 |
/* |
|
4 |
* Copyright (c) 2009 CTTC |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License version 2 as |
|
8 |
* published by the Free Software Foundation; |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 |
* |
|
19 |
* Author: Nicola Baldo <nbaldo@cttc.es> |
|
20 |
*/ |
|
21 |
||
22 |
#include <ns3/spectrum-value.h> |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8866
diff
changeset
|
23 |
#include <ns3/math.h> |
6349 | 24 |
#include <ns3/log.h> |
25 |
||
26 |
namespace ns3 { |
|
27 |
||
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10842
diff
changeset
|
28 |
NS_LOG_COMPONENT_DEFINE ("SpectrumValue"); |
6349 | 29 |
|
6355
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
30 |
SpectrumValue::SpectrumValue () |
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6801
diff
changeset
|
31 |
{ |
6355
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
32 |
} |
6349 | 33 |
|
34 |
SpectrumValue::SpectrumValue (Ptr<const SpectrumModel> sof) |
|
35 |
: m_spectrumModel (sof), |
|
36 |
m_values (sof->GetNumBands ()) |
|
37 |
{ |
|
38 |
||
39 |
} |
|
40 |
||
41 |
double& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
42 |
SpectrumValue::operator[] (size_t index) |
6349 | 43 |
{ |
44 |
return m_values.at (index); |
|
45 |
} |
|
46 |
||
10842
b1d6e75793bb
Add const double& operator[] to SpectrumValue
Sascha Alexander Jopen <jopen@informatik.uni-bonn.de>
parents:
9063
diff
changeset
|
47 |
const double& |
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
48 |
SpectrumValue::operator[] (size_t index) const |
10842
b1d6e75793bb
Add const double& operator[] to SpectrumValue
Sascha Alexander Jopen <jopen@informatik.uni-bonn.de>
parents:
9063
diff
changeset
|
49 |
{ |
b1d6e75793bb
Add const double& operator[] to SpectrumValue
Sascha Alexander Jopen <jopen@informatik.uni-bonn.de>
parents:
9063
diff
changeset
|
50 |
return m_values.at (index); |
b1d6e75793bb
Add const double& operator[] to SpectrumValue
Sascha Alexander Jopen <jopen@informatik.uni-bonn.de>
parents:
9063
diff
changeset
|
51 |
} |
b1d6e75793bb
Add const double& operator[] to SpectrumValue
Sascha Alexander Jopen <jopen@informatik.uni-bonn.de>
parents:
9063
diff
changeset
|
52 |
|
6349 | 53 |
|
54 |
SpectrumModelUid_t |
|
55 |
SpectrumValue::GetSpectrumModelUid () const |
|
56 |
{ |
|
57 |
return m_spectrumModel->GetUid (); |
|
58 |
} |
|
59 |
||
60 |
||
61 |
Ptr<const SpectrumModel> |
|
62 |
SpectrumValue::GetSpectrumModel () const |
|
63 |
{ |
|
64 |
return m_spectrumModel; |
|
65 |
} |
|
66 |
||
67 |
||
68 |
Values::const_iterator |
|
69 |
SpectrumValue::ConstValuesBegin () const |
|
70 |
{ |
|
71 |
return m_values.begin (); |
|
72 |
} |
|
73 |
||
74 |
Values::const_iterator |
|
75 |
SpectrumValue::ConstValuesEnd () const |
|
76 |
{ |
|
77 |
return m_values.end (); |
|
78 |
} |
|
79 |
||
80 |
||
81 |
Values::iterator |
|
82 |
SpectrumValue::ValuesBegin () |
|
83 |
{ |
|
84 |
return m_values.begin (); |
|
85 |
} |
|
86 |
||
87 |
Values::iterator |
|
88 |
SpectrumValue::ValuesEnd () |
|
89 |
{ |
|
90 |
return m_values.end (); |
|
91 |
} |
|
92 |
||
93 |
Bands::const_iterator |
|
94 |
SpectrumValue::ConstBandsBegin () const |
|
95 |
{ |
|
96 |
return m_spectrumModel->Begin (); |
|
97 |
} |
|
98 |
||
99 |
Bands::const_iterator |
|
100 |
SpectrumValue::ConstBandsEnd () const |
|
101 |
{ |
|
102 |
return m_spectrumModel->End (); |
|
103 |
} |
|
104 |
||
105 |
||
106 |
void |
|
107 |
SpectrumValue::Add (const SpectrumValue& x) |
|
108 |
{ |
|
109 |
Values::iterator it1 = m_values.begin (); |
|
110 |
Values::const_iterator it2 = x.m_values.begin (); |
|
111 |
||
112 |
NS_ASSERT (m_spectrumModel == x.m_spectrumModel); |
|
113 |
||
114 |
while (it1 != m_values.end ()) |
|
115 |
{ |
|
116 |
NS_ASSERT ( it2 != x.m_values.end ()); |
|
117 |
*it1 += *it2; |
|
118 |
++it1; |
|
119 |
++it2; |
|
120 |
} |
|
121 |
} |
|
122 |
||
123 |
||
124 |
void |
|
125 |
SpectrumValue::Add (double s) |
|
126 |
{ |
|
127 |
Values::iterator it1 = m_values.begin (); |
|
128 |
||
129 |
while (it1 != m_values.end ()) |
|
130 |
{ |
|
131 |
*it1 += s; |
|
132 |
++it1; |
|
133 |
} |
|
134 |
} |
|
135 |
||
136 |
||
137 |
||
138 |
void |
|
139 |
SpectrumValue::Subtract (const SpectrumValue& x) |
|
140 |
{ |
|
141 |
Values::iterator it1 = m_values.begin (); |
|
142 |
Values::const_iterator it2 = x.m_values.begin (); |
|
143 |
||
144 |
NS_ASSERT (m_spectrumModel == x.m_spectrumModel); |
|
145 |
||
146 |
while (it1 != m_values.end ()) |
|
147 |
{ |
|
148 |
NS_ASSERT ( it2 != x.m_values.end ()); |
|
149 |
*it1 -= *it2; |
|
150 |
++it1; |
|
151 |
++it2; |
|
152 |
} |
|
153 |
} |
|
154 |
||
155 |
||
156 |
void |
|
157 |
SpectrumValue::Subtract (double s) |
|
158 |
{ |
|
159 |
Add (-s); |
|
160 |
} |
|
161 |
||
162 |
||
163 |
||
164 |
void |
|
165 |
SpectrumValue::Multiply (const SpectrumValue& x) |
|
166 |
{ |
|
167 |
Values::iterator it1 = m_values.begin (); |
|
168 |
Values::const_iterator it2 = x.m_values.begin (); |
|
169 |
||
170 |
NS_ASSERT (m_spectrumModel == x.m_spectrumModel); |
|
171 |
||
172 |
while (it1 != m_values.end ()) |
|
173 |
{ |
|
174 |
NS_ASSERT ( it2 != x.m_values.end ()); |
|
175 |
*it1 *= *it2; |
|
176 |
++it1; |
|
177 |
++it2; |
|
178 |
} |
|
179 |
} |
|
180 |
||
181 |
||
182 |
void |
|
183 |
SpectrumValue::Multiply (double s) |
|
184 |
{ |
|
185 |
Values::iterator it1 = m_values.begin (); |
|
186 |
||
187 |
while (it1 != m_values.end ()) |
|
188 |
{ |
|
189 |
*it1 *= s; |
|
190 |
++it1; |
|
191 |
} |
|
192 |
} |
|
193 |
||
194 |
||
195 |
||
196 |
||
197 |
void |
|
198 |
SpectrumValue::Divide (const SpectrumValue& x) |
|
199 |
{ |
|
200 |
Values::iterator it1 = m_values.begin (); |
|
201 |
Values::const_iterator it2 = x.m_values.begin (); |
|
202 |
||
203 |
NS_ASSERT (m_spectrumModel == x.m_spectrumModel); |
|
204 |
||
205 |
while (it1 != m_values.end ()) |
|
206 |
{ |
|
207 |
NS_ASSERT ( it2 != x.m_values.end ()); |
|
208 |
*it1 /= *it2; |
|
209 |
++it1; |
|
210 |
++it2; |
|
211 |
} |
|
212 |
} |
|
213 |
||
214 |
||
215 |
void |
|
216 |
SpectrumValue::Divide (double s) |
|
217 |
{ |
|
218 |
NS_LOG_FUNCTION (this << s); |
|
219 |
Values::iterator it1 = m_values.begin (); |
|
220 |
||
221 |
while (it1 != m_values.end ()) |
|
222 |
{ |
|
223 |
*it1 /= s; |
|
224 |
++it1; |
|
225 |
} |
|
226 |
} |
|
227 |
||
228 |
||
229 |
||
230 |
||
231 |
void |
|
232 |
SpectrumValue::ChangeSign () |
|
233 |
{ |
|
234 |
Values::iterator it1 = m_values.begin (); |
|
235 |
||
236 |
while (it1 != m_values.end ()) |
|
237 |
{ |
|
238 |
*it1 = -(*it1); |
|
239 |
++it1; |
|
240 |
} |
|
241 |
} |
|
242 |
||
243 |
||
244 |
void |
|
245 |
SpectrumValue::ShiftLeft (int n) |
|
246 |
{ |
|
247 |
int i = 0; |
|
248 |
while (i < (int) m_values.size () - n) |
|
249 |
{ |
|
250 |
m_values.at (i) = m_values.at (i + n); |
|
251 |
i++; |
|
252 |
} |
|
253 |
while (i < (int)m_values.size ()) |
|
254 |
{ |
|
255 |
m_values.at (i) = 0; |
|
256 |
i++; |
|
257 |
} |
|
258 |
} |
|
259 |
||
260 |
||
261 |
void |
|
262 |
SpectrumValue::ShiftRight (int n) |
|
263 |
{ |
|
264 |
int i = m_values.size () - 1; |
|
265 |
while (i - n >= 0) |
|
266 |
{ |
|
267 |
m_values.at (i) = m_values.at (i - n); |
|
268 |
i = i - 1; |
|
269 |
} |
|
270 |
while (i >= 0) |
|
271 |
{ |
|
272 |
m_values.at (i) = 0; |
|
273 |
--i; |
|
274 |
} |
|
275 |
} |
|
276 |
||
277 |
||
278 |
||
279 |
void |
|
280 |
SpectrumValue::Pow (double exp) |
|
281 |
{ |
|
282 |
NS_LOG_FUNCTION (this << exp); |
|
283 |
Values::iterator it1 = m_values.begin (); |
|
284 |
||
285 |
while (it1 != m_values.end ()) |
|
286 |
{ |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8866
diff
changeset
|
287 |
*it1 = std::pow (*it1, exp); |
6349 | 288 |
++it1; |
289 |
} |
|
290 |
} |
|
291 |
||
292 |
||
293 |
void |
|
294 |
SpectrumValue::Exp (double base) |
|
295 |
{ |
|
296 |
NS_LOG_FUNCTION (this << base); |
|
297 |
Values::iterator it1 = m_values.begin (); |
|
298 |
||
299 |
while (it1 != m_values.end ()) |
|
300 |
{ |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8866
diff
changeset
|
301 |
*it1 = std::pow (base, *it1); |
6349 | 302 |
++it1; |
303 |
} |
|
304 |
} |
|
305 |
||
306 |
||
307 |
void |
|
308 |
SpectrumValue::Log10 () |
|
309 |
{ |
|
310 |
NS_LOG_FUNCTION (this); |
|
311 |
Values::iterator it1 = m_values.begin (); |
|
312 |
||
313 |
while (it1 != m_values.end ()) |
|
314 |
{ |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8866
diff
changeset
|
315 |
*it1 = std::log10 (*it1); |
6349 | 316 |
++it1; |
317 |
} |
|
318 |
} |
|
319 |
||
320 |
void |
|
321 |
SpectrumValue::Log2 () |
|
322 |
{ |
|
323 |
NS_LOG_FUNCTION (this); |
|
324 |
Values::iterator it1 = m_values.begin (); |
|
325 |
||
326 |
while (it1 != m_values.end ()) |
|
327 |
{ |
|
328 |
*it1 = log2 (*it1); |
|
329 |
++it1; |
|
330 |
} |
|
331 |
} |
|
332 |
||
333 |
||
334 |
void |
|
335 |
SpectrumValue::Log () |
|
336 |
{ |
|
337 |
NS_LOG_FUNCTION (this); |
|
338 |
Values::iterator it1 = m_values.begin (); |
|
339 |
||
340 |
while (it1 != m_values.end ()) |
|
341 |
{ |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8866
diff
changeset
|
342 |
*it1 = std::log (*it1); |
6349 | 343 |
++it1; |
344 |
} |
|
345 |
} |
|
346 |
||
347 |
double |
|
348 |
Norm (const SpectrumValue& x) |
|
349 |
{ |
|
350 |
double s = 0; |
|
351 |
Values::const_iterator it1 = x.ConstValuesBegin (); |
|
352 |
while (it1 != x.ConstValuesEnd ()) |
|
353 |
{ |
|
354 |
s += (*it1) * (*it1); |
|
355 |
++it1; |
|
356 |
} |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8866
diff
changeset
|
357 |
return std::sqrt (s); |
6349 | 358 |
} |
359 |
||
360 |
||
361 |
double |
|
362 |
Sum (const SpectrumValue& x) |
|
363 |
{ |
|
364 |
double s = 0; |
|
365 |
Values::const_iterator it1 = x.ConstValuesBegin (); |
|
366 |
while (it1 != x.ConstValuesEnd ()) |
|
367 |
{ |
|
368 |
s += (*it1); |
|
369 |
++it1; |
|
370 |
} |
|
371 |
return s; |
|
372 |
} |
|
373 |
||
374 |
||
375 |
||
376 |
double |
|
377 |
Prod (const SpectrumValue& x) |
|
378 |
{ |
|
379 |
double s = 0; |
|
380 |
Values::const_iterator it1 = x.ConstValuesBegin (); |
|
381 |
while (it1 != x.ConstValuesEnd ()) |
|
382 |
{ |
|
383 |
s *= (*it1); |
|
384 |
++it1; |
|
385 |
} |
|
386 |
return s; |
|
387 |
} |
|
388 |
||
7581 | 389 |
double |
8866
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8339
diff
changeset
|
390 |
Integral (const SpectrumValue& arg) |
7581 | 391 |
{ |
392 |
double i = 0; |
|
8866
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8339
diff
changeset
|
393 |
Values::const_iterator vit = arg.ConstValuesBegin (); |
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8339
diff
changeset
|
394 |
Bands::const_iterator bit = arg.ConstBandsBegin (); |
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8339
diff
changeset
|
395 |
while (vit != arg.ConstValuesEnd ()) |
7581 | 396 |
{ |
8866
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8339
diff
changeset
|
397 |
NS_ASSERT (bit != arg.ConstBandsEnd ()); |
7581 | 398 |
i += (*vit) * (bit->fh - bit->fl); |
399 |
++vit; |
|
400 |
++bit; |
|
401 |
} |
|
8866
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8339
diff
changeset
|
402 |
NS_ASSERT (bit == arg.ConstBandsEnd ()); |
7581 | 403 |
return i; |
404 |
} |
|
405 |
||
406 |
||
6349 | 407 |
|
408 |
Ptr<SpectrumValue> |
|
409 |
SpectrumValue::Copy () const |
|
410 |
{ |
|
411 |
Ptr<SpectrumValue> p = Create<SpectrumValue> (m_spectrumModel); |
|
412 |
*p = *this; |
|
413 |
return p; |
|
414 |
||
415 |
// return Copy<SpectrumValue> (*this) |
|
416 |
} |
|
417 |
||
418 |
||
419 |
std::ostream& |
|
420 |
operator << (std::ostream& os, const SpectrumValue& pvf) |
|
421 |
{ |
|
422 |
Values::const_iterator it1 = pvf.ConstValuesBegin (); |
|
423 |
while (it1 != pvf.ConstValuesEnd ()) |
|
424 |
{ |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7142
diff
changeset
|
425 |
os << *it1 << " "; |
6349 | 426 |
++it1; |
427 |
} |
|
428 |
os << std::endl; |
|
429 |
return os; |
|
430 |
} |
|
431 |
||
432 |
||
433 |
||
434 |
SpectrumValue |
|
435 |
operator+ (const SpectrumValue& lhs, const SpectrumValue& rhs) |
|
436 |
{ |
|
437 |
SpectrumValue res = lhs; |
|
438 |
res.Add (rhs); |
|
439 |
return res; |
|
440 |
} |
|
441 |
||
442 |
||
443 |
SpectrumValue |
|
444 |
operator+ (const SpectrumValue& lhs, double rhs) |
|
445 |
{ |
|
446 |
SpectrumValue res = lhs; |
|
447 |
res.Add (rhs); |
|
448 |
return res; |
|
449 |
} |
|
450 |
||
451 |
||
452 |
SpectrumValue |
|
453 |
operator+ (double lhs, const SpectrumValue& rhs) |
|
454 |
{ |
|
455 |
SpectrumValue res = rhs; |
|
456 |
res.Add (lhs); |
|
457 |
return res; |
|
458 |
} |
|
459 |
||
460 |
||
461 |
SpectrumValue |
|
462 |
operator- (const SpectrumValue& lhs, const SpectrumValue& rhs) |
|
463 |
{ |
|
464 |
SpectrumValue res = rhs; |
|
465 |
res.ChangeSign (); |
|
466 |
res.Add (lhs); |
|
467 |
return res; |
|
468 |
} |
|
469 |
||
470 |
||
471 |
||
472 |
SpectrumValue |
|
473 |
operator- (const SpectrumValue& lhs, double rhs) |
|
474 |
{ |
|
475 |
SpectrumValue res = lhs; |
|
476 |
res.Subtract (rhs); |
|
477 |
return res; |
|
478 |
} |
|
479 |
||
480 |
||
481 |
SpectrumValue |
|
482 |
operator- (double lhs, const SpectrumValue& rhs) |
|
483 |
{ |
|
484 |
SpectrumValue res = rhs; |
|
485 |
res.Subtract (lhs); |
|
486 |
return res; |
|
487 |
} |
|
488 |
||
489 |
SpectrumValue |
|
490 |
operator* (const SpectrumValue& lhs, const SpectrumValue& rhs) |
|
491 |
{ |
|
492 |
SpectrumValue res = lhs; |
|
493 |
res.Multiply (rhs); |
|
494 |
return res; |
|
495 |
} |
|
496 |
||
497 |
||
498 |
SpectrumValue |
|
499 |
operator* (const SpectrumValue& lhs, double rhs) |
|
500 |
{ |
|
501 |
SpectrumValue res = lhs; |
|
502 |
res.Multiply (rhs); |
|
503 |
return res; |
|
504 |
} |
|
505 |
||
506 |
||
507 |
SpectrumValue |
|
508 |
operator* (double lhs, const SpectrumValue& rhs) |
|
509 |
{ |
|
510 |
SpectrumValue res = rhs; |
|
511 |
res.Multiply (lhs); |
|
512 |
return res; |
|
513 |
} |
|
514 |
||
515 |
||
516 |
SpectrumValue |
|
517 |
operator/ (const SpectrumValue& lhs, const SpectrumValue& rhs) |
|
518 |
{ |
|
519 |
SpectrumValue res = lhs; |
|
520 |
res.Divide (rhs); |
|
521 |
return res; |
|
522 |
} |
|
523 |
||
524 |
||
525 |
SpectrumValue |
|
526 |
operator/ (const SpectrumValue& lhs, double rhs) |
|
527 |
{ |
|
528 |
SpectrumValue res = lhs; |
|
529 |
res.Divide (rhs); |
|
530 |
return res; |
|
531 |
} |
|
532 |
||
533 |
||
534 |
SpectrumValue |
|
535 |
operator/ (double lhs, const SpectrumValue& rhs) |
|
536 |
{ |
|
537 |
SpectrumValue res = rhs; |
|
538 |
res.Divide (lhs); |
|
539 |
return res; |
|
540 |
} |
|
541 |
||
542 |
||
543 |
SpectrumValue |
|
544 |
operator+ (const SpectrumValue& rhs) |
|
545 |
{ |
|
546 |
return rhs; |
|
547 |
} |
|
548 |
||
549 |
SpectrumValue |
|
550 |
operator- (const SpectrumValue& rhs) |
|
551 |
{ |
|
552 |
SpectrumValue res = rhs; |
|
553 |
res.ChangeSign (); |
|
554 |
return res; |
|
555 |
} |
|
556 |
||
557 |
||
558 |
SpectrumValue |
|
559 |
Pow (double lhs, const SpectrumValue& rhs) |
|
560 |
{ |
|
561 |
SpectrumValue res = rhs; |
|
562 |
res.Exp (lhs); |
|
563 |
return res; |
|
564 |
} |
|
565 |
||
566 |
||
567 |
SpectrumValue |
|
568 |
Pow (const SpectrumValue& lhs, double rhs) |
|
569 |
{ |
|
570 |
SpectrumValue res = lhs; |
|
571 |
res.Pow (rhs); |
|
572 |
return res; |
|
573 |
} |
|
574 |
||
575 |
||
576 |
SpectrumValue |
|
577 |
Log10 (const SpectrumValue& arg) |
|
578 |
{ |
|
579 |
SpectrumValue res = arg; |
|
580 |
res.Log10 (); |
|
581 |
return res; |
|
582 |
} |
|
583 |
||
584 |
SpectrumValue |
|
585 |
Log2 (const SpectrumValue& arg) |
|
586 |
{ |
|
587 |
SpectrumValue res = arg; |
|
588 |
res.Log2 (); |
|
589 |
return res; |
|
590 |
} |
|
591 |
||
592 |
SpectrumValue |
|
593 |
Log (const SpectrumValue& arg) |
|
594 |
{ |
|
595 |
SpectrumValue res = arg; |
|
596 |
res.Log (); |
|
597 |
return res; |
|
598 |
} |
|
599 |
||
600 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
601 |
SpectrumValue::operator+= (const SpectrumValue& rhs) |
6349 | 602 |
{ |
603 |
Add (rhs); |
|
604 |
return *this; |
|
605 |
} |
|
606 |
||
607 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
608 |
SpectrumValue::operator-= (const SpectrumValue& rhs) |
6349 | 609 |
{ |
610 |
Subtract (rhs); |
|
611 |
return *this; |
|
612 |
} |
|
613 |
||
614 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
615 |
SpectrumValue::operator*= (const SpectrumValue& rhs) |
6349 | 616 |
{ |
617 |
Multiply (rhs); |
|
618 |
return *this; |
|
619 |
} |
|
620 |
||
621 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
622 |
SpectrumValue::operator/= (const SpectrumValue& rhs) |
6349 | 623 |
{ |
624 |
Divide (rhs); |
|
625 |
return *this; |
|
626 |
} |
|
627 |
||
628 |
||
629 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
630 |
SpectrumValue::operator+= (double rhs) |
6349 | 631 |
{ |
632 |
Add (rhs); |
|
633 |
return *this; |
|
634 |
} |
|
635 |
||
636 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
637 |
SpectrumValue::operator-= (double rhs) |
6349 | 638 |
{ |
639 |
Subtract (rhs); |
|
640 |
return *this; |
|
641 |
} |
|
642 |
||
643 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
644 |
SpectrumValue::operator*= (double rhs) |
6349 | 645 |
{ |
646 |
Multiply (rhs); |
|
647 |
return *this; |
|
648 |
} |
|
649 |
||
650 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
651 |
SpectrumValue::operator/= (double rhs) |
6349 | 652 |
{ |
653 |
Divide (rhs); |
|
654 |
return *this; |
|
655 |
} |
|
656 |
||
657 |
||
658 |
SpectrumValue& |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
659 |
SpectrumValue::operator= (double rhs) |
6349 | 660 |
{ |
661 |
Values::iterator it1 = m_values.begin (); |
|
662 |
||
663 |
while (it1 != m_values.end ()) |
|
664 |
{ |
|
665 |
*it1 = rhs; |
|
666 |
++it1; |
|
667 |
} |
|
668 |
return *this; |
|
669 |
} |
|
670 |
||
671 |
||
672 |
||
673 |
SpectrumValue |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
674 |
SpectrumValue::operator<< (int n) const |
6349 | 675 |
{ |
676 |
SpectrumValue res = *this; |
|
677 |
res.ShiftLeft (n); |
|
678 |
return res; |
|
679 |
} |
|
680 |
||
681 |
SpectrumValue |
|
11414
8bdce024e490
Remove extraneous ' ' around ::
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10968
diff
changeset
|
682 |
SpectrumValue::operator>> (int n) const |
6349 | 683 |
{ |
684 |
SpectrumValue res = *this; |
|
685 |
res.ShiftRight (n); |
|
686 |
return res; |
|
687 |
} |
|
688 |
||
689 |
||
690 |
||
691 |
||
692 |
} // namespace ns3 |
|
693 |