Package com.imsl.math

Class PrintMatrix

java.lang.Object
com.imsl.math.PrintMatrix

public class PrintMatrix extends Object
Matrix printing utilities.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    This flag as the argument to setMatrixType, indicates that the full matrix is to be printed.
    static final int
    This flag as the argument to setMatrixType, indicates that only the lower triangular elements of the matrix are to be printed.
    static final int
    This flag as the argument to setMatrixType, indicates that only the strict lower triangular elements of the matrix are to be printed.
    static final int
    This flag as the argument to setMatrixType, indicates that only the strict upper triangular elements of the matrix are to be printed.
    static final int
    This flag as the argument to setMatrixType, indicates that only the upper triangular elements of the matrix are to be printed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of the PrintMatrix class.
    Creates an instance of the PrintMatrix class with the specified PrintStream.
    Creates a PrintMatrix object with the specified PrintStream and sets its title.
    Creates a PrintMatrix object and sets its title.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Prints a matrix with specified format.
    void
    print(Object array)
    Prints a matrix with a default 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
    Print a newline.
    setColumnSpacing(int columnSpacing)
    Sets the number of spaces between columns.
    setEqualColumnWidths(boolean equalColumnWidths)
    Force all of the columns to have the same width.
    setMatrixType(int matrixType)
    Set matrix type.
    setPageWidth(int pageWidth)
    Sets the page width.
    Sets matrix title

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FULL

      public static final int FULL
      This flag as the argument to setMatrixType, indicates that the full matrix is to be printed.
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
  • Constructor Details

    • 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(String title)
      Creates a PrintMatrix object and sets its title.
      Parameters:
      title - a String specifying the title
    • 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
  • Method Details

    • setTitle

      public PrintMatrix setTitle(String title)
      Sets matrix title
      Parameters:
      title - a String specifying the title of the matrix
      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
    • 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
    • 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
    • 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
    • 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
    • println

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

      public void print(Object array)
      Prints a matrix with a default format.
      Parameters:
      array - a two-dimensional, non-empty, rectangular array
    • print

      public void print(PrintMatrixFormat pmf, Object array)
      Prints a matrix with specified format.
      Parameters:
      pmf - a PrintMatrixFormat matrix format
      array - a two-dimensional, non-empty, rectangular array
    • 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