home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 300_01 / mat_v2d.abr < prev    next >
Text File  |  1989-12-30  |  28KB  |  588 lines

  1.                            ABREVIATED USERS MANUAL
  2.  
  3.  
  4. The following function description is an example of the function writeups 
  5. provided in the users manual. The remaining descriptive writeups are very 
  6. brief but do describe the syntax and basic use of each function. Regular 
  7. users of this library will find the manual quite helpful.
  8.  
  9.  
  10. ----------------------------------------------------------------------------
  11. mfput
  12. ----------------------------------------------------------------------------
  13. Name              mfput - Outputs selected columns from floating point array 
  14.                   in formatted pages with column titles 
  15.                    
  16. Usage             void mfput ( FILE *FN,struct fmat *mtx,char hdr_lst[], 
  17.                   char sel_lst[], unsigned ChPrLn,unsigned FldPrLn,unsigned 
  18.                   DcPlc);  
  19.  
  20. Prototype in      mat_v2b.h
  21.  
  22. Description       This function outputs selected columns of the floating 
  23.                   point array mtx to FN, which has previously been opened 
  24.                   for text write operations (see mfcreat). 
  25.                   
  26.                   hdr_lst[] is a list of abbreviated titles (tokens 
  27.                   delimited by spaces) for each column in mtx.  sel_lst[] is 
  28.                   list of matching abbreviated titles for the columns which 
  29.                   are to be output.  ChPrLn is the maximum number of 
  30.                   characters per line desired. FldPrLn is the number of 
  31.                   values which are desired on each line, and DcPlc specifies 
  32.                   the number of decimal places desired in the output values. 
  33.                   
  34.                   The columns to be output are selected by performing a 
  35.                   token by token comparison of hdr_lst and sel_lst.  If an 
  36.                   abreviated title token from sel_lst matches a title token 
  37.                   in hdr_lst, that column will be output.  The selected 
  38.                   columns of mtx are output in tabular form without page 
  39.                   breaks with the abbreviated column titles enclosed in 
  40.                   braces at the beginning of the table. 
  41.  
  42.                   If the numeric output format is not possible with the 
  43.                   number of decimal places (DcPlc) and fields per line 
  44.                   (FldPrLn) specified the function will generate an error 
  45.                   message and terminate execution. 
  46.                   
  47. Return value      The value of one is returned on completion. 
  48.  
  49. Source code in    fmx1_v2b.c
  50.      
  51. See also          mfpgput,mtput
  52.  
  53. Example           /*  matrix 
  54.                   [ 1 2 3 4 
  55.                     4 5 6 7
  56.                     7 8 9 10 ]
  57.                   */
  58.  
  59.                   flcreat("DATA.OUT",FN);
  60.                   mfput(FN,matrix,  "COL_A COL_B COL_C COL_D",
  61.                                     "COL_B COL_D",20,2,3);
  62.                   
  63.                   /* The following output will be directed to FN  
  64.                   {   DATA.OUT    12/1/88                                  } 
  65.  
  66.                   {    
  67.                        COL_B      COL_D
  68.                   }
  69.                        2.000      4.000
  70.                        5.000      7.000
  71.                        8.000     10.000
  72.  
  73.  
  74.  
  75.  
  76.                            ABREVIATED DESCRIPTIONS
  77.  
  78.  
  79. ----------------------------------------------------------------------------
  80. all                                                                            
  81. ----------------------------------------------------------------------------
  82. Name              all - Macro to loop through an entire array
  83.                   
  84. Usage             macro as follows: all(mx,rw,cl) 
  85.                      for (rw=0; rw<no_rows(mx); rw++) 
  86.                         for (cl=0; cl<no_cols(mx); cl++)
  87.  
  88. ----------------------------------------------------------------------------
  89. cols
  90. ----------------------------------------------------------------------------
  91. Name              cols - Macro to loop through an entire array by columns
  92.                   
  93. Usage             macro as follows: 
  94.                   cols(mx,cl) for(cl=0;cl<no_cols(mx);cl++)
  95.  
  96. ----------------------------------------------------------------------------
  97. f
  98. ----------------------------------------------------------------------------
  99. Name              f - Macro to access a dynamic floating array value
  100.                    
  101. Usage             float f ( struct fmat *mtx, unsigned row, 
  102.                   unsigned column );
  103.  
  104. ----------------------------------------------------------------------------
  105. fck
  106. ----------------------------------------------------------------------------
  107. Name              fck - Macro to perform a boundary check on a specified set 
  108.                   of array indexes for a previosly declared floating 
  109.                   point dynamic matrix.
  110.                    
  111. Usage             void fck(struct fmat *mtx, unsigned row, unsigned col); 
  112.  
  113.  
  114. ----------------------------------------------------------------------------
  115. fdim
  116. ----------------------------------------------------------------------------
  117. Name              fdim - Macro to allocate storage and initialize a dynamic 
  118.                   floating point array 
  119.                    
  120. Usage             void fdim ( struct fmat *mtx, unsigned rows, 
  121.                   unsigned cols );
  122.  
  123. ----------------------------------------------------------------------------
  124. frel 
  125. ----------------------------------------------------------------------------
  126. Name              frel - Macro to deallocate storage previously allocated by 
  127.                   a call to fdim. 
  128.                    
  129. Usage             void frel(struct fmat *mtx); 
  130.  
  131. ----------------------------------------------------------------------------
  132. flcreat
  133. ----------------------------------------------------------------------------
  134. Name              flcreat - Opens a text file for write operations then 
  135.                   writes a single line containing the filename and date 
  136.                   enclosed in braces
  137.                   
  138. Usage             void flcreat ( char filename[],FILE *FN );
  139.  
  140. ----------------------------------------------------------------------------
  141. ft
  142. ----------------------------------------------------------------------------
  143. Name              ft - Stores a floating point value in a text array as an 
  144.                   ASCII token string.
  145.                   
  146. Usage             void ft (struct tmat *mtx,unsigned line,unsigned token,
  147.                   float value, unsigned ChPrLn,unsigned FldPrLn, 
  148.                   unsigned DcPlc); 
  149.  
  150. ----------------------------------------------------------------------------
  151. it
  152. ----------------------------------------------------------------------------
  153. Name              it - Stores an integer value in a text array as a 
  154.                   token. 
  155.                   
  156. Usage             void it (struct tmat *mtx,unsigned line,unsigned token,
  157.                   unsigned value, unsigned ChPrLn,unsigned FldPrLn);
  158.  
  159. ----------------------------------------------------------------------------
  160. mfcnt
  161. ----------------------------------------------------------------------------
  162. Name              mfcnt - Returns the number of rows and columns in an ASCII 
  163.                   textfile stored in a format standardized for floating 
  164.                   point arrays.  
  165.                    
  166. Usage             void mfcnt (char filename[], unsigned *rows, 
  167.                   unsigned *cols ); 
  168.  
  169. -----------------------------------------------------------------------------
  170. mfcof
  171. -----------------------------------------------------------------------------
  172. Name              mfcof - Returns the cofactor for a dynamic floating point 
  173.                   array element.
  174.                    
  175. Usage             float mfcof (struct fmat *mtx,unsigned i, unsigned j);
  176.  
  177. ----------------------------------------------------------------------------
  178. mfcnt
  179. ----------------------------------------------------------------------------
  180. Name              mfcnt - Returns the number of rows and columns in an ASCII 
  181.                   textfile stored in a format standardized for floating 
  182.                   point arrays.  
  183.                    
  184. Usage             void mfcnt (char filename[], unsigned *rows, 
  185.                   unsigned *cols ); 
  186.                   
  187. ----------------------------------------------------------------------------
  188. mfcpy
  189. ----------------------------------------------------------------------------
  190. Name              mfcpy - Copies a dynamic floating point array into another 
  191.                   previously dimensioned dynamic floating array.
  192.                    
  193. Usage             void mfcpy (struct fmat *copy_mtx,struct fmat *mtx );
  194.  
  195. -----------------------------------------------------------------------------
  196. mfcumc
  197. -----------------------------------------------------------------------------
  198. Name              mfcumc - Cumulative totals for a dynamic floating point 
  199.                   array column are computed and stored in a second specified 
  200.                   column
  201.                    
  202. Usage             void mfcumc (struct fmat *mtx,unsigned col,
  203.                   unsigned bgn_row, unsigned end_row, unsigned result_col);
  204.  
  205. -----------------------------------------------------------------------------
  206. mfcumr
  207. -----------------------------------------------------------------------------
  208. Name              mfcumr - Cumulative totals for a dynamic floating point 
  209.                   array row are computed and stored in a second specified 
  210.                   row
  211.                    
  212. Usage             void mfcumr (struct fmat *mtx,unsigned row,
  213.                   unsigned bgn_col, unsigned end_col, unsigned 
  214.                   result_row); 
  215.  
  216. -----------------------------------------------------------------------------
  217. mfdet     
  218. -----------------------------------------------------------------------------
  219. Name              mfdet - The determinant of a dynamic floating point array 
  220.                   is returned
  221.                    
  222. Usage             float mfdet (struct fmat *mtx);
  223.  
  224. ----------------------------------------------------------------------------
  225. mfdump
  226. ----------------------------------------------------------------------------
  227. Name              mfdump - Directs the output of all floating point array 
  228.                   values to the standard output device. 
  229.                    
  230. Usage             void mfdump ( struct fmat *matrix );
  231.  
  232. ----------------------------------------------------------------------------
  233. mfget
  234. ----------------------------------------------------------------------------
  235. Name              mfget - Reads an ASCII text file into an existing dynamic 
  236.                   float array.  Comments in braces are not retained.
  237.                   
  238. Usage             void mfget ( char filename[], struct fmat *mtx );
  239.  
  240. -----------------------------------------------------------------------------
  241. mfinv     
  242. -----------------------------------------------------------------------------
  243. Name              mfinv - The invert of a dynamic floating point array is 
  244.                   computed
  245.                    
  246. Usage             void mfinv (struct fmat *inv_mat,struct fmat *mtx);
  247.  
  248. ----------------------------------------------------------------------------
  249. mfmlt     
  250. ----------------------------------------------------------------------------
  251. Name              mfmlt - Matrix multiplication
  252.                    
  253. Usage             void mfmlt (struct fmat *result_mat,struct fmat 
  254.                   *mat1, struct fmat *mat2); 
  255.  
  256. ----------------------------------------------------------------------------
  257. mfmvac
  258. ----------------------------------------------------------------------------
  259. Name              mfmvac - Moving average of nopds rows of an array column
  260.                    
  261. Usage             void mfmvac ( struct fmat *mtx,unsigned nopds,unsigned col,
  262.                                 unsigned bgn_row,unsigned end_row,
  263.                                 unsigned result_col );
  264.  
  265. ----------------------------------------------------------------------------
  266. mfmvar
  267. ----------------------------------------------------------------------------
  268. Name              mfmvar - Moving average of nopds cols of an array 
  269.                   row. 
  270.                    
  271. Usage             void mfmvar ( struct fmat *mtx,unsigned 
  272.                   nopds,unsigned row, unsigned bgn_col,unsigned 
  273.                   end_col,unsigned result_row ); 
  274.  
  275. ----------------------------------------------------------------------------
  276. mfpgput
  277. ----------------------------------------------------------------------------
  278. Name              mfpgput - Outputs an entire formatted floating point array 
  279.                   to diskfile in a series of pagewidth tables. 
  280.                    
  281. Usage             void mfpgput ( struct fmat *mtx,char filename[],
  282.                   unsigned ChPrLn, unsigned FldPrLn, unsigned DcPlc );
  283.  
  284. ----------------------------------------------------------------------------
  285. mfput
  286. ----------------------------------------------------------------------------
  287. Name              mfput - Outputs selected columns from floating point array 
  288.                   in formatted pages with column titles. 
  289.                    
  290. Usage             void mfput ( FILE *FN,struct fmat *mtx,
  291.                   char hdr_lst[], char sel_lst[], unsigned ChPrLn,
  292.                   unsigned FldPrLn,unsigned DcPlc);  
  293.  
  294. ----------------------------------------------------------------------------
  295. mfread
  296. ----------------------------------------------------------------------------
  297. Name              mfread - Reads a standardized format ASCII textfile into a 
  298.                   previously dimensioned dynamic floating point array.
  299.                    
  300. Usage             void mfread ( struct fmat *mtx,char filename[] );
  301.  
  302. ----------------------------------------------------------------------------
  303. mfslv
  304. ----------------------------------------------------------------------------
  305. Name              mfslv - Solution of simultaneous equations.                 
  306.                    
  307. Usage             void mfslv ( struct fmat *x, struct fmat *A, 
  308.                   struct fmat *C );
  309.                   
  310. ----------------------------------------------------------------------------
  311. mfstore
  312. ----------------------------------------------------------------------------
  313. Name              mfstore - Stores the values of a dynamic floating point 
  314.                   array in a standardized format which can be subsequently 
  315.                   read by mfread. 
  316.                    
  317. Usage             void mfstore ( char filename[],struct fmat *mtx );
  318.  
  319. ----------------------------------------------------------------------------
  320. mfsumr
  321. ----------------------------------------------------------------------------
  322. Name              mfsumr - Sum a floating point array row from bgn_col 
  323.                   to end_col
  324.                    
  325. Usage             float mfsumc ( struct fmat *mtx,unsigned row,
  326.                   unsigned bgn_col,unsigned end_col);
  327.  
  328. ----------------------------------------------------------------------------
  329. mfsumc
  330. ----------------------------------------------------------------------------
  331. Name              mfsumc - Sum a floating point array column from bgn_row 
  332.                   to end_row
  333.                    
  334. Usage             float mfsumr (struct fmat *mtx,unsigned col,unsigned 
  335.                   bgn_row, unsigned end_row ); 
  336.  
  337. ----------------------------------------------------------------------------
  338. mftrnsp
  339. ----------------------------------------------------------------------------
  340. Name              mftrnsp - Transposes matrix
  341.                    
  342. Usage             void trnsp ( struct fmat *trns_mat,mat *mtx );
  343.  
  344. ----------------------------------------------------------------------------
  345. msc
  346. ----------------------------------------------------------------------------
  347. Name              msc - Writes a string to a previously opened ASCII
  348.                   textfile centering the string on a single line and
  349.                   enclosing it in braces
  350.  
  351. Usage             void msc ( FILE *FN,char *text );
  352.  
  353. ----------------------------------------------------------------------------
  354. msl
  355. ----------------------------------------------------------------------------
  356. Name              msl - Writes a string to a previously opened ASCII 
  357.                   textfile left justifying the string on a single line and 
  358.                   enclosing it in braces 
  359.                    
  360. Usage             void msl ( FILE *FN,char *text );
  361.  
  362. ----------------------------------------------------------------------------
  363. msr
  364. ----------------------------------------------------------------------------
  365. Name              msr - Writes a string to a previously opened ASCII 
  366.                   textfile right justifying the string on a single line and 
  367.                   enclosing it in braces 
  368.                    
  369. Usage             void msr ( FILE *FN,char *text );
  370.  
  371. ----------------------------------------------------------------------------
  372. mst
  373. ----------------------------------------------------------------------------
  374. Name              mst - Writes a string to a previously opened ASCII 
  375.                   textfile left justifying the string on a single line and 
  376.                   enclosing it in braces and then outputing a specified text 
  377.                   token beyond the second brace. 
  378.                  
  379. Usage             void mst (FILE *FN,char *label ,char *text_token );
  380.  
  381. ----------------------------------------------------------------------------
  382. msv
  383. ----------------------------------------------------------------------------
  384. Name              msv - Writes a string to a previously opened ASCII 
  385.                   textfile left justifying the string on a single line and 
  386.                   enclosing it in braces and then outputing a floating point 
  387.                   value beyond the second brace 
  388.                  
  389. Usage             void msv ( FILE *FN,char *label ,float value );
  390.  
  391. ----------------------------------------------------------------------------
  392. mtapnd
  393. ----------------------------------------------------------------------------
  394. Name              mtapnd - Add a data line to an existing dynamic text array 
  395.                    
  396. Usage             void mtapnd ( struct tmat *apnd_mat, 
  397.                   struct tmat *src_mat, unsigned src_row ); 
  398.  
  399. ----------------------------------------------------------------------------
  400. mtcnt
  401. ----------------------------------------------------------------------------
  402. Name              mtcnt - Count number of rows, maximum number of tokens per 
  403.                   line, and the maximum token size in an ASCII textfile.  
  404.                   Comments in braces and null string terminating characters 
  405.                   are not counted. 
  406.                    
  407. Usage             void mtcnt ( char filename[], unsigned *rows, 
  408.                   unsigned *maxtoks,unsigned *maxtoksz ); 
  409.  
  410. ----------------------------------------------------------------------------
  411. mtcpy
  412. ----------------------------------------------------------------------------
  413. Name              mtcpy - Copy a dynamic text array to another existing 
  414.                   dynamic text array 
  415.                    
  416. Usage             void mtcpy (struct tmat *source, struct tmat *destin);
  417.  
  418. ----------------------------------------------------------------------------
  419. mtdump
  420. ----------------------------------------------------------------------------
  421. Name              mtdump - Direct the output of all text array tokens
  422.                   to the standard output device.
  423.  
  424. Usage             void mtdump ( struct tmat *matrix );
  425.  
  426. ----------------------------------------------------------------------------
  427. mtget
  428. ----------------------------------------------------------------------------
  429. Name              mtget - Reads an ASCII text file into an existing dynamic 
  430.                   text array.  Comments in braces are not retained.
  431.                   
  432. Usage             void mtget ( char filename[],struct tmat *mtx );
  433.  
  434. ----------------------------------------------------------------------------
  435. mtput
  436. ----------------------------------------------------------------------------
  437. Name              mtput - Outputs selected columns from a dynamic text array 
  438.                   into formatted pages with column titles 
  439.                   
  440. Usage             void mtput(FILE *FN,struct tmat *mtx,char hdr_lst[], 
  441.                   char sel_lst[], unsigned ChPerLn,unsigned FldPrLn ); 
  442.                       
  443. ----------------------------------------------------------------------------
  444. mtread
  445. ----------------------------------------------------------------------------
  446. Name              mtread - Reads a standardized formatt ASCII textfile into 
  447.                   a previously dimensioned dynamic text array 
  448.                   
  449. Usage             void mtread ( char filename[],struct tmat *mtx );
  450.  
  451. ----------------------------------------------------------------------------
  452. mtstore
  453. ----------------------------------------------------------------------------
  454. Name              mtstore - Stores the tokens of a dynamic text array in a 
  455.                   format which can be subsequently read by mfread 
  456.                   
  457. Usage             void mtstore ( char filename[],struct tmat *mtx );
  458.  
  459. ----------------------------------------------------------------------------
  460. no_cols
  461. ----------------------------------------------------------------------------
  462. Name              no_cols - Returns the number of columns allocated by a 
  463.                   fdim or tdim macro call 
  464.                    
  465. Usage             unsigned no_cols ( struct tmat or struct fmat *mtx );
  466.  
  467. ----------------------------------------------------------------------------
  468. no_recs
  469. ----------------------------------------------------------------------------
  470. Name              no_recs - The number of rows of token data currently 
  471.                   stored in a dynamic text array. 
  472.                    
  473. Usage             unsigned no_recs ( struct tmat or struct fmat *mtx );
  474.  
  475. ----------------------------------------------------------------------------
  476. no_rows
  477. ----------------------------------------------------------------------------
  478. Name              no_rows - The number of rows allocated by a fdim or tdim 
  479.                   macro call 
  480.                                          
  481. Usage             unsigned no_rows ( struct tmat or struct fmat *mtx );
  482.                                      
  483. ----------------------------------------------------------------------------
  484. rows
  485. ----------------------------------------------------------------------------
  486. Name              rows - Macro to loop through an entire array by rows
  487.                   
  488. Usage             macro as follows: 
  489.                   rows(m,r) for (r=0; r<no_rows(m); r++)
  490.  
  491. ----------------------------------------------------------------------------
  492. t
  493. ----------------------------------------------------------------------------
  494. Name              t - Macro to access a dynamic text array token
  495.                                           
  496. Usage             *char t (struct tmat *mtx,unsigned row,unsigned col );
  497.  
  498. ----------------------------------------------------------------------------
  499. tck
  500. ----------------------------------------------------------------------------
  501. Name              tck - Macro to perform a boundary check on a specified set 
  502.                   pair of array indices for a previously declared 
  503.                   dynamic matrix. 
  504.                  
  505. Usage             void tck(struct tmat *mtx,unsigned rw,unsigned cl,unsigned tsz);
  506.  
  507. ----------------------------------------------------------------------------
  508. tdim
  509. ----------------------------------------------------------------------------
  510. Name              tdim - Allocates storage and initializes a dynamic text 
  511.                   array
  512.  
  513. Usage             void tdim ( struct tmat *mtx,unsigned rows,unsigned cols,
  514.                   unsigned toksz );
  515.  
  516. ----------------------------------------------------------------------------
  517. tf
  518. ----------------------------------------------------------------------------
  519. Name              tf - Converts a dynamic text array token to a float value 
  520.                   after verifying the validity of the token as float value
  521.                   
  522. Usage             float tf (struct tmat *mtx,unsigned line,unsigned token,
  523.                   unsigned notoks);
  524.  
  525. ----------------------------------------------------------------------------
  526. ti
  527. ----------------------------------------------------------------------------
  528. Name              ti - Converts a dynamic text array token to an integer 
  529.                   value after verifying the validity of the token as 
  530.                   integer
  531.                   
  532. Usage             float ti ( struct tmat *mtx,unsigned line,unsigned token,
  533.                   unsigned notoks );
  534.  
  535. ----------------------------------------------------------------------------
  536. tmtofm  
  537. ----------------------------------------------------------------------------
  538. Name              tmtofm - Transfers an entire token array into a float 
  539.                   array converting each token to a float value.
  540.                    
  541. Usage             void tmtofm (struct fmat  *mtxf,struct tmat *mtxt);
  542.  
  543. ----------------------------------------------------------------------------
  544. tok_sz 
  545. ----------------------------------------------------------------------------
  546. Name              tok_sz - The number of chars allocated by an tdim 
  547.                   call for tokens in a dynamic test array.  A string 
  548.                   stored in the array must be no larger than (tok_sz - 
  549.                   1) the allocated  space including the null 
  550.                   terminating character. 
  551.                    
  552. Usage             unsigned tok_sz ( struct tmat *mtx );
  553.  
  554. ----------------------------------------------------------------------------
  555. trel
  556. ----------------------------------------------------------------------------
  557. Name              trel - Macro to deallocate storage previously allocated by 
  558.                   a call to tdim.
  559.                  
  560. Usage             void trel(struct tmat *mtx);
  561.  
  562. ----------------------------------------------------------------------------
  563. trecs
  564. ----------------------------------------------------------------------------
  565. Name              trecs - Macro to loop through an entire text array from 
  566.                   the first data row to the last row containing data
  567.                   
  568. Usage             macro as follows: 
  569.                   trecs(mx,rw) for (rw=0; rw<no_recs(mx); r++)
  570.                   
  571. ----------------------------------------------------------------------------
  572. ts
  573. ----------------------------------------------------------------------------
  574. Name              ts - Retrieves a dynamic text array token as a token 
  575.                   after verifying the validity of the token 
  576.                   
  577. Usage             char *ts ( struct tmat *mtx,unsigned line,unsigned token,
  578.                   unsigned notoks );
  579.  
  580. ----------------------------------------------------------------------------
  581. tt
  582. ----------------------------------------------------------------------------
  583. Name              tt - Stores a buffered token in a dynamic text array
  584.                   
  585. Usage             void tt (struct tmat *mtx,unsigned line,unsigned token,
  586.                   char *buffer, unsigned ChPrLn,unsigned FldPrLn);
  587.  
  588.