Macaulay2 Engine
Loading...
Searching...
No Matches
ringmap.hpp
Go to the documentation of this file.
1// Copyright 1996 Michael E. Stillman
2#ifndef _ringmap_hh_
3#define _ringmap_hh_
4
38
39#include "ring.hpp"
40
41class RingElement;
42class Matrix;
43
59class RingMap : public EngineObject
60{
72 struct var : public our_new_delete
73 {
74 bool is_zero; // Does this variable map to 0?
75
79
80 ring_elem coeff; // this variable maps to coeff*monom*bigelem
81 // where coeff is 1 if isone is true.
82 // and monom is 1 if mon_isone is true,
83 // and bigelem is 1 if bigone_isone is true.
84 // coeff is an element of type K.
85 int *monom; // This is an exponent vector in R.
87 };
88
89 const Ring *R; // This is the target ring.
90
91 const PolynomialRing *P; // P is either R (if it is a poly ring) or 0, ifnot
92 const Ring *K; // K is either coeffs of P, or R (if P==0).
93 const Monoid *M;
94
95 bool is_monomial; // True, if each term maps to a term in the
96 // target ring.
97
98 int nvars; // Number of variables in the source ring.
99 var *_elem; // elem[i] is the structure representing the image of
100 // the i th variable.
101 RingMap(const Matrix *m);
102
103 protected:
104 virtual unsigned int computeHashValue() const;
105
106 public:
107 ~RingMap();
108
109 static const RingMap *make(const Matrix *m);
110
111 const Ring *get_ring() const { return R; }
112 bool is_equal(const RingMap *phi) const;
113
114 const ring_elem elem(int i) const
115 {
116 assert(i >= 0);
117 assert(i < nvars);
118 return _elem[i].bigelem;
119 }
120
121 ring_elem eval_term(const Ring *coeff_ring,
122 const ring_elem coeff,
123 const int *vp,
124 int first_var,
125 int nvars_in_source) const;
126
127 RingElement /* or null */ *eval(const RingElement *r) const;
128 Matrix /* or null */ *eval(const FreeModule *newrows, const Matrix *m) const;
129
130 void text_out(buffer &o) const;
131};
132
133#endif
134
135// Local Variables:
136// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
137// indent-tabs-mode: nil
138// End:
EngineObject()
Definition hash.hpp:66
Engine-side free module R^n over a Ring.
Definition freemod.hpp:66
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
Definition monoid.hpp:89
Abstract base for the engine's polynomial-ring hierarchy.
Definition polyring.hpp:96
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
Definition relem.hpp:67
xxx xxx xxx
Definition ring.hpp:102
RingMap(const Matrix *m)
Definition ringmap.cpp:10
~RingMap()
Definition ringmap.cpp:88
const ring_elem elem(int i) const
Definition ringmap.hpp:114
const Monoid * M
Definition ringmap.hpp:93
bool is_equal(const RingMap *phi) const
Definition ringmap.cpp:111
const Ring * R
Definition ringmap.hpp:89
const Ring * K
Definition ringmap.hpp:92
bool is_monomial
Definition ringmap.hpp:95
virtual unsigned int computeHashValue() const
Definition ringmap.cpp:101
const Ring * get_ring() const
Definition ringmap.hpp:111
const PolynomialRing * P
Definition ringmap.hpp:91
int nvars
Definition ringmap.hpp:98
var * _elem
Definition ringmap.hpp:99
void text_out(buffer &o) const
Definition ringmap.cpp:129
static const RingMap * make(const Matrix *m)
Definition ringmap.cpp:123
RingElement * eval(const RingElement *r) const
Definition ringmap.cpp:238
ring_elem eval_term(const Ring *coeff_ring, const ring_elem coeff, const int *vp, int first_var, int nvars_in_source) const
Definition ringmap.cpp:140
Engine-side ring homomorphism: stores, for each source-ring variable, the target-ring element it maps...
Definition ringmap.hpp:60
#define Matrix
Definition factory.cpp:14
Ring — the legacy abstract base class for every coefficient and polynomial ring.
ring_elem bigelem
Definition ringmap.hpp:86
bool bigelem_is_one
Definition ringmap.hpp:78
int * monom
Definition ringmap.hpp:85
bool coeff_is_one
Definition ringmap.hpp:76
ring_elem coeff
Definition ringmap.hpp:80
bool monom_is_one
Definition ringmap.hpp:77
Per-source-variable image record: a factored representation of the target-ring element that variable ...
Definition ringmap.hpp:73