Macaulay2 Engine
Loading...
Searching...
No Matches
mat-util.hpp File Reference

Generic helpers (displayMat, concatenateMatrices) for DMat / SMat matrices. More...

#include <assert.h>
#include "buffer.hpp"
#include "text-io.hpp"

Go to the source code of this file.

Functions

template<typename Mat>
void displayMat (buffer &o, const Mat &A)
template<typename Mat>
void displayMat (const Mat &A)
template<typename Mat>
static void concatenateMatrices (const Mat &A, const Mat &B, Mat &C)

Detailed Description

Generic helpers (displayMat, concatenateMatrices) for DMat / SMat matrices.

Note
AI-generated documentation. Verify against the source before relying on it.

Collects the templated utilities that do not fit naturally into mat-arith.hpp, mat-elem-ops.hpp, or mat-linalg.hpp. displayMat<Mat>(buffer& o, const Mat& A) walks any duck-typed Mat exposing ElementType, ring(), numRows(), numColumns(), and entry(r, c), builds one per-row sub-buffer, pads each column to the widest entry, marks zero entries with ., and emits the assembled rows through the buffer followed by newline. The one-argument overload displayMat(A) wraps the same routine and flushes via emit from text-io.hpp. Both DMat<R> and SMat<R> satisfy the contract.

The companion concatenateMatrices<Mat>(A, B, C) writes the horizontal join [A | B] into a caller-supplied C (after resizing it to A.numRows() x (A.numColumns() + B.numColumns())), asserting that A and B have the same row count.

See also
buffer.hpp
text-io.hpp
dmat.hpp
smat.hpp

Definition in file mat-util.hpp.