Last change
on this file since 787 was 785, checked in by ansari, 26 years ago |
Corrections,amelioration de TArray<T> - Reza 16/3/2000
|
File size:
672 bytes
|
Rev | Line | |
---|
[785] | 1 | // Utility classes for template numerical arrays
|
---|
| 2 | // R. Ansari, C.Magneville 03/2000
|
---|
| 3 |
|
---|
| 4 | #include "machdefs.h"
|
---|
| 5 | #include "utilarr.h"
|
---|
| 6 |
|
---|
| 7 | // Classe utilitaires
|
---|
| 8 | Sequence::Sequence(double start, double step, Arr_DoubleFunctionOfX f)
|
---|
| 9 | {
|
---|
| 10 | start_ = start;
|
---|
| 11 | step_ = step;
|
---|
| 12 | myf_ = f;
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | double Sequence::operator () (uint_4 k)
|
---|
| 16 | {
|
---|
| 17 | double x = start_+(double)k*step_;
|
---|
| 18 | if (myf_) return(myf_(x));
|
---|
| 19 | return x;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | Range::Range(uint_4 start, uint_4 size, uint_4 step)
|
---|
| 23 | {
|
---|
| 24 | start_ = start;
|
---|
| 25 | size_ = (size > 0) ? size : 1;
|
---|
| 26 | step_ = (step > 0) ? step : 1;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | Range & Range::operator = (uint_4 start)
|
---|
| 30 | {
|
---|
| 31 | start_ = start;
|
---|
| 32 | size_ = 1;
|
---|
| 33 | step_ = 1;
|
---|
| 34 | return (*this);
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.