Macaulay2 Engine
Loading...
Searching...
No Matches
matrix.h File Reference

Engine-boundary C API for constructing, transforming, and inspecting immutable Matrix objects. More...

Go to the source code of this file.

Functions

const MatrixIM2_Matrix_promote (const FreeModule *newTarget, const Matrix *f)
const MatrixIM2_Matrix_lift (int *success_return, const FreeModule *newTarget, const Matrix *f)
const FreeModuleIM2_Matrix_get_target (const Matrix *M)
const FreeModuleIM2_Matrix_get_source (const Matrix *M)
int IM2_Matrix_n_rows (const Matrix *M)
int IM2_Matrix_n_cols (const Matrix *M)
M2_arrayint IM2_Matrix_get_degree (const Matrix *M)
M2_string IM2_Matrix_to_string (const Matrix *M)
unsigned int rawMatrixHash (const Matrix *M)
const RingElementIM2_Matrix_get_entry (const Matrix *M, int r, int c)
engine_RawRingElementArrayArrayOrNull IM2_Matrix_get_entries (const Matrix *M)
const MatrixIM2_Matrix_identity (const FreeModule *F, int preference)
const MatrixIM2_Matrix_zero (const FreeModule *F, const FreeModule *G, int preference)
const MatrixIM2_Matrix_make1 (const FreeModule *target, int ncols, const engine_RawRingElementArray M, int preference)
const MatrixIM2_Matrix_make2 (const FreeModule *target, const FreeModule *source, M2_arrayint deg, const engine_RawRingElementArray M, int preference)
const MatrixIM2_Matrix_make_sparse1 (const FreeModule *target, int ncols, M2_arrayint rows, M2_arrayint cols, const engine_RawRingElementArray entries, int preference)
const MatrixIM2_Matrix_make_sparse2 (const FreeModule *target, const FreeModule *source, M2_arrayint deg, M2_arrayint rows, M2_arrayint cols, const engine_RawRingElementArray entries, int preference)
M2_bool IM2_Matrix_is_implemented_as_dense (const Matrix *M)
const MatrixIM2_Matrix_remake1 (const FreeModule *target, const Matrix *M, int preference)
const MatrixIM2_Matrix_remake2 (const FreeModule *target, const FreeModule *source, M2_arrayint deg, const Matrix *M, int preference)
const MatrixIM2_Matrix_random (const Ring *R, int r, int c, double fraction_non_zero, int special_type, int preference)
const MatrixrawMatrixReadMsolveString (const Ring *R, M2_string contents)
const MatrixrawMatrixReadMsolveFile (const Ring *R, M2_string filename)
M2_bool IM2_Matrix_is_zero (const Matrix *M)
int IM2_Matrix_is_equal (const Matrix *M, const Matrix *N)
M2_bool IM2_Matrix_is_graded (const Matrix *M)
const MatrixIM2_Matrix_concat (const engine_RawMatrixArray Ms)
const MatrixIM2_Matrix_direct_sum (const engine_RawMatrixArray Ms)
const MatrixIM2_Matrix_tensor (const Matrix *M, const Matrix *N)
const MatrixIM2_Matrix_transpose (const Matrix *M)
const MatrixIM2_Matrix_reshape (const Matrix *M, const FreeModule *F, const FreeModule *G)
const MatrixIM2_Matrix_flip (const FreeModule *F, const FreeModule *G)
const MatrixrawWedgeProduct (int p, int q, const FreeModule *F)
const MatrixIM2_Matrix_submatrix (const Matrix *M, M2_arrayint rows, M2_arrayint cols)
const MatrixIM2_Matrix_submatrix1 (const Matrix *M, M2_arrayint cols)
const MatrixIM2_Matrix_koszul (int p, const Matrix *M)
const MatrixrawKoszulMonomials (int nskew, const Matrix *M, const Matrix *N)
const MatrixIM2_Matrix_symm (int p, const Matrix *M)
const MatrixIM2_Matrix_exterior (int p, const Matrix *M, int strategy)
M2_arrayint IM2_Matrix_sort_columns (const Matrix *M, int deg_order, int mon_order)
const MatrixIM2_Matrix_minors (int p, const Matrix *M, int strategy)
const MatrixrawMinors (int p, const Matrix *M, int strategy, int n_minors_to_compute, M2_arrayintOrNull first_row_set, M2_arrayintOrNull first_col_set)
const MatrixIM2_Matrix_pfaffians (int p, const Matrix *M)
const RingElementIM2_Matrix_pfaffian (const Matrix *M)
const MatrixrawMatrixCompress (const Matrix *M)
const MatrixIM2_Matrix_uniquify (const Matrix *M)
const MatrixrawRemoveScalarMultiples (const Matrix *m)
const MatrixrawRemoveMonomialFactors (const Matrix *m, M2_bool make_squarefree_only)
const MatrixrawMatrixContent (const Matrix *M)
const MatrixrawMatrixRemoveContent (const Matrix *M)
const MatrixrawMatrixSplitContent (const Matrix *M, const Matrix **result)
const MatrixIM2_Matrix_remove_content (const Matrix *M)
const MatrixIM2_Matrix_diff (const Matrix *M, const Matrix *N)
const MatrixIM2_Matrix_contract (const Matrix *M, const Matrix *N)
const MatrixIM2_Matrix_homogenize (const Matrix *M, int var, M2_arrayint wts)
const MatrixrawCoefficients (M2_arrayint vars, const Matrix *monoms, const Matrix *M)
const MatrixIM2_Matrix_monomials (M2_arrayint vars, const Matrix *M)
const MatrixIM2_Matrix_initial (int nparts, const Matrix *M)
M2_arrayint IM2_Matrix_elim_vars (int nparts, const Matrix *M)
M2_arrayint IM2_Matrix_keep_vars (int nparts, const Matrix *M)
engine_RawMatrixAndInt IM2_Matrix_divide_by_var (const Matrix *M, int var, int maxdegree)
engine_RawMatrixPairOrNull rawTopCoefficients (const Matrix *M)
M2_arrayintOrNull rawMatrixIndices (const Matrix *f)
M2_arrayint IM2_Matrix_min_leadterms (const Matrix *M, M2_arrayint vars)
const MatrixIM2_Matrix_auto_reduce (const Matrix *M)
const MatrixIM2_Matrix_reduce (const Matrix *M, const Matrix *N)
const MatrixIM2_Matrix_reduce_by_ideal (const Matrix *M, const Matrix *N)
const MatrixrawModuleTensor (const Matrix *M, const Matrix *N)
const MatrixrawBasis (const Matrix *M, M2_arrayint lo_degree, M2_arrayint hi_degree, M2_arrayint wt, M2_arrayint vars, M2_bool do_truncation, int limit)
int IM2_Matrix_dimension (const Matrix *M)

