|
Last change
on this file since 808 was 804, checked in by ansari, 26 years ago |
Amelioation / debugging de la classe TArray<T> - TVector et TMatrix
heritent maintenant de TArray<T> - Classe RCMatrix rendu prive au fichier
sopemtx.cc - linfit.cc integre a sopemtx.cc
Reza 03/04/2000
|
|
File size:
1.2 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 size=1, uint_4 step=1);
|
|---|
| 32 | inline uint_4 & Start() { return start_; }
|
|---|
| 33 | inline uint_4 & Size() { return size_; }
|
|---|
| 34 | inline uint_4 & Step() { return step_; }
|
|---|
| 35 | protected:
|
|---|
| 36 | uint_4 start_, size_, step_;
|
|---|
| 37 | };
|
|---|
| 38 |
|
|---|
| 39 | class IdentityMatrix {
|
|---|
| 40 | public:
|
|---|
| 41 | explicit IdentityMatrix(double diag=1., uint_4 n=0);
|
|---|
| 42 | inline uint_4 Size() { return size_; }
|
|---|
| 43 | inline double Diag() { return diag_; }
|
|---|
| 44 | protected:
|
|---|
| 45 | uint_4 size_;
|
|---|
| 46 | double diag_;
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | } // Fin du namespace
|
|---|
| 50 |
|
|---|
| 51 | #endif
|
|---|
| 52 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.