hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox Chapter Introduction

X04 — input/output utilities

Scope of the Chapter

This chapter contains utility functions concerned with input and output to or from an external file.

Background to the Problems

Output from NAG Toolbox Functions

Output from NAG Toolbox functions to an external file falls into two categories.
(a) Error messages
which are always associated with an error exit from a function, that is, with a nonzero value of ifail as specified in Section 6 of the function document.
(b) Advisory messages
which include output of final results, output of intermediate results to monitor the course of a computation, and various warning or informative messages.
Since the NAG Toolbox is written in Fortran it uses Fortran I/O features. In particular output is directed to an output unit identified by a unique unit number. To allow output to be redirected to files from within Matlab, we provide two functions for connecting and disconnecting a file to and from a Fortran unit: nag_file_open (x04ac) and nag_file_close (x04ad). Fortran unit numbers should be between 1 and 99. The numbers 5 and 6 are reserved for standard input and output respectively.
At present only formatted records are output from the Library. All formatted output to an external file from within the Library is performed by nag_file_line_write (x04ba). Similarly, all formatted input from an external file is performed by nag_file_line_read (x04bb).

Matrix Printing Functions

Functions are provided to allow formatted output of
(a) general matrices stored in a two-dimensional array (real, complex and integer data types);
(b) triangular matrices stored in a packed one-dimensional array (real and complex data types);
(c) band matrices stored in a packed two-dimensional array (real and complex data types).
Functions in (b) and (c) allow printing of matrices stored in formats used in particular by Chapter F07 of the Library.
By appropriate choice of arguments you can specify titles, labels, maximum output record length, and the format of individual matrix elements. All output is directed to the advisory messages unit, which may be altered by a call to nag_file_set_unit_advisory (x04ab).

Recommendations on Choice and Use of Available Functions

Apart from the obvious utility of the matrix printing functions, users of the Library may need to call functions in Chapter X04 for the following purposes.
If the default error message unit is not satisfactory, it may be changed to a new value nerr by the statement
[nerr] = x04aa(int32(1),nerr)
Similarly the advisory message unit may be changed to a new value nadv by the statement
[nadv] = x04ab(int32(1),nadv)
Note that both nag_file_set_unit_error (x04aa) and nag_file_set_unit_advisory (x04ab) use a Fortran SAVE statement to retain the value of the unit number and so neither function is safe to use in a multithreaded environment.

Functionality Index

Accessing external formatted file, 
    reading a record nag_file_line_read (x04bb)
    writing a record nag_file_line_write (x04ba)
Accessing unit number, 
    of advisory message unit nag_file_set_unit_advisory (x04ab)
    of error message unit nag_file_set_unit_error (x04aa)
Connecting an external file nag_file_open (x04ac)
Disconnecting an external file nag_file_close (x04ad)
Printing matrices, 
    comprehensive functions, 
        general complex matrix nag_file_print_matrix_complex_gen_comp (x04db)
        general integer matrix nag_file_print_matrix_integer_comp (x04eb)
        general real matrix nag_file_print_matrix_real_gen_comp (x04cb)
        packed complex band matrix nag_file_print_matrix_complex_band_comp (x04df)
        packed complex triangular matrix nag_file_print_matrix_complex_packed_comp (x04dd)
        packed real band matrix nag_file_print_matrix_real_band_comp (x04cf)
        packed real triangular matrix nag_file_print_matrix_real_packed_comp (x04cd)
    easy-to-use functions, 
        general complex matrix nag_file_print_matrix_complex_gen (x04da)
        general integer matrix nag_file_print_matrix_integer (x04ea)
        general real matrix nag_file_print_matrix_real_gen (x04ca)
        packed complex band matrix nag_file_print_matrix_complex_band (x04de)
        packed complex triangular matrix nag_file_print_matrix_complex_packed (x04dc)
        packed real band matrix nag_file_print_matrix_real_band (x04ce)
        packed real triangular matrix nag_file_print_matrix_real_packed (x04cc)

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015