HarwellBoeing (.rsa, .rua, ...)


    HarwellBoeing matrix format.
    Used for exchanging and storing sparse matrices.
    Plain text format.
    File format of the HarwellBoeing collection of standard test matrices.
    The three-letter file extension encodes matrix properties that are also represented in the file.
    The first letter of the file extension encodes the data type: "r" (real), "c" (complex), or "p" (pattern).
    The second letter denotes the symmetry property: "s" (symmetric), "u" (unsymmetric), "h" (Hermitian), "z" (skew-symmetric), or "r" (rectangular).
    The third letter of the file extension is either "a" (assembled) or "e" (elemental unassembled).
    Stores matrices in a sparse representation.
    Developed in 1992 by Iain Duff, Roger Grimes, and John Lewis.

Import and Export

  • Import["file.rsa"] imports a matrix from a HarwellBoeing file.
  • Export["file.rsa",expr] exports any numerical or pattern matrix to a HarwellBoeing file.
  • Import["file.rsa"] reads a HarwellBoeing file, returning the matrix it represents as a sparse array.
  • Import["file.rsa",elem] imports the specified element from a HarwellBoeing file.
  • Import["file.rsa",{elem,suba,subb,}] imports a subelement.
  • Import["file.rsa",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","HarwellBoeing"] or Import["file",{"HarwellBoeing",elem,}].
  • Export["file.rsa",expr,elem] creates a HarwellBoeing file by treating expr as specifying element elem.
  • Export["file.rsa",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
  • Export["file.rsa",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.rsa",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the HarwellBoeing file format.


  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "Data"matrix data given as a sparse array
    "Graphics"a visual representation of the values of the matrix elements
  • Import uses the "Data" element by default.
  • Import["file.rsa","Graphics"] uses MatrixPlot to render the matrix structure as graphics.
  • Meta-information elements:
  • "Key"document identification string
    "Title"document title
    "MatrixStructure"symmetry properties of the matrix
  • Possible values for "MatrixStructure" are:
  • "Hermitian"matrix which is equal to its own conjugate transpose
    "Rectangular"nonsquare matrix
    "SkewSymmetric"matrix whose transpose is also its negative
    "Symmetric"matrix which is equal to its transpose
    "Unsymmetric"square matrix without transposition symmetry


Basic Examples  (3)

Import a HarwellBoeing matrix file and render it as graphics:

Click for copyable input

Read the same file as a sparse array:

Click for copyable input

Import a sparse matrix and render it as a GraphPlot:

Click for copyable input

This exports a 1-by-2 matrix to the HarwellBoeing format:

Click for copyable input

Import the previous output:

Click for copyable input

See Also

"Graph6"  "Sparse6"  "MTX"

Introduced in 2007