Last change
on this file since 818 was 813, checked in by ansari, 25 years ago |
Correction bug/amelioarions TArray,TMatrix,TVector - Reza 5/4/2000
|
File size:
992 bytes
|
Line | |
---|
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 end, uint_4 size, uint_4 step)
|
---|
23 | {
|
---|
24 | start_ = start;
|
---|
25 | step_ = (step > 0) ? step : 1;
|
---|
26 | if (end > start) { // Taille calcule automatiquement
|
---|
27 | end_ = end;
|
---|
28 | if (step_ > ((end_-start_)+1)) size_ = 1;
|
---|
29 | else size_ = ((end-start)+1)/step_;
|
---|
30 | }
|
---|
31 | else { // Taille fixee
|
---|
32 | size_ = size;
|
---|
33 | end_ = start_+size_*step_;
|
---|
34 | }
|
---|
35 | }
|
---|
36 |
|
---|
37 | /*
|
---|
38 | Range & Range::operator = (uint_4 start)
|
---|
39 | {
|
---|
40 | start_ = start;
|
---|
41 | size_ = 1;
|
---|
42 | step_ = 1;
|
---|
43 | return (*this);
|
---|
44 | }
|
---|
45 | */
|
---|
46 |
|
---|
47 |
|
---|
48 | IdentityMatrix::IdentityMatrix(double diag, uint_4 n)
|
---|
49 | {
|
---|
50 | size_ = n;
|
---|
51 | diag_ = diag;
|
---|
52 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.