Detailed Description

Engine-boundary C API for constructing, transforming, and inspecting immutable Matrix objects.

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

Declares the extern "C" entry points that span the entire life cycle of the engine's immutable Matrix. Per-function /* drg: connected ... */ trailers name the M2-side binding. Promotion / lifting between coefficient rings: IM2_Matrix_promote / IM2_Matrix_lift (rawPromote / rawLift). Inspection: IM2_Matrix_get_target / _get_source (rawTarget / rawSource), IM2_Matrix_n_rows / _n_cols (rawNumberOfRows / rawNumberOfColumns), IM2_Matrix_get_degree (rawMultiDegree), IM2_Matrix_get_entry (rawMatrixEntry), IM2_Matrix_is_zero / _is_equal / _is_homogeneous (rawIsZero / rawIsEqual / rawIsHomogeneous), plus rawIsDense. Construction: rawIdentity, rawZero, rawMatrix1 / rawMatrix2 (vec-list and ring-element-list variants), rawSparseMatrix1 / rawSparseMatrix2, rawMatrixRemake1 / rawMatrixRemake2, rawRandomConstantMatrix, plus rawMatrixReadMsolveString / rawMatrixReadMsolveFile for ingesting MSolve-format text.

Combinators: rawConcat, rawDirectSum, rawTensor, rawDual, rawReshape, rawFlip, rawWedgeProduct, rawSubmatrix, rawKoszul / rawKoszulMonomials, rawSymmetricPower, rawExteriorPower, rawSortColumns. Determinantal: rawMinors, rawPfaffians. Cleanup / compression: rawMatrixCompress, rawRemoveMonomialFactors, rawRemoveContent. Differential and polynomial-term operations: rawMatrixDiff, rawMatrixContract, rawHomogenize, rawCoefficients, rawMonomials, rawInitial, rawTopCoefficients, rawEliminateVariables, rawKeepVariables, rawDivideByVariable. There are no element-wise add / subtract / multiply bindings in this header — those operations live at the M2 interpreter level.

Matrix is immutable, so every transformation returns a fresh pointer; the implementation in matrix.cpp validates ring and dimension agreement before delegating to MatrixConstructor, and reports failures through the engine error() channel.

See also
matrix.cpp
mutable-matrix.h
engine-includes.hpp

Definition in file matrix.h.