Functions which change internal repr but not the semantics #2014
Replies: 5 comments 1 reply
-
It can happen that the "simplified" form is a large/uglier data-structure; but at least in the case that |
Beta Was this translation helpful? Give feedback.
-
On Tue, Mar 07, 2023 at 07:28:47AM -0800, JohnAAbbott wrote:
The convention in Julia/Oscar is that functions which (may) change at least one argument have names ending in !
We interpret this for mathematical changes, i.e. an element in a residue
ring might be reduced to a unique rep without an "!"
… Here is a simplified excerpt from my revision of PBFAlgebraQuo
```
function iszero(a::PBWAlgQuoElem)
# why not call simplify! here?
I = parent(a).I
groebner_assure!(I)
return iszero(Singular.reduce(a.data.sdata, I.gb))
end
```
Internally the function must reduce `a` modulo the ideal `I` and check whether the result is 0.
Now, in this context `a` and `a mod I` are semantically equivalent (but their representations may
differ). The function `simplify!` does the reduction, and then updates its argument.
May the function `iszero` silently update its argument to a "reduced" but equivalent value?
This could be a problem if `iszero(a)` is called while the caller has a reference to part of the
internal structure of `a`.
--
Reply to this email directly or view it on GitHub:
#2014
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I think @wdecker explained to me a while ago that this should be
I think |
Beta Was this translation helpful? Give feedback.
-
In MPolyQuo, the simplify! function for arguments of type
If f is an element of the quotient of a multivariate polynomial ring R by an ideal I of R, say, replace the internal polynomial representative of f by its normal form mod I with respect to the default_ordering on R. This should be handled similarly in PBWAlgebraQuo. Out of curiosity: Where did you find the set-up of the iszero function as mentioned above? I support using @JohnAAbbott Did you find other things of this type? |
Beta Was this translation helpful? Give feedback.
-
A check shoes that is_zero does already behave correctly for elements of type |
Beta Was this translation helpful? Give feedback.
-
The convention in Julia/Oscar is that functions which (may) change at least one argument have names ending in !
Here is a simplified excerpt from my revision of PBFAlgebraQuo
Internally the function must reduce
a
modulo the idealI
and check whether the result is 0.Now, in this context
a
anda mod I
are semantically equivalent (but their representations maydiffer). The function
simplify!
does the reduction, and then updates its argument.May the function
iszero
silently update its argument to a "reduced" but equivalent value?This could be a problem if
iszero(a)
is called while the caller has a reference to part of theinternal structure of
a
.Beta Was this translation helpful? Give feedback.
All reactions