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

◆ text_out()

void Matrix::text_out ( buffer & o) const

Definition at line 1316 of file matrix.cpp.

1317{
1318 auto R = get_ring();
1319 int nrows = n_rows();
1320 int ncols = n_cols();
1321
1322 buffer *p = new buffer[nrows];
1323 // buffer *p = new buffer[nrows];
1324 int r;
1325 for (int c = 0; c < ncols; c++)
1326 {
1327 int maxcount = 0;
1328 for (r = 0; r < nrows; r++)
1329 {
1330 ring_elem f = elem(r, c);
1331 R->elem_text_out(p[r], f);
1332 R->remove(f);
1333 if (p[r].size() > maxcount) maxcount = p[r].size();
1334 }
1335 for (r = 0; r < nrows; r++)
1336 for (int k = maxcount + 1 - p[r].size(); k > 0; k--) p[r] << ' ';
1337 }
1338 for (r = 0; r < nrows; r++)
1339 {
1340 p[r] << '\0';
1341 char *s = p[r].str();
1342 o << s << newline;
1343 }
1344 delete[] p;
1345}
const Ring * get_ring() const
Definition matrix.hpp:134
ring_elem elem(int i, int j) const
Definition matrix.cpp:307
int n_cols() const
Definition matrix.hpp:147
int n_rows() const
Definition matrix.hpp:146
int p
void size_t s
Definition m2-mem.cpp:271
char newline[]
Definition m2-types.cpp:49

References elem(), get_ring(), n_cols(), n_rows(), newline, p, s, and text_out().

Referenced by GBKernelComputation::calc(), dmatrix(), IM2_Matrix_to_string(), random(), newf4::GBF4Computation::showInput(), and text_out().