|
Ginkgo
Generated from pipelines/1589998975 branch based on develop. Ginkgo version 1.10.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_
11 #include <ginkgo/core/base/matrix_data.hpp>
31 template <
typename ValueType = default_precision,
typename IndexType =
int32>
32 matrix_data<ValueType, IndexType>
read_raw(std::istream& is);
66 template <
typename ValueType = default_precision,
typename IndexType =
int32>
85 template <
typename ValueType = default_precision,
typename IndexType =
int32>
118 template <
typename ValueType,
typename IndexType>
119 void write_raw(std::ostream& os,
const matrix_data<ValueType, IndexType>& data,
139 template <
typename ValueType,
typename IndexType>
141 const matrix_data<ValueType, IndexType>& data);
158 template <
typename MatrixType,
typename StreamType,
typename... MatrixArgs>
159 inline std::unique_ptr<MatrixType>
read(StreamType&& is, MatrixArgs&&... args)
161 auto mtx = MatrixType::create(std::forward<MatrixArgs>(args)...);
162 mtx->read(
read_raw<
typename MatrixType::value_type,
163 typename MatrixType::index_type>(is));
182 template <
typename MatrixType,
typename StreamType,
typename... MatrixArgs>
184 MatrixArgs&&... args)
186 auto mtx = MatrixType::create(std::forward<MatrixArgs>(args)...);
188 typename MatrixType::index_type>(is));
208 template <
typename MatrixType,
typename StreamType,
typename... MatrixArgs>
210 MatrixArgs&&... args)
212 auto mtx = MatrixType::create(std::forward<MatrixArgs>(args)...);
214 typename MatrixType::index_type>(is));
222 template <
typename ValueType>
250 template <
typename MatrixType>
251 struct mtx_io_traits {
256 template <
typename ValueType>
257 struct mtx_io_traits<
gko::matrix::Dense<ValueType>> {
263 struct mtx_io_traits<
gko::matrix::Fft> {
269 struct mtx_io_traits<
gko::matrix::Fft2> {
275 struct mtx_io_traits<
gko::matrix::Fft3> {
294 template <
typename MatrixPtrType,
typename StreamType>
296 StreamType&& os, MatrixPtrType&& matrix,
298 std::remove_cv_t<detail::pointee<MatrixPtrType>>>::default_layout)
300 using MatrixType = detail::pointee<MatrixPtrType>;
302 typename MatrixType::index_type>
322 template <
typename MatrixPtrType,
typename StreamType>
325 using MatrixType = detail::pointee<MatrixPtrType>;
327 typename MatrixType::index_type>
337 #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:159
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:209
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:126
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:295
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:183
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:323
layout_type
Specifies the layout type when writing data in matrix market format.
Definition: mtx_io.hpp:92