JMSLTM Numerical Library 4.0

com.imsl.math
Class PrintMatrix

java.lang.Object
  extended bycom.imsl.math.PrintMatrix

public class PrintMatrix
extends Object

Matrix printing utilities.

See Also:
Example

Field Summary
static int FULL
          This flag as the argument to setMatrixType, indicates that the full matrix is to be printed.
static int LOWER_TRIANGULAR
          This flag as the argument to setMatrixType, indicates that only the lower triangular elements of the matrix are to be printed.
static int STRICT_LOWER_TRIANGULAR
          This flag as the argument to setMatrixType, indicates that only the strict lower triangular elements of the matrix are to be printed.
static int STRICT_UPPER_TRIANGULAR
          This flag as the argument to setMatrixType, indicates that only the strict upper triangular elements of the matrix are to be printed.
static int UPPER_TRIANGULAR
          This flag as the argument to setMatrixType, indicates that only the upper triangular elements of the matrix are to be printed.
 
Constructor Summary
PrintMatrix()
          Creates an instance of the PrintMatrix class.
PrintMatrix(PrintStream out)
          Creates an instance of the PrintMatrix class with the specified PrintStream.
PrintMatrix(PrintStream out, String title)
          Creates a PrintMatrix object with the specified PrintStream and sets its title.
PrintMatrix(String title)
          Creates a PrintMatrix object and sets its title.
 
Method Summary
 void print(Object array)
          Prints an nRows by nColumns matrix with specified format.
 void print(PrintMatrixFormat pmf, Object array)
          Prints an nRows by nColumns matrix with specified format.
protected  void print(String string)
          Print a string.
 void printHTML(PrintMatrixFormat pmf, Object array, int nRows, int nColumns)
          Prints an nRows by nColumns matrix with specified format for HTML output.
protected  void println()
          Print a newline.
 PrintMatrix setColumnSpacing(int columnSpacing)
          Sets the number of spaces between columns.
 PrintMatrix setEqualColumnWidths(boolean equalColumnWidths)
          Force all of the columns to have the same width.
 PrintMatrix setMatrixType(int matrixType)
          Set matrix type.
 PrintMatrix setPageWidth(int pageWidth)
          Sets the page width.
 PrintMatrix setTitle(String title)
          Sets matrix title
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FULL

public static final int FULL
This flag as the argument to setMatrixType, indicates that the full matrix is to be printed.

See Also:
setMatrixType(int), Constant Field Values

LOWER_TRIANGULAR

public static final int LOWER_TRIANGULAR
This flag as the argument to setMatrixType, indicates that only the lower triangular elements of the matrix are to be printed. The matrix still must be a rectangular matrix.

See Also:
setMatrixType(int), Constant Field Values

STRICT_LOWER_TRIANGULAR

public static final int STRICT_LOWER_TRIANGULAR
This flag as the argument to setMatrixType, indicates that only the strict lower triangular elements of the matrix are to be printed. The matrix still must be a rectangular matrix.

See Also:
setMatrixType(int), Constant Field Values

STRICT_UPPER_TRIANGULAR

public static final int STRICT_UPPER_TRIANGULAR
This flag as the argument to setMatrixType, indicates that only the strict upper triangular elements of the matrix are to be printed. The matrix still must be a rectangular matrix.

See Also:
setMatrixType(int), Constant Field Values

UPPER_TRIANGULAR

public static final int UPPER_TRIANGULAR
This flag as the argument to setMatrixType, indicates that only the upper triangular elements of the matrix are to be printed. The matrix still must be a rectangular matrix.

See Also:
setMatrixType(int), Constant Field Values
Constructor Detail

PrintMatrix

public PrintMatrix()
Creates an instance of the PrintMatrix class.


PrintMatrix

public PrintMatrix(PrintStream out)
Creates an instance of the PrintMatrix class with the specified PrintStream.

Parameters:
out - a PrintStream

PrintMatrix

public PrintMatrix(PrintStream out,
                   String title)
Creates a PrintMatrix object with the specified PrintStream and sets its title.

Parameters:
out - a PrintStream
title - a String specifying the title

PrintMatrix

public PrintMatrix(String title)
Creates a PrintMatrix object and sets its title.

Parameters:
title - a String specifying the title
Method Detail

print

public void print(Object array)
Prints an nRows by nColumns matrix with specified format.

Parameters:
array - a two-dimensional, non-empty, rectangular array

print

public void print(PrintMatrixFormat pmf,
                  Object array)
Prints an nRows by nColumns matrix with specified format.

Parameters:
pmf - a PrintMatrixFormat matrix format
array - a two-dimensional, non-empty, rectangular array

print

protected void print(String string)
Print a string. This function can be overridden to print to something other than a PrintStream.

Parameters:
string - the String to be printed

printHTML

public void printHTML(PrintMatrixFormat pmf,
                      Object array,
                      int nRows,
                      int nColumns)
Prints an nRows by nColumns matrix with specified format for HTML output.

Parameters:
pmf - a PrintMatrixFormat matrix format
nRows - an int specifying the number of rows in the matrix
nColumns - an int specifying the number of columns in the matrix

println

protected void println()
Print a newline. This function can be overridden to print to something other than a PrintStream.


setColumnSpacing

public PrintMatrix setColumnSpacing(int columnSpacing)
Sets the number of spaces between columns. The default value is 2.

Parameters:
columnSpacing - an int specifying the number of spaces between columns, default is 2
Returns:
the PrintMatrix object

setEqualColumnWidths

public PrintMatrix setEqualColumnWidths(boolean equalColumnWidths)
Force all of the columns to have the same width.

Parameters:
equalColumnWidths - a boolean which specifies that all column widths will be equal
Returns:
the PrintMatrix object

setMatrixType

public PrintMatrix setMatrixType(int matrixType)
Set matrix type.

Parameters:
matrixType - int specifying the matrix type. Values for matrixType are:
0FULL
1UPPER_TRIANGULAR
2LOWER_TRIANGULAR
3STRICT_UPPER_TRIANGULAR
4STRICT_LOWER_TRIANGULAR
Returns:
the PrintMatrix object

setPageWidth

public PrintMatrix setPageWidth(int pageWidth)
Sets the page width. The default value is the largest possible integer.

Parameters:
pageWidth - an int specifying the page width, default is the largest possible integer
Returns:
the PrintMatrix object

setTitle

public PrintMatrix setTitle(String title)
Sets matrix title

Parameters:
title - a String specifying the title of the matrix
Returns:
the PrintMatrix object

JMSLTM Numerical Library 4.0

Copyright 1970-2006 Visual Numerics, Inc.
Built June 1 2006.