diff options
author | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-02-27 10:04:38 +0000 |
---|---|---|
committer | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-02-27 10:04:38 +0000 |
commit | ecdf366e31ebe3fb899bc13347c17b369c8f91f6 (patch) | |
tree | 062522cd5c5dbb49c9ff2fb0011cfcaf7d1a2c05 /packages/numlib | |
parent | dca40c9bef57e748f7548ab594aed0be5812bfa2 (diff) | |
download | fpc-ecdf366e31ebe3fb899bc13347c17b369c8f91f6.tar.gz |
* Slightly modified patch from WP mantis #23816
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@38357 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/numlib')
-rw-r--r-- | packages/numlib/src/typ.pas | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/packages/numlib/src/typ.pas b/packages/numlib/src/typ.pas index 68fea7bc6d..9991aefeac 100644 --- a/packages/numlib/src/typ.pas +++ b/packages/numlib/src/typ.pas @@ -53,9 +53,7 @@ uses CONST numlib_version=2; {used to detect version conflicts between header unit and dll} - highestelement=20000; {Maximal n x m dimensions of matrix. - +/- highestelement*SIZEOF(arbfloat) is - minimal size of matrix.} + type {Definition of base types} {$IFDEF ArbExtended} ArbFloat = extended; @@ -181,8 +179,6 @@ type offsetx, offsety, scalex, scaley: ArbFloat end; - - {Standard Functions used in NumLib} rfunc1r = Function(x : ArbFloat): ArbFloat; rfunc1rn = Function(x : ArbFloat): ArbFloat is nested; @@ -195,33 +191,47 @@ type oderk1n = procedure(x: ArbFloat; var y, f: ArbFloat); roofnrfunc = procedure(var x, fx: ArbFloat; var deff: boolean); + + {Maximal n x m dimensions of matrix. + +/- highestelement*SIZEOF(elementtype) is + minimal size of matrix.} +const + highestfloatelement = High(ArbInt) div SizeOf(ArbFloat); + highestptrelement = High(ArbInt) div SizeOf(Pointer); + highestintelement = High(ArbInt) div SizeOf(ArbInt); + highestboolelement = High(ArbInt) div SizeOf(boolean); + highestcomplexelement = High(ArbInt) div SizeOf(complex); + highestvectorelement = High(ArbInt) div SizeOf(vector); + + +type {Definition of matrix types in NumLib. First some vectors. The high boundery is a maximal number only. Vectors can be smaller, but not bigger. The difference is the starting number} - arfloat0 = array[0..highestelement] of ArbFloat; - arfloat1 = array[1..highestelement] of ArbFloat; - arfloat2 = array[2..highestelement] of ArbFloat; - arfloat_1 = array[-1..highestelement] of ArbFloat; + arfloat0 = array[0..highestfloatelement-1] of ArbFloat; + arfloat1 = array[1..highestfloatelement] of ArbFloat; + arfloat2 = array[2..highestfloatelement+1] of ArbFloat; + arfloat_1 = array[-1..highestfloatelement-2] of ArbFloat; {A matrix is an array of floats} - ar2dr = array[0..highestelement] of ^arfloat0; - ar2dr1 = array[1..highestelement] of ^arfloat1; + ar2dr = array[0..highestptrelement-1] of ^arfloat0; + ar2dr1 = array[1..highestptrelement] of ^arfloat1; {Matrices can get big, so we mosttimes allocate them on the heap.} par2dr1 = ^ar2dr1; {Integer vectors} - arint0 = array[0..highestelement] of ArbInt; - arint1 = array[1..highestelement] of ArbInt; + arint0 = array[0..highestintelement-1] of ArbInt; + arint1 = array[1..highestintelement] of ArbInt; {Boolean (true/false) vectors} - arbool1 = array[1..highestelement] of boolean; + arbool1 = array[1..highestboolelement] of boolean; {Complex vectors} - arcomp0 = array[0..highestelement] of complex; - arcomp1 = array[1..highestelement] of complex; - arvect0 = array[0..highestelement] of vector; - vectors = array[1..highestelement] of vector; + arcomp0 = array[0..highestcomplexelement-1] of complex; + arcomp1 = array[1..highestcomplexelement] of complex; + arvect0 = array[0..highestvectorelement-1] of vector; + vectors = array[1..highestvectorelement] of vector; parcomp = ^arcomp1; |