MODULE Print_Procedures¶
Module Print_Procedures exports constants and routines for printing vectors, matrices and results from other STATPACK routines.
Here is the list of the public constants exported by module Print_Procedures:
!
! DEFAULT VALUES FOR PRINTING.
!
integer(i4b), parameter :: defline = 80 , & ! DEFAULT LINE SIZE
defindent = 0 , & ! DEFAULT INDENTATION
defw = 12 , & ! DEFAULT WIDTH FOR EDIT DESCRIPTOR
defd = 6 , & ! DEFAULT NUMBER OF SIGNIFICANT DIGITS
defs = 3 ! DEFAULT NUMBER OF SPACES BETWEEN ENTRIES
In order to use one of these constants or one of the routines listed below, you must include an appropriate use Print_Procedures
or use Statpack
statement in your Fortran program, like:
use Print_Procedures, only: defline
or :
use Statpack, only: defline
Here is the list of the public routines exported by module Print_Procedures:
-
enter_proc
()¶
purpose:
Upon entering a procedure, enter_proc() can be called. It would skips two lines and outputs a message that the routine, identified by the string argument STRING, was entered. If the optional argument LEVEL is present, the message STRING is prepended by LEVEL blanks.
Synopsis:
call enter_proc( string , level=level , prt_unit=prt_unit )
-
leave_proc
()¶
purpose:
leave_proc() is the opposite of routine enter_proc()
. It should be called
just before leaving a routine. The exit message STRING is output on the unit PRT_UNIT (or the default unit
defunit
defined in the Select_Parameters module if PRT_UNIT is absent)
and two lines are skipped.
Optionally, the output message STRING is prepended by LEVEL blanks.
Synopsis:
call leave_proc( string , level=level , prt_unit=prt_unit )
-
entering
()¶
purpose:
Upon entering a procedure, entering() can be called.
It will return a prefix string suitable for indenting
output lines from the procedure. It takes the given character argument STRING
and prepends LEVEL blanks, followed by a [
, and appends
the character ]
.
For example, if string = "hi"
and level = 7
,
it would return _______[hi]
. LEVEL is then also
incremented by 2
.
Trailing blanks in STRING are removed.
If the PRT_UNIT argument is absent, then all output is on the unit defunit
defined in the
Select_Parameters module.
If the argument TRACE is true
, it also outputs a message that the
routine identified by STRING was entered.
Synopsis:
message = entering( string , level , trace , prt_unit=prt_unit )
-
leaving
()¶
purpose:
leaving() is the opposite to entering
. It should be called
just before leaving a routine. The argument LEVEL is reduced by
2
and if the argument TRACE is true
, an exit message is output.
Trailing blanks in STRING are removed.
If the PRT_UNIT argument is absent, then all output is on the unit defunit
defined in the
Select_Parameters module.
Synopsis:
call leaving( string , level , trace , prt_unit=prt_unit )
-
indent
()¶
purpose:
indent() can also used to indent output, albeit in a manner
different from entering
and leaving
.
It simply writes out LEVEL blanks followed by the string ID in []
, and
leaves the output file marker where it is. It uses nonadvancing output.
If the LEVEL argument is not present, just the ID part is output; i.e. LEVEL is treated as zero.
Leading and trailing blanks in ID are removed.
If the PRT_UNIT argument is absent, then all output is on the unit defunit
defined in the
Select_Parameters module.
Synopsis:
call indent(id , level=level , prt_unit=prt_unit )
-
write_array
()¶
purpose:
write_array() prints out an integer or real array X (e.g. a vector or matrix) with a given format and a title, as given in its input arguments.
The integer or real array X is printed row by row.
If the PRT_UNIT argument is absent, then all output is on the unit defunit
defined in the
Select_Parameters module.
Synopsis:
call write_array( x(:), f=f , w=w , d=d , s=s , name=name , indent=indent , line=line , prt_unit=prt_unit ) ! x is a real array call write_array( x(:,:), f=f , w=w , d=d , s=s , name=name , indent=indent , line=line , prt_unit=prt_unit ) ! x is a real array call write_array( x(:), w=w , s=s , name=name , indent=indent , line=line , prt_unit=prt_unit ) ! x is an integer array call write_array( x(:,:), w=w , s=s , name=name , indent=indent , line=line , prt_unit=prt_unit ) ! x is an integer array
-
print_array
()¶
purpose:
print_array() is a routine for labeled integer or real matrix/vector output, with given format and title, as given in its input arguments.
The integer or real array is printed columns block by columns block.
If the PRT_UNIT argument is absent, then all output is on the unit defunit
defined in the
Select_Parameters module.
Synopsis:
call print_array( x(:p), f=f , w=w , d=d , sign_ed=sign_ed , title=title , namlig=namlig(:p) , indent=indent , prt_unit=prt_unit ) ! x is a real array call print_array( x(:p,:n) , f=f , w=w , d=d , sign_ed=sign_ed , s=s , title=title , namlig=namlig(:p) , namcol=namcol(:n) , indent=indent , line=line , prt_unit=prt_unit ) ! x is a real array call print_array( x(:), w=w , sign_ed=sign_ed , title=title , namlig=namlig(:p) , indent=indent , prt_unit=prt_unit ) ! x is an integer array call print_array( x(:p,:n) , w=w , sign_ed=sign_ed , s=s , title=title , namlig=namlig(:p) , namcol=namcol(:n) , indent=indent , line=line , prt_unit=prt_unit ) ! x is an integer array
Examples:
-
print_prinfac
()¶
purpose:
print_prinfac() is a routine for labeled matrix output after an EOF or SVD analysis.
Print an EOF model (MODE = 1
) or the associated principal components (MODE = 2
) and
an SVD model (MODE = 3
) or the associated singular variables (MODE = 4
).
If the PRT_UNIT argument is absent, then all output is on the unit defunit
defined in the
Select_Parameters module.
Synopsis:
call print_prinfac( mode, a(:p) , f=f , names=names(:p) , prt_unit=prt_unit ) call print_prinfac( mode, a(:p,:n) , f=f , names=names(:p) , line=line , prt_unit=prt_unit )
-
print_stat
()¶
purpose:
print_stat() prints statistics for an EOF “missing” or “weighted” analysis, for
- Variables (MODE =
1
) - Observations (MODE =
2
)
If the PRT_UNIT argument is absent, then all output is on the unit defunit
defined in the
Select_Parameters module.
Synopsis:
call print_stat( mode , nomiss(:p) , var(:p) , inr(:p) , qlt(:p) , names(:p) , prt_unit=prt_unit ) call print_stat ( mode , weight(:p) , var(:p) , inr(:p) , qlt(:p) , names(:p) , prt_unit=prt_unit )