Package libai.io
Class MatrixIO
- java.lang.Object
-
- libai.io.MatrixIO
-
public class MatrixIO extends java.lang.Object
This class implements basic IO functions forMatrix
objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MatrixIO.Target
Serialization target
-
Constructor Summary
Constructors Constructor Description MatrixIO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
write(java.io.OutputStream output, java.util.Map<java.lang.String,Matrix> m)
static void
write(java.io.OutputStream output, java.util.Map<java.lang.String,Matrix> m, MatrixIO.Target t)
Writes a set ofMatrix
objects to a givenOutputStream
.
Note: When saving toMatrixIO.Target.CSV
andMatrixIO.Target.TSV
, a line separator \n will be inserted between matrices Note 2: Since Java doesn't support deserializing multiple objects from the sameOutputStream
if target isMatrixIO.Target.SERIAL
then the wholeMap
will be serialized.static void
write(java.io.OutputStream output, Matrix m)
static void
write(java.io.OutputStream output, Matrix m, MatrixIO.Target t)
Writes aMatrix
object to a givenOutputStream
.
Note: if the target isMatrixIO.Target.OCTAVE
then the default variable name will be'a'
.
-
-
-
Method Detail
-
write
public static void write(java.io.OutputStream output, Matrix m) throws java.lang.IllegalArgumentException, java.io.IOException
- Throws:
java.lang.IllegalArgumentException
java.io.IOException
-
write
public static void write(java.io.OutputStream output, Matrix m, MatrixIO.Target t) throws java.lang.IllegalArgumentException, java.io.IOException
Writes aMatrix
object to a givenOutputStream
.
Note: if the target isMatrixIO.Target.OCTAVE
then the default variable name will be'a'
.- Parameters:
output
- TheOutputStream
in which to save thisMatrix
objectm
- TheMatrix
object to writet
-MatrixIO.Target
ed format, the default value (ifnull
) isMatrixIO.Target.SERIAL
- Throws:
java.lang.IllegalArgumentException
- if eitheroutput
orm
arenull
java.io.IOException
- if an I/O error occurs
-
write
public static void write(java.io.OutputStream output, java.util.Map<java.lang.String,Matrix> m) throws java.lang.IllegalArgumentException, java.io.IOException
- Throws:
java.lang.IllegalArgumentException
java.io.IOException
-
write
public static void write(java.io.OutputStream output, java.util.Map<java.lang.String,Matrix> m, MatrixIO.Target t) throws java.lang.IllegalArgumentException, java.io.IOException
Writes a set ofMatrix
objects to a givenOutputStream
.
Note: When saving toMatrixIO.Target.CSV
andMatrixIO.Target.TSV
, a line separator \n will be inserted between matrices Note 2: Since Java doesn't support deserializing multiple objects from the sameOutputStream
if target isMatrixIO.Target.SERIAL
then the wholeMap
will be serialized.- Parameters:
output
- TheOutputStream
in which to write theMatrix
objectsm
- aMap
where the keys are matrix names, if the target is anything butMatrixIO.Target.OCTAVE
the name will be ignoredt
-MatrixIO.Target
ed format, the default value (ifnull
) isMatrixIO.Target.SERIAL
- Throws:
java.lang.IllegalArgumentException
- if eitheroutput
orm
arenull
java.io.IOException
- if an I/O error occurs
-
-