Input/Output

Back to: Main contents.

At present Jampack's I/O routines are confined to one suite (Print) for displaying quantities on the screen.

Contents

The Print suite

The Print suite

Back to: Main contents, Top of section.

The print suite displays numerical and matrix objects on the screen in a standard format that includes numbering of rows and columns. The format of the output is specified by three integers. The field width specifies the width in characters of the field in which a number is displayed (always right adjusted). The number of places in the fraction tells how many digits are allocated to the fraction in a floating-point number. For example, the number of fraction places in -3.1416e+00 is four. Finally, the page width specifies the maximum number of characters in a line. The default value of these parameters are Parameters.OutputFieldWidth, Parameters.OutputFracPlaces, and Parameters.OutputPageWidth. They can be reset by the method setOutputParameters in the class Parameters. The first two can be overridden by including values for them in the methods below.

The Print methods come in pairs. One that uses the default parameters and one that overrides them. In the following, the variable w refers to the field width, and d refers to the number of characters in the fraction.

public static void o(int k)
public static void o(int k, int w)
Prints an integer.

public static void o(int ia[])
public static void o(int ia[], int w)
Prints an integer array.

public static void o(double a)
public static void o(double a, int w, int d)
Prints a double.

public static void o(double a[])
public static void o(double a[], int w, int d)
Prints a one-dimensional array of doubles.

public static void o(double a[][])
public static void o(double a[][], int w, int d)
Prints a two-dimensional array of doubles.

public static void o(Z a)
public static void o(Z a, int w, int d)
Prints a Z.

public static void o(Z[] a)
public static void o(Z[] a, int w, int d)
Prints a one-dimensional array of Zs.

public static void o(Z[] a)
public static void o(Z[] a, int w, int d)
Prints a one-dimensional array of Zs.

public static void o(Z[][] a)
public static void o(Z[][] a, int w, int d)
Prints a two-dimensional array of Zs.

public static void o(Z1 z)
public static void o(Z1 z, int w, int d)
Prints a Z1.

public static void o(Zmat A)
public static void o(Zmat A, int w, int d)
Prints a Zmat. The method checks to see if A is real, in which case it only prints the real part.