Skip to content

Commit 6915aec

Browse files
committed
fix doc on oncoeffs
1 parent 701d90f commit 6915aec

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
**`ModuleElts`** — *Module*.
33

44

5+
56
Module Elements –- elements of free modules.
67

78
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.
@@ -130,7 +131,7 @@ julia> a+ModuleElt([:z=>1.0])
130131
```
131132

132133

133-
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/42bf9dcb247a7c08d9c6015068475ddd9b32784b/src/ModuleElts.jl#L1-L173' class='documenter-source'>source</a><br>
134+
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/701d90fc408e308af44a82bb1b5c3d9e504cc681/src/ModuleElts.jl#L1-L173' class='documenter-source'>source</a><br>
134135

135136
<a id='ModuleElts.ModuleElt' href='#ModuleElts.ModuleElt'>#</a>
136137
**`ModuleElts.ModuleElt`** &mdash; *Type*.
@@ -142,7 +143,7 @@ julia> a+ModuleElt([:z=>1.0])
142143
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`.
143144

144145

145-
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/42bf9dcb247a7c08d9c6015068475ddd9b32784b/src/ModuleElts.jl#L217-L225' class='documenter-source'>source</a><br>
146+
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/701d90fc408e308af44a82bb1b5c3d9e504cc681/src/ModuleElts.jl#L217-L225' class='documenter-source'>source</a><br>
146147

147148
<a id='Base.merge-Tuple{Function, ModuleElt, ModuleElt}' href='#Base.merge-Tuple{Function, ModuleElt, ModuleElt}'>#</a>
148149
**`Base.merge`** &mdash; *Method*.
@@ -155,26 +156,34 @@ is like `merge(op,a,b)` for `Dict`s, except that keys with value `0` are dele
155156

156157
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.
157158

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`.
163159

164-
165-
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/42bf9dcb247a7c08d9c6015068475ddd9b32784b/src/ModuleElts.jl#L254-L269' class='documenter-source'>source</a><br>
160+
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/701d90fc408e308af44a82bb1b5c3d9e504cc681/src/ModuleElts.jl#L254-L263' class='documenter-source'>source</a><br>
166161

167162
<a id='ModuleElts.merge2' href='#ModuleElts.merge2'>#</a>
168163
**`ModuleElts.merge2`** &mdash; *Function*.
169164

170165

171166

172-
`merge2(op::Function,a::ModuleElt,b::ModuleElt)`
167+
`ModuleElts.merge2(op::Function,a::ModuleElt,b::ModuleElt)`
173168

174169
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.
175170

176171

177-
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/42bf9dcb247a7c08d9c6015068475ddd9b32784b/src/ModuleElts.jl#L292-L300' class='documenter-source'>source</a><br>
172+
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/701d90fc408e308af44a82bb1b5c3d9e504cc681/src/ModuleElts.jl#L286-L294' class='documenter-source'>source</a><br>
173+
174+
<a id='ModuleElts.oncoeffs' href='#ModuleElts.oncoeffs'>#</a>
175+
**`ModuleElts.oncoeffs`** &mdash; *Function*.
176+
177+
178+
179+
`ModuleElts.oncoeffs(op,m::ModuleElt,b)` does `v->op(v,b)` on the values of `m`.
180+
181+
`ModuleElts.oncoeffs(op,b,m::ModuleElt)` does `v->op(b,v)` on the values of `m`.
182+
183+
`ModuleElts.oncoeffs(op,m::ModuleElt)` does `v->op(v)` on the values of `m`.
184+
185+
186+
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/701d90fc408e308af44a82bb1b5c3d9e504cc681/src/ModuleElts.jl#L506-L512' class='documenter-source'>source</a><br>
178187

179188
<a id='Base.getindex-Tuple{ModuleElt, Any}' href='#Base.getindex-Tuple{ModuleElt, Any}'>#</a>
180189
**`Base.getindex`** &mdash; *Method*.
@@ -184,7 +193,7 @@ does `op` between coefficients of the same basis element in `a` and `b`. This
184193
`getindex(x::ModuleElt,key)` returns the value in `x` associated with the `given key`. It returns zero if the key does not occur in `x`.
185194

186195

187-
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/42bf9dcb247a7c08d9c6015068475ddd9b32784b/src/ModuleElts.jl#L341-L344' class='documenter-source'>source</a><br>
196+
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/701d90fc408e308af44a82bb1b5c3d9e504cc681/src/ModuleElts.jl#L335-L338' class='documenter-source'>source</a><br>
188197

189198
<a id='Base.setindex!-Tuple{ModuleElt, Any, Any}' href='#Base.setindex!-Tuple{ModuleElt, Any, Any}'>#</a>
190199
**`Base.setindex!`** &mdash; *Method*.
@@ -194,5 +203,5 @@ does `op` between coefficients of the same basis element in `a` and `b`. This
194203
`setindex!(x::ModuleElt,v,key)` sets `v` as the value in `x` associated with the given `key`. Setting a value to zero or for a new key is expensive.
195204

196205

197-
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/42bf9dcb247a7c08d9c6015068475ddd9b32784b/src/ModuleElts.jl#L351-L355' class='documenter-source'>source</a><br>
206+
<a target='_blank' href='https://github.com/jmichel7/ModuleElts.jl/blob/701d90fc408e308af44a82bb1b5c3d9e504cc681/src/ModuleElts.jl#L345-L349' class='documenter-source'>source</a><br>
198207

docs/src/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ModuleElts
33
ModuleElt
44
merge(::Function,::ModuleElt,::ModuleElt)
55
ModuleElts.merge2
6+
ModuleElts.oncoeffs
67
getindex(::ModuleElt,Any)
78
setindex!(::ModuleElt,Any,Any)
89
```

src/ModuleElts.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,6 @@ deleted after the operation is done.
260260
The code is only valid for `op`s such that `op(0,x)=op(x,0)=x` otherwise
261261
the result is wrong. You can use `ModuleElts.merge2` for a (more expensive)
262262
function which always works.
263-
264-
`merge(op,m::ModuleElt,b)` does `v->op(v,b)` on the values of `m`.
265-
266-
`merge(op,b,m::ModuleElt)` does `v->op(b,v)` on the values of `m`.
267-
268-
`merge(op,m::ModuleElt)` does `v->op(v)` on the values of `m`.
269263
"""
270264
function Base.merge(op::Function,a::ModuleElt,b::ModuleElt)
271265
(a,b)=promote(a,b)
@@ -290,7 +284,7 @@ function Base.merge(op::Function,a::ModuleElt,b::ModuleElt)
290284
end
291285

292286
"""
293-
`merge2(op::Function,a::ModuleElt,b::ModuleElt)`
287+
`ModuleElts.merge2(op::Function,a::ModuleElt,b::ModuleElt)`
294288
295289
does `op` between coefficients of the same basis element in `a` and `b`.
296290
This version works for general ops (not necessarily commutative or not
@@ -509,6 +503,13 @@ end
509503
end
510504
Base.merge(f::Function,a::ModuleElt,b::HModuleElt)=error("ambiguous")
511505
Base.merge(f::Function,a::HModuleElt,b::ModuleElt)=error("ambiguous")
506+
"""
507+
`ModuleElts.oncoeffs(op,m::ModuleElt,b)` does `v->op(v,b)` on the values of `m`.
508+
509+
`ModuleElts.oncoeffs(op,b,m::ModuleElt)` does `v->op(b,v)` on the values of `m`.
510+
511+
`ModuleElts.oncoeffs(op,m::ModuleElt)` does `v->op(v)` on the values of `m`.
512+
"""
512513
oncoeffs(f::Function,a::ModuleElt,b::HModuleElt)=error("ambiguous")
513514
oncoeffs(f::Function,a::HModuleElt,b::ModuleElt)=error("ambiguous")
514515

0 commit comments

Comments
 (0)