File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ DocTestSetup = doctestsetup
10
10
deg(::Any)
11
11
```
12
12
13
- ## Traits for rings
13
+ ## Traits and functions for rings
14
14
15
15
``` @docs
16
16
LinearCombinations.has_char2
17
17
LinearCombinations.is_domain
18
+ LinearCombinations.signed
18
19
```
Original file line number Diff line number Diff line change @@ -189,6 +189,15 @@ See also [`is_domain`](@ref).
189
189
has_char2 (:: Type ) = false
190
190
has_char2 (:: Missing ) = false
191
191
192
+ """
193
+ LinearCombinations.signed(k, x)
194
+
195
+ Return a value representing `(-1)^k*x`. The default definition is
196
+ ```julia
197
+ signed(k, x::R) where R = has_char2(R) || iseven(k) ? x : -x
198
+ ```
199
+ Additional methods may be needed to support more exotic coefficient types.
200
+ """
192
201
signed (k, x:: R ) where R = has_char2 (R) || iseven (k) ? x : - x
193
202
194
203
sum0 (itr) = sum (itr; init = Zero ())
You can’t perform that action at this time.
0 commit comments