You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-13Lines changed: 22 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
**`ModuleElts`**—*Module*.
3
3
4
4
5
+
5
6
Module Elements –- elements of free modules.
6
7
7
8
A `ModuleElt{K,V}` represents an element of a free module where the basis elements are of type `K` and the coefficients are of type `V`. Usually you want objects of type `V` to be elements of a (not necessarily commutative) ring, but it can also be useful if they just belong to an abelian group. This is similar to the SageMath CombinatorialFreeModule. You can also think of them as `SparseVector`s, where the keys can be of type `K` instead of integers.
The only field, a `Vector{Pair{K,V}}`, is kept sorted by `K`; by default, the constructor checks sorting, adds values with the same key, and deletes keys with zero value. This can be overriden with the keyword `check=false`.
@@ -155,26 +156,34 @@ is like `merge(op,a,b)` for `Dict`s, except that keys with value `0` are dele
155
156
156
157
The code is only valid for `op`s such that `op(0,x)=op(x,0)=x` otherwise the result is wrong. You can use `ModuleElts.merge2` for a (more expensive) function which always works.
157
158
158
-
`merge(op,m::ModuleElt,b)` does `v->op(v,b)` on the values of `m`.
159
-
160
-
`merge(op,b,m::ModuleElt)` does `v->op(b,v)` on the values of `m`.
161
-
162
-
`merge(op,m::ModuleElt)` does `v->op(v)` on the values of `m`.
does `op` between coefficients of the same basis element in `a` and `b`. This version works for general ops (not necessarily commutative or not satisfying op(0,x)=op(x,0)=x). It currently has too much overhead to replace `merge` for + or other ops such that op(0,x)==op(x,0)=x. It is useful for max or min which do lcm and gcd of `Monomial`s or `CycPol`s.
0 commit comments