Class SparseMatrixParser
- java.lang.Object
-
- smile.data.parser.SparseMatrixParser
-
public class SparseMatrixParser extends java.lang.ObjectHarwell-Boeing column-compressed sparse matrix file parser. In Harwell-Boeing column-compressed sparse matrix format, nonzero values are stored in an array (top-to-bottom, then left-to-right-bottom). The row indices corresponding to the values are also stored. Besides, a list of pointers are indexes where each column starts. This class supports two formats for Harwell-Boeing files. The simple one is organized as follows:The first line contains three integers, which are the number of rows, the number of columns, and the number of nonzero entries in the matrix.
Following the first line, there are m + 1 integers that are the indices of columns, where m is the number of columns. Then there are n integers that are the row indices of nonzero entries, where n is the number of nonzero entries. Finally, there are n float numbers that are the values of nonzero entries.
The second format is more complicated and powerful, called Harwell-Boeing Exchange Format. For details, see http://people.sc.fsu.edu/~jburkardt/data/hb/hb.html. Note that our implementation supports only real-valued matrix and we ignore the optional right hand side vectors.
-
-
Constructor Summary
Constructors Constructor and Description SparseMatrixParser()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SparseMatrixparse(java.io.File file)Parse a Harwell-Boeing column-compressed sparse matrix dataset from given file.SparseMatrixparse(java.io.InputStream stream)Parse a Harwell-Boeing column-compressed sparse matrix dataset from an input stream.SparseMatrixparse(java.lang.String path)Parse a Harwell-Boeing column-compressed sparse matrix dataset from given file.SparseMatrixparse(java.net.URI uri)Parse a Harwell-Boeing column-compressed sparse matrix dataset from given URI.
-
-
-
Method Detail
-
parse
public SparseMatrix parse(java.net.URI uri) throws java.io.IOException, java.text.ParseException
Parse a Harwell-Boeing column-compressed sparse matrix dataset from given URI.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseMatrix parse(java.lang.String path) throws java.io.IOException, java.text.ParseException
Parse a Harwell-Boeing column-compressed sparse matrix dataset from given file.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseMatrix parse(java.io.File file) throws java.io.IOException, java.text.ParseException
Parse a Harwell-Boeing column-compressed sparse matrix dataset from given file.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseMatrix parse(java.io.InputStream stream) throws java.io.IOException, java.text.ParseException
Parse a Harwell-Boeing column-compressed sparse matrix dataset from an input stream.- Parameters:
stream- the input stream of data.- Throws:
java.io.IOExceptionjava.text.ParseException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG