Package org.flag4j.io
Class TensorWriter
java.lang.Object
org.flag4j.io.TensorWriter
The TensorWriter class provides several static methods for writing serialized
tensors, matrices, and vectors to a file.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
toCsv
(String fileName, MatrixMixin<?, ?, ?, ?, ?, ?, ?, ?> src) Writes the specified matrix to a csv file.static boolean
toCsv
(String fileName, MatrixMixin<?, ?, ?, ?, ?, ?, ?, ?> src, String delimiter) Writes the specified matrix to a csv file.static boolean
write
(String fileName, TensorBase<?, ?, ?, ?, ?, ?, ?> src) Writes a tensor to a file using aTensorOutputStream
.
-
Constructor Details
-
TensorWriter
private TensorWriter()
-
-
Method Details
-
write
Writes a tensor to a file using aTensorOutputStream
. If the write operation fails it will terminate but no exception will be thrown. To determine if the write was successful, see the return value: if the write was successful, true is returned; if the write fails,then false is returned. is returned.- Parameters:
fileName
- File name, including extension, of the file to write the serialized matrix to.src
- Source object to write to the specified file.- Returns:
- True if the write was successful. False if the write failed.
-
toCsv
Writes the specified matrix to a csv file.- Parameters:
fileName
- File path to write matrix to.src
- Matrix to write to csv file.delimiter
- Delimiter to use in csv file.- Returns:
- True if the write was successful. False if the write failed.
-
toCsv
Writes the specified matrix to a csv file.- Parameters:
fileName
- File path to write matrix to.src
- Matrix to write to csv file.- Returns:
- True if the write was successful. False if the write failed.
-