Macaulay2 Engine
Loading...
Searching...
No Matches

◆ text_out()

void MutableMatrix::text_out ( buffer & o) const

Definition at line 89 of file mat.cpp.

90{
91 const Ring *R = get_ring();
92 size_t nrows = n_rows();
93 size_t ncols = n_cols();
94 buffer *p = new buffer[nrows];
95 size_t r;
96 for (size_t c = 0; c < ncols; c++)
97 {
98 size_t maxcount = 0;
99 for (r = 0; r < nrows; r++)
100 {
101 ring_elem f;
102 get_entry(r, c, f);
103 if (!R->is_zero(f))
104 R->elem_text_out(p[r], f);
105 else
106 p[r] << ".";
107 if (p[r].size() > maxcount) maxcount = p[r].size();
108 }
109 for (r = 0; r < nrows; r++)
110 for (size_t k = maxcount + 1 - p[r].size(); k > 0; k--) p[r] << ' ';
111 }
112 for (r = 0; r < nrows; r++)
113 {
114 p[r] << '\0';
115 char *s = p[r].str();
116 o << s << newline;
117 }
118 delete[] p;
119}
virtual size_t n_rows() const =0
virtual size_t n_cols() const =0
virtual bool get_entry(size_t r, size_t c, ring_elem &result) const =0
virtual const Ring * get_ring() const =0
virtual void elem_text_out(buffer &o, const ring_elem f, bool p_one=true, bool p_plus=false, bool p_parens=false) const =0
virtual bool is_zero(const ring_elem f) const =0
int p
void size_t s
Definition m2-mem.cpp:271
char newline[]
Definition m2-types.cpp:49

References Ring::elem_text_out(), get_entry(), get_ring(), Ring::is_zero(), n_cols(), n_rows(), newline, p, and s.

Referenced by dmutablemat(), IM2_MutableMatrix_to_string(), F4GB::show_matrix(), and F4GB::show_new_rows_matrix().