2 #ifndef vnl_io_matrix_hxx_ 3 #define vnl_io_matrix_hxx_ 9 #include <vsl/vsl_b_read_block_old.h> 10 #include <vsl/vsl_block_binary.h> 11 #include <vsl/vsl_indent.h> 18 constexpr
short version_no = 2;
25 vsl_block_binary_write(os, p.
begin(), p.
size());
46 vsl_b_read_block_old(is, p.
begin(), p.
size());
59 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vnl_matrix<T>&)\n" 60 <<
" Unknown version number "<<
v <<
'\n';
61 is.is().clear(std::ios::badbit);
71 os<<
"Size: "<<p.
rows()<<
" x "<<p.
cols()<<std::endl;
73 unsigned int m = 5;
unsigned int n = 5;
80 for (
unsigned int i=0;i<
m;i++)
82 os<<vsl_indent()<<
" (";
84 for (
unsigned int j=0; j<n; j++)
86 if (p.
cols()>n) os<<
"...";
89 if (p.
rows()>
m) os <<vsl_indent()<<
" (...\n";
94 #define VNL_IO_MATRIX_INSTANTIATE(T) \ 95 template VNL_EXPORT void vsl_print_summary(std::ostream &, const vnl_matrix<T > &); \ 96 template VNL_EXPORT void vsl_b_read(vsl_b_istream &, vnl_matrix<T > &); \ 97 template VNL_EXPORT void vsl_b_write(vsl_b_ostream &, const vnl_matrix<T > &) 99 #endif // vnl_io_matrix_hxx_ unsigned int cols() const
Return the number of columns.
void vsl_print_summary(std::ostream &os, vnl_bignum const &b)
Print human readable summary of object to a stream.
An ordinary mathematical matrix.
iterator begin()
Iterator pointing to start of data.
void vsl_b_read(vsl_b_istream &is, vnl_bignum &v)
Binary load vnl_bignum from stream.
void vsl_b_write(vsl_b_ostream &os, vnl_bignum const &v)
Binary save vnl_bignum to stream.
An ordinary mathematical matrix.
T const * data_block() const
Access the contiguous block storing the elements in the matrix row-wise. O(1).
unsigned int size() const
Return the total number of elements stored by the matrix.
unsigned int rows() const
Return the number of rows.
bool set_size(unsigned r, unsigned c)
Resize to r rows by c columns. Old data lost.