Last change
on this file since 813 was 813, checked in by ansari, 25 years ago |
Correction bug/amelioarions TArray,TMatrix,TVector - Reza 5/4/2000
|
File size:
1.3 KB
|
Line | |
---|
1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
2 | // Utility classes for template numerical arrays
|
---|
3 | // R. Ansari, C.Magneville 03/2000
|
---|
4 |
|
---|
5 | #ifndef UtilArray_SEEN
|
---|
6 | #define UtilArray_SEEN
|
---|
7 |
|
---|
8 | #include "machdefs.h"
|
---|
9 | #include <stdlib.h>
|
---|
10 |
|
---|
11 | namespace SOPHYA {
|
---|
12 |
|
---|
13 | /* Quelques utilitaires pour les tableaux (Array) */
|
---|
14 |
|
---|
15 | typedef double (* Arr_DoubleFunctionOfX) (double x);
|
---|
16 | typedef float (* Arr_FloatFunctionOfX) (float x);
|
---|
17 |
|
---|
18 | class Sequence {
|
---|
19 | public:
|
---|
20 | explicit Sequence (double start=0., double step=1., Arr_DoubleFunctionOfX f=NULL);
|
---|
21 | inline double & Start() { return start_; }
|
---|
22 | inline double & Step() { return step_; }
|
---|
23 | double operator () (uint_4 k);
|
---|
24 | protected:
|
---|
25 | double start_, step_;
|
---|
26 | Arr_DoubleFunctionOfX myf_;
|
---|
27 | };
|
---|
28 |
|
---|
29 | class Range {
|
---|
30 | public:
|
---|
31 | explicit Range(uint_4 start=0, uint_4 end=0, uint_4 size=1, uint_4 step=1);
|
---|
32 | inline uint_4 & Start() { return start_; }
|
---|
33 | inline uint_4 & End() { return end_; }
|
---|
34 | inline uint_4 & Size() { return size_; }
|
---|
35 | inline uint_4 & Step() { return step_; }
|
---|
36 | protected:
|
---|
37 | uint_4 start_, end_, size_, step_ ;
|
---|
38 | };
|
---|
39 |
|
---|
40 | class IdentityMatrix {
|
---|
41 | public:
|
---|
42 | explicit IdentityMatrix(double diag=1., uint_4 n=0);
|
---|
43 | inline uint_4 Size() { return size_; }
|
---|
44 | inline double Diag() { return diag_; }
|
---|
45 | protected:
|
---|
46 | uint_4 size_;
|
---|
47 | double diag_;
|
---|
48 | };
|
---|
49 |
|
---|
50 | } // Fin du namespace
|
---|
51 |
|
---|
52 | #endif
|
---|
53 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.