Macaulay2 Engine
Loading...
Searching...
No Matches
matrix-symm.cpp File Reference

SymmMatrix — compute the p-th symmetric power of a one-row Matrix. More...

#include "matrix.hpp"
#include "matrix-con.hpp"

Go to the source code of this file.

Classes

class  SymmMatrix
 Helper that builds the p-th symmetric power of a 1-by-n matrix. More...

Detailed Description

SymmMatrix — compute the p-th symmetric power of a one-row Matrix.

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

Implements SymmMatrix, a file-local class whose only public surface is the static factory SymmMatrix::symmetricPower(m0, p). The factory checks m0->n_rows() == 1 (the engine entry insists on a single row; the ERROR("expected one row") branch returns nullptr otherwise), constructs a transient SymmMatrix instance, and returns the result of its value() accessor. The recursive instance method symm1(f, lastn, pow) walks multi-index tuples in lex order: each level loops i from lastn to ncols-1 and recurses with (i, pow-1) — the key detail being that the next level starts at i, not i + 1, so variables can repeat. This enumerates all binomial(n + p - 1, p) symmetric monomials of degree p (the m_{i_1} ... m_{i_p} products with 1 <= i_1 <= ... <= i_p <= n), filling them into a MatrixConstructor whose target and source free modules are built via m0->rows()->symm(p) and m0->cols()->symm(p) with the appropriate degree shift. The top-level Matrix::symm(int n) (defined at the bottom) is the actual external entry point and just forwards to SymmMatrix::symmetricPower.

The multi-set enumeration parallels the subset-encoding machinery in comb.hpp's Subsets, but is hand-rolled here rather than going through that helper.

See also
matrix.hpp
matrix-con.hpp
comb.hpp

Definition in file matrix-symm.cpp.