Macaulay2 Engine
Loading...
Searching...
No Matches
matrix-con.hpp File Reference

MatrixConstructor — the mutable builder that produces an immutable Matrix. More...

#include <vector>
#include "ring.hpp"
#include <utility>

Go to the source code of this file.

Classes

class  MatrixConstructor
 Mutable builder used to assemble an immutable Matrix one column (or one term) at a time. More...

Detailed Description

MatrixConstructor — the mutable builder that produces an immutable Matrix.

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

Declares MatrixConstructor, the builder side of the matrix API (one of Matrix's two friend declarations, alongside FreeModule). It holds the ring, the target and (optionally) source FreeModule*s, and a working VECTOR(vec) of columns, accumulating state with set_entry / set_column / append before handing back a finished immutable Matrix* via to_matrix(). The three constructors mirror the two construction modes: MatrixConstructor(target, ncols) fixes the column count up front, MatrixConstructor(target, source, deg) fixes the source free module too, and the default constructor leaves both unset. The cols_frozen flag enforces the distinction — once cols is supplied or the builder commits, no further modifications that would change the column count are allowed.

Degree bookkeeping rides along: set_column_degree, set_matrix_degree, and compute_column_degrees set the per-column and overall matrix degrees so the produced Matrix carries the same degree data a hand-built one would. matrix-con.hpp exists because Matrix's constructors are private and intentionally immutable; this scratch surface is the only sanctioned way to assemble one.

See also
matrix.hpp
freemod.hpp

Definition in file matrix-con.hpp.