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

Templated matrix arithmetic for DMat<R> / SMat<R> plus the MatrixWindow / SubMatrix view types. More...

#include "dmat.hpp"
#include "smat.hpp"

Go to the source code of this file.

Classes

struct  MatrixWindow
 Half-open rectangular submatrix descriptor: [begin_row, end_row) x [begin_column, end_column). More...
struct  SubMatrix< MatType >

Namespaces

namespace  MatrixOps

Functions

template<typename MatType>
void normSquared (SubMatrix< MatType > M, typename MatType::CoeffRing::RealElementType &result)
template<typename MatType>
SubMatrix< MatType > submatrix (MatType &m)
template<typename MatType>
SubMatrix< MatType > submatrix (MatType &m, long x, long y, long nrows, long ncols)
template<typename RT>
bool MatrixOps::isZero (const DMat< RT > &A)
template<typename RT>
bool MatrixOps::isEqual (const DMat< RT > &A, const DMat< RT > &B)
template<typename RT>
void MatrixOps::scalarMultInPlace (DMat< RT > &A, const typename RT::ElementType &f)
template<typename RT>
void MatrixOps::negateInPlace (DMat< RT > &A)
template<typename RT>
void MatrixOps::addInPlace (DMat< RT > &A, const DMat< RT > &B)
template<typename RT>
void MatrixOps::subtractInPlace (DMat< RT > &A, const DMat< RT > &B)
template<typename RT>
void MatrixOps::transpose (const DMat< RT > &A, DMat< RT > &result)
template<typename RT>
void MatrixOps::setZero (DMat< RT > &A, MatrixWindow wA)
template<typename MatType>
void MatrixOps::setZero (SubMatrix< MatType > A)
template<typename RT>
void MatrixOps::set (DMat< RT > &A, MatrixWindow wA, const DMat< RT > &B, MatrixWindow wB)
template<typename RT>
void MatrixOps::addTo (DMat< RT > &A, MatrixWindow wA, const DMat< RT > &B, MatrixWindow wB)
template<typename RT>
void MatrixOps::addMultipleTo (DMat< RT > &A, MatrixWindow wA, const typename RT::ElementType &c, const DMat< RT > &B, MatrixWindow wB)
template<typename RT>
void MatrixOps::scalarMult (DMat< RT > &A, MatrixWindow wA, const typename RT::ElementType &c, const DMat< RT > &B, MatrixWindow wB)
template<typename RT>
void MatrixOps::scalarMultInPlace (DMat< RT > &A, MatrixWindow wA, const typename RT::ElementType &c)
template<typename RT>
bool MatrixOps::isZero (const SMat< RT > &A)
template<typename RT>
bool MatrixOps::isEqual (const SMat< RT > &A, const SMat< RT > &B)
template<typename RT>
void MatrixOps::scalarMultInPlace (SMat< RT > &A, const typename RT::ElementType &f)
template<typename RT>
void MatrixOps::negateInPlace (SMat< RT > &A)
template<typename RT>
void MatrixOps::addInPlace (SMat< RT > &A, const SMat< RT > &B)
template<typename RT>
void MatrixOps::subtractInPlace (SMat< RT > &A, const SMat< RT > &B)
template<typename RT>
void MatrixOps::transpose (const SMat< RT > &A, SMat< RT > &result)

Detailed Description

Templated matrix arithmetic for DMat<R> / SMat<R> plus the MatrixWindow / SubMatrix view types.

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

Declares free-function templates over DMat<RT> (and where applicable SubMatrix<MatType>): predicates (isZero, isEqual), in-place ops (negateInPlace, addInPlace, subtractInPlace, scalarMultInPlace), out-of-place ops (transpose, scalarMult), windowed forms (setZero, set, addTo, addMultipleTo), and the normSquared accumulator. Forward-declares MatElementaryOps<MT> whose definition lives in mat-elem-ops.hpp. The companion MatrixWindow struct stores (begin_row, begin_column, end_row, end_column) as a half-open view, and the templated SubMatrix<MatType> carries the same half-open window together with a reference to the underlying matrix plus operator overloads (=, +=, *=, addMultipleTo) so callers can compose submatrix updates without copying storage; this is how the LU paths walk trailing sub-matrices.

Concrete implementations dispatch through the templated specialisations in mat-linalg.hpp so each (operation, RingType) pair lands on the best back end — FLINT / FFLAS-FFPACK / BLAS where they help, generic per-element loops otherwise.

See also
mat-linalg.hpp
mat-elem-ops.hpp
dmat.hpp
smat.hpp

Definition in file mat-arith.hpp.