 |
Ginkgo
Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_BASE_MTX_IO_HPP_
6 #define GKO_PUBLIC_CORE_BASE_MTX_IO_HPP_
12 #include <ginkgo/core/base/matrix_data.hpp>
32 template <
typename ValueType = default_precision,
typename IndexType =
int32>
33 matrix_data<ValueType, IndexType>
read_raw(std::istream& is);
67 template <
typename ValueType = default_precision,
typename IndexType =
int32>
86 template <
typename ValueType = default_precision,
typename IndexType =
int32>
119 template <
typename ValueType,
typename IndexType>
120 void write_raw(std::ostream& os,
const matrix_data<ValueType, IndexType>& data,
140 template <
typename ValueType,
typename IndexType>
142 const matrix_data<ValueType, IndexType>& data);
159 template <
typename MatrixType,
typename StreamType,
typename... MatrixArgs>
160 inline std::unique_ptr<MatrixType>
read(StreamType&& is, MatrixArgs&&... args)
162 auto mtx = MatrixType::create(std::forward<MatrixArgs>(args)...);
163 mtx->read(
read_raw<
typename MatrixType::value_type,
164 typename MatrixType::index_type>(is));
183 template <
typename MatrixType,
typename StreamType,
typename... MatrixArgs>
185 MatrixArgs&&... args)
187 auto mtx = MatrixType::create(std::forward<MatrixArgs>(args)...);
189 typename MatrixType::index_type>(is));
209 template <
typename MatrixType,
typename StreamType,
typename... MatrixArgs>
211 MatrixArgs&&... args)
213 auto mtx = MatrixType::create(std::forward<MatrixArgs>(args)...);
215 typename MatrixType::index_type>(is));
223 template <
typename ValueType>
251 template <
typename MatrixType>
252 struct mtx_io_traits {
257 template <
typename ValueType>
258 struct mtx_io_traits<
gko::matrix::Dense<ValueType>> {
264 struct mtx_io_traits<
gko::matrix::Fft> {
270 struct mtx_io_traits<
gko::matrix::Fft2> {
276 struct mtx_io_traits<
gko::matrix::Fft3> {
295 template <
typename MatrixPtrType,
typename StreamType>
297 StreamType&& os, MatrixPtrType&& matrix,
299 std::remove_cv_t<detail::pointee<MatrixPtrType>>>::default_layout)
301 using MatrixType = detail::pointee<MatrixPtrType>;
303 typename MatrixType::index_type>
323 template <
typename MatrixPtrType,
typename StreamType>
326 using MatrixType = detail::pointee<MatrixPtrType>;
328 typename MatrixType::index_type>
338 #endif // GKO_PUBLIC_CORE_BASE_MTX_IO_HPP_
std::unique_ptr< MatrixType > read(StreamType &&is, MatrixArgs &&... args)
Reads a matrix stored in matrix market format from an input stream.
Definition: mtx_io.hpp:160
std::unique_ptr< MatrixType > read_generic(StreamType &&is, MatrixArgs &&... args)
Reads a matrix stored either in binary or matrix market format from an input stream.
Definition: mtx_io.hpp:210
void write_raw(std::ostream &os, const matrix_data< ValueType, IndexType > &data, layout_type layout=layout_type::coordinate)
Writes a matrix_data structure to a stream in matrix market format.
The matrix should be written as dense matrix in column-major order.
matrix_data< ValueType, IndexType > read_raw(std::istream &is)
Reads a matrix stored in matrix market format from an input stream.
matrix_data< ValueType, IndexType > read_generic_raw(std::istream &is)
Reads a matrix stored in either binary or matrix market format from an input stream.
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
This structure is used as an intermediate data type to store a sparse matrix.
Definition: matrix_data.hpp:127
void write(StreamType &&os, MatrixPtrType &&matrix, layout_type layout=detail::mtx_io_traits< std::remove_cv_t< detail::pointee< MatrixPtrType >>>::default_layout)
Writes a matrix into an output stream in matrix market format.
Definition: mtx_io.hpp:296
matrix_data< ValueType, IndexType > read_binary_raw(std::istream &is)
Reads a matrix stored in Ginkgo's binary matrix format from an input stream.
std::unique_ptr< MatrixType > read_binary(StreamType &&is, MatrixArgs &&... args)
Reads a matrix stored in binary format from an input stream.
Definition: mtx_io.hpp:184
void write_binary_raw(std::ostream &os, const matrix_data< ValueType, IndexType > &data)
Writes a matrix_data structure to a stream in binary format.
The matrix should be written as a sparse matrix in coordinate format.
void write_binary(StreamType &&os, MatrixPtrType &&matrix)
Writes a matrix into an output stream in binary format.
Definition: mtx_io.hpp:324
layout_type
Specifies the layout type when writing data in matrix market format.
Definition: mtx_io.hpp:93