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 >
Wrap
Text File
|
1989-12-30
|
28KB
|
588 lines
ABREVIATED USERS MANUAL
The following function description is an example of the function writeups
provided in the users manual. The remaining descriptive writeups are very
brief but do describe the syntax and basic use of each function. Regular
users of this library will find the manual quite helpful.
----------------------------------------------------------------------------
mfput
----------------------------------------------------------------------------
Name mfput - Outputs selected columns from floating point array
in formatted pages with column titles
Usage void mfput ( FILE *FN,struct fmat *mtx,char hdr_lst[],
char sel_lst[], unsigned ChPrLn,unsigned FldPrLn,unsigned
DcPlc);
Prototype in mat_v2b.h
Description This function outputs selected columns of the floating
point array mtx to FN, which has previously been opened
for text write operations (see mfcreat).
hdr_lst[] is a list of abbreviated titles (tokens
delimited by spaces) for each column in mtx. sel_lst[] is
list of matching abbreviated titles for the columns which
are to be output. ChPrLn is the maximum number of
characters per line desired. FldPrLn is the number of
values which are desired on each line, and DcPlc specifies
the number of decimal places desired in the output values.
The columns to be output are selected by performing a
token by token comparison of hdr_lst and sel_lst. If an
abreviated title token from sel_lst matches a title token
in hdr_lst, that column will be output. The selected
columns of mtx are output in tabular form without page
breaks with the abbreviated column titles enclosed in
braces at the beginning of the table.
If the numeric output format is not possible with the
number of decimal places (DcPlc) and fields per line
(FldPrLn) specified the function will generate an error
message and terminate execution.
Return value The value of one is returned on completion.
Source code in fmx1_v2b.c
See also mfpgput,mtput
Example /* matrix
[ 1 2 3 4
4 5 6 7
7 8 9 10 ]
*/
flcreat("DATA.OUT",FN);
mfput(FN,matrix, "COL_A COL_B COL_C COL_D",
"COL_B COL_D",20,2,3);
/* The following output will be directed to FN
{ DATA.OUT 12/1/88 }
{
COL_B COL_D
}
2.000 4.000
5.000 7.000
8.000 10.000
ABREVIATED DESCRIPTIONS
----------------------------------------------------------------------------
all
----------------------------------------------------------------------------
Name all - Macro to loop through an entire array
Usage macro as follows: all(mx,rw,cl)
for (rw=0; rw<no_rows(mx); rw++)
for (cl=0; cl<no_cols(mx); cl++)
----------------------------------------------------------------------------
cols
----------------------------------------------------------------------------
Name cols - Macro to loop through an entire array by columns
Usage macro as follows:
cols(mx,cl) for(cl=0;cl<no_cols(mx);cl++)
----------------------------------------------------------------------------
f
----------------------------------------------------------------------------
Name f - Macro to access a dynamic floating array value
Usage float f ( struct fmat *mtx, unsigned row,
unsigned column );
----------------------------------------------------------------------------
fck
----------------------------------------------------------------------------
Name fck - Macro to perform a boundary check on a specified set
of array indexes for a previosly declared floating
point dynamic matrix.
Usage void fck(struct fmat *mtx, unsigned row, unsigned col);
----------------------------------------------------------------------------
fdim
----------------------------------------------------------------------------
Name fdim - Macro to allocate storage and initialize a dynamic
floating point array
Usage void fdim ( struct fmat *mtx, unsigned rows,
unsigned cols );
----------------------------------------------------------------------------
frel
----------------------------------------------------------------------------
Name frel - Macro to deallocate storage previously allocated by
a call to fdim.
Usage void frel(struct fmat *mtx);
----------------------------------------------------------------------------
flcreat
----------------------------------------------------------------------------
Name flcreat - Opens a text file for write operations then
writes a single line containing the filename and date
enclosed in braces
Usage void flcreat ( char filename[],FILE *FN );
----------------------------------------------------------------------------
ft
----------------------------------------------------------------------------
Name ft - Stores a floating point value in a text array as an
ASCII token string.
Usage void ft (struct tmat *mtx,unsigned line,unsigned token,
float value, unsigned ChPrLn,unsigned FldPrLn,
unsigned DcPlc);
----------------------------------------------------------------------------
it
----------------------------------------------------------------------------
Name it - Stores an integer value in a text array as a
token.
Usage void it (struct tmat *mtx,unsigned line,unsigned token,
unsigned value, unsigned ChPrLn,unsigned FldPrLn);
----------------------------------------------------------------------------
mfcnt
----------------------------------------------------------------------------
Name mfcnt - Returns the number of rows and columns in an ASCII
textfile stored in a format standardized for floating
point arrays.
Usage void mfcnt (char filename[], unsigned *rows,
unsigned *cols );
-----------------------------------------------------------------------------
mfcof
-----------------------------------------------------------------------------
Name mfcof - Returns the cofactor for a dynamic floating point
array element.
Usage float mfcof (struct fmat *mtx,unsigned i, unsigned j);
----------------------------------------------------------------------------
mfcnt
----------------------------------------------------------------------------
Name mfcnt - Returns the number of rows and columns in an ASCII
textfile stored in a format standardized for floating
point arrays.
Usage void mfcnt (char filename[], unsigned *rows,
unsigned *cols );
----------------------------------------------------------------------------
mfcpy
----------------------------------------------------------------------------
Name mfcpy - Copies a dynamic floating point array into another
previously dimensioned dynamic floating array.
Usage void mfcpy (struct fmat *copy_mtx,struct fmat *mtx );
-----------------------------------------------------------------------------
mfcumc
-----------------------------------------------------------------------------
Name mfcumc - Cumulative totals for a dynamic floating point
array column are computed and stored in a second specified
column
Usage void mfcumc (struct fmat *mtx,unsigned col,
unsigned bgn_row, unsigned end_row, unsigned result_col);
-----------------------------------------------------------------------------
mfcumr
-----------------------------------------------------------------------------
Name mfcumr - Cumulative totals for a dynamic floating point
array row are computed and stored in a second specified
row
Usage void mfcumr (struct fmat *mtx,unsigned row,
unsigned bgn_col, unsigned end_col, unsigned
result_row);
-----------------------------------------------------------------------------
mfdet
-----------------------------------------------------------------------------
Name mfdet - The determinant of a dynamic floating point array
is returned
Usage float mfdet (struct fmat *mtx);
----------------------------------------------------------------------------
mfdump
----------------------------------------------------------------------------
Name mfdump - Directs the output of all floating point array
values to the standard output device.
Usage void mfdump ( struct fmat *matrix );
----------------------------------------------------------------------------
mfget
----------------------------------------------------------------------------
Name mfget - Reads an ASCII text file into an existing dynamic
float array. Comments in braces are not retained.
Usage void mfget ( char filename[], struct fmat *mtx );
-----------------------------------------------------------------------------
mfinv
-----------------------------------------------------------------------------
Name mfinv - The invert of a dynamic floating point array is
computed
Usage void mfinv (struct fmat *inv_mat,struct fmat *mtx);
----------------------------------------------------------------------------
mfmlt
----------------------------------------------------------------------------
Name mfmlt - Matrix multiplication
Usage void mfmlt (struct fmat *result_mat,struct fmat
*mat1, struct fmat *mat2);
----------------------------------------------------------------------------
mfmvac
----------------------------------------------------------------------------
Name mfmvac - Moving average of nopds rows of an array column
Usage void mfmvac ( struct fmat *mtx,unsigned nopds,unsigned col,
unsigned bgn_row,unsigned end_row,
unsigned result_col );
----------------------------------------------------------------------------
mfmvar
----------------------------------------------------------------------------
Name mfmvar - Moving average of nopds cols of an array
row.
Usage void mfmvar ( struct fmat *mtx,unsigned
nopds,unsigned row, unsigned bgn_col,unsigned
end_col,unsigned result_row );
----------------------------------------------------------------------------
mfpgput
----------------------------------------------------------------------------
Name mfpgput - Outputs an entire formatted floating point array
to diskfile in a series of pagewidth tables.
Usage void mfpgput ( struct fmat *mtx,char filename[],
unsigned ChPrLn, unsigned FldPrLn, unsigned DcPlc );
----------------------------------------------------------------------------
mfput
----------------------------------------------------------------------------
Name mfput - Outputs selected columns from floating point array
in formatted pages with column titles.
Usage void mfput ( FILE *FN,struct fmat *mtx,
char hdr_lst[], char sel_lst[], unsigned ChPrLn,
unsigned FldPrLn,unsigned DcPlc);
----------------------------------------------------------------------------
mfread
----------------------------------------------------------------------------
Name mfread - Reads a standardized format ASCII textfile into a
previously dimensioned dynamic floating point array.
Usage void mfread ( struct fmat *mtx,char filename[] );
----------------------------------------------------------------------------
mfslv
----------------------------------------------------------------------------
Name mfslv - Solution of simultaneous equations.
Usage void mfslv ( struct fmat *x, struct fmat *A,
struct fmat *C );
----------------------------------------------------------------------------
mfstore
----------------------------------------------------------------------------
Name mfstore - Stores the values of a dynamic floating point
array in a standardized format which can be subsequently
read by mfread.
Usage void mfstore ( char filename[],struct fmat *mtx );
----------------------------------------------------------------------------
mfsumr
----------------------------------------------------------------------------
Name mfsumr - Sum a floating point array row from bgn_col
to end_col
Usage float mfsumc ( struct fmat *mtx,unsigned row,
unsigned bgn_col,unsigned end_col);
----------------------------------------------------------------------------
mfsumc
----------------------------------------------------------------------------
Name mfsumc - Sum a floating point array column from bgn_row
to end_row
Usage float mfsumr (struct fmat *mtx,unsigned col,unsigned
bgn_row, unsigned end_row );
----------------------------------------------------------------------------
mftrnsp
----------------------------------------------------------------------------
Name mftrnsp - Transposes matrix
Usage void trnsp ( struct fmat *trns_mat,mat *mtx );
----------------------------------------------------------------------------
msc
----------------------------------------------------------------------------
Name msc - Writes a string to a previously opened ASCII
textfile centering the string on a single line and
enclosing it in braces
Usage void msc ( FILE *FN,char *text );
----------------------------------------------------------------------------
msl
----------------------------------------------------------------------------
Name msl - Writes a string to a previously opened ASCII
textfile left justifying the string on a single line and
enclosing it in braces
Usage void msl ( FILE *FN,char *text );
----------------------------------------------------------------------------
msr
----------------------------------------------------------------------------
Name msr - Writes a string to a previously opened ASCII
textfile right justifying the string on a single line and
enclosing it in braces
Usage void msr ( FILE *FN,char *text );
----------------------------------------------------------------------------
mst
----------------------------------------------------------------------------
Name mst - Writes a string to a previously opened ASCII
textfile left justifying the string on a single line and
enclosing it in braces and then outputing a specified text
token beyond the second brace.
Usage void mst (FILE *FN,char *label ,char *text_token );
----------------------------------------------------------------------------
msv
----------------------------------------------------------------------------
Name msv - Writes a string to a previously opened ASCII
textfile left justifying the string on a single line and
enclosing it in braces and then outputing a floating point
value beyond the second brace
Usage void msv ( FILE *FN,char *label ,float value );
----------------------------------------------------------------------------
mtapnd
----------------------------------------------------------------------------
Name mtapnd - Add a data line to an existing dynamic text array
Usage void mtapnd ( struct tmat *apnd_mat,
struct tmat *src_mat, unsigned src_row );
----------------------------------------------------------------------------
mtcnt
----------------------------------------------------------------------------
Name mtcnt - Count number of rows, maximum number of tokens per
line, and the maximum token size in an ASCII textfile.
Comments in braces and null string terminating characters
are not counted.
Usage void mtcnt ( char filename[], unsigned *rows,
unsigned *maxtoks,unsigned *maxtoksz );
----------------------------------------------------------------------------
mtcpy
----------------------------------------------------------------------------
Name mtcpy - Copy a dynamic text array to another existing
dynamic text array
Usage void mtcpy (struct tmat *source, struct tmat *destin);
----------------------------------------------------------------------------
mtdump
----------------------------------------------------------------------------
Name mtdump - Direct the output of all text array tokens
to the standard output device.
Usage void mtdump ( struct tmat *matrix );
----------------------------------------------------------------------------
mtget
----------------------------------------------------------------------------
Name mtget - Reads an ASCII text file into an existing dynamic
text array. Comments in braces are not retained.
Usage void mtget ( char filename[],struct tmat *mtx );
----------------------------------------------------------------------------
mtput
----------------------------------------------------------------------------
Name mtput - Outputs selected columns from a dynamic text array
into formatted pages with column titles
Usage void mtput(FILE *FN,struct tmat *mtx,char hdr_lst[],
char sel_lst[], unsigned ChPerLn,unsigned FldPrLn );
----------------------------------------------------------------------------
mtread
----------------------------------------------------------------------------
Name mtread - Reads a standardized formatt ASCII textfile into
a previously dimensioned dynamic text array
Usage void mtread ( char filename[],struct tmat *mtx );
----------------------------------------------------------------------------
mtstore
----------------------------------------------------------------------------
Name mtstore - Stores the tokens of a dynamic text array in a
format which can be subsequently read by mfread
Usage void mtstore ( char filename[],struct tmat *mtx );
----------------------------------------------------------------------------
no_cols
----------------------------------------------------------------------------
Name no_cols - Returns the number of columns allocated by a
fdim or tdim macro call
Usage unsigned no_cols ( struct tmat or struct fmat *mtx );
----------------------------------------------------------------------------
no_recs
----------------------------------------------------------------------------
Name no_recs - The number of rows of token data currently
stored in a dynamic text array.
Usage unsigned no_recs ( struct tmat or struct fmat *mtx );
----------------------------------------------------------------------------
no_rows
----------------------------------------------------------------------------
Name no_rows - The number of rows allocated by a fdim or tdim
macro call
Usage unsigned no_rows ( struct tmat or struct fmat *mtx );
----------------------------------------------------------------------------
rows
----------------------------------------------------------------------------
Name rows - Macro to loop through an entire array by rows
Usage macro as follows:
rows(m,r) for (r=0; r<no_rows(m); r++)
----------------------------------------------------------------------------
t
----------------------------------------------------------------------------
Name t - Macro to access a dynamic text array token
Usage *char t (struct tmat *mtx,unsigned row,unsigned col );
----------------------------------------------------------------------------
tck
----------------------------------------------------------------------------
Name tck - Macro to perform a boundary check on a specified set
pair of array indices for a previously declared
dynamic matrix.
Usage void tck(struct tmat *mtx,unsigned rw,unsigned cl,unsigned tsz);
----------------------------------------------------------------------------
tdim
----------------------------------------------------------------------------
Name tdim - Allocates storage and initializes a dynamic text
array
Usage void tdim ( struct tmat *mtx,unsigned rows,unsigned cols,
unsigned toksz );
----------------------------------------------------------------------------
tf
----------------------------------------------------------------------------
Name tf - Converts a dynamic text array token to a float value
after verifying the validity of the token as float value
Usage float tf (struct tmat *mtx,unsigned line,unsigned token,
unsigned notoks);
----------------------------------------------------------------------------
ti
----------------------------------------------------------------------------
Name ti - Converts a dynamic text array token to an integer
value after verifying the validity of the token as
integer
Usage float ti ( struct tmat *mtx,unsigned line,unsigned token,
unsigned notoks );
----------------------------------------------------------------------------
tmtofm
----------------------------------------------------------------------------
Name tmtofm - Transfers an entire token array into a float
array converting each token to a float value.
Usage void tmtofm (struct fmat *mtxf,struct tmat *mtxt);
----------------------------------------------------------------------------
tok_sz
----------------------------------------------------------------------------
Name tok_sz - The number of chars allocated by an tdim
call for tokens in a dynamic test array. A string
stored in the array must be no larger than (tok_sz -
1) the allocated space including the null
terminating character.
Usage unsigned tok_sz ( struct tmat *mtx );
----------------------------------------------------------------------------
trel
----------------------------------------------------------------------------
Name trel - Macro to deallocate storage previously allocated by
a call to tdim.
Usage void trel(struct tmat *mtx);
----------------------------------------------------------------------------
trecs
----------------------------------------------------------------------------
Name trecs - Macro to loop through an entire text array from
the first data row to the last row containing data
Usage macro as follows:
trecs(mx,rw) for (rw=0; rw<no_recs(mx); r++)
----------------------------------------------------------------------------
ts
----------------------------------------------------------------------------
Name ts - Retrieves a dynamic text array token as a token
after verifying the validity of the token
Usage char *ts ( struct tmat *mtx,unsigned line,unsigned token,
unsigned notoks );
----------------------------------------------------------------------------
tt
----------------------------------------------------------------------------
Name tt - Stores a buffered token in a dynamic text array
Usage void tt (struct tmat *mtx,unsigned line,unsigned token,
char *buffer, unsigned ChPrLn,unsigned FldPrLn);