[futurebasic] another Christmas Present

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Doug Griggs <griggs@...>
Date: Fri, 19 Dec 1997 10:42:48 +0000
  Following in Greg's sterling example, I have a set of functions that
operate on arrays of data as a whole, adding, subtracting, multiplying and
dividing arrays by arrays and arrays by constants. There is also a basic
statistic FN that provides a few stats that I needed for a project.  
  There is an extensive use of XREF, and the arrays are managed using a
record that holds pertinent data about each array.  There is a very simple
main app which demonstrates how the thing works, and it includes a dummy
array generator.  This type of code may have application for those who were
recently asking about coordinate geometry.  
  BTW, this method was about 2X faster than using BLOCKMOVE to work with
arrays, and if it were compiled native in C (GAAAK) experience says it would
SMOKE.  C really likes it when you don't ask it to move memory around, just
beat on it where ever it happens to be. The following is the comment block
at the head of the primary include file. I hope it explains what I'm up to
  The source code can be downloaded at: members.aol.com/dgriggs/vector
as a self-extracting archive. (only about 30K)

Merry Christmas!

Please email privately if you like this stuff. I'm curious about how my
approach is received in FB land. Thanks!

REM comments
'FN info:
'This FN fills up two dummy arrays with sequential data for testing
'LOCAL FN FasterPlotter(@xVectRec&,@yVectRec&)
'LOCAL FN xvect_plus_yvect(@xVectRec&,@yVectRec&,@resVectRec&)
'LOCAL FN xvect_minus_yvect(@xVectRec&,@yVectRec&,@resVectRec&)
'LOCAL FN xvect_times_yvect(@xVectRec&,@yVectRec&,@resVectRec&)
'LOCAL FN xvect_divide_by_yvect(@xVectRec&,@yVectRec&,@resVectRec&)
'this FN calculates the engineering units of xVectRec using the MX+B form 
'and sticks the result in the resVectRec vector.
'LOCAL FN xvect_times_slope_plus_B(@xVectRec&,slope#,B#,@resVectRec&)
'this FN calculates xVectRec*K (or /K if K=1/K) and sticks the
'result in the resVectRec vector.
'LOCAL FN xvect_times_K(@xVectRec&,K#,@resVectRec&)
'this FN calculates xVectRec+K (or -K if K<0) and sticks the
'result in the resVectRec vector.
'LOCAL FN xvect_plus_K(@xVectRec&,K#,@resVectRec&)
'this seems to be the solution to using global arrays in a local function.
'XREF dimensions an array without using memory, it just uses the appropriate
'"shape" of memory at the address (xLcl& in this case) allowing you to
'reference array locations as array elements in the designated memory block.
'The XREF array must have the same basic name as the pointer, except for the
'type symbol.
'I think XREF is faster because the stuff never really moves, it is just
'where it sits, and the local mode FN can modify globals outside of its
'of awareness.
'For this function, pass the first element of the array of records that
define the
'vector parameters