File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 45
45
Base. getindex (x:: MonomialVector , i:: Integer ) = Monomial (x. vars, x. Z[i])
46
46
Base. getindex (x:: MonomialVector , i:: CartesianIndex{1} ) = x[i. I[1 ]]
47
47
48
+ function Base. deleteat! (x:: MonomialVector , i)
49
+ deleteat! (x. Z, i)
50
+ return x
51
+ end
52
+
48
53
Base. firstindex (x:: MonomialVector ) = firstindex (x. Z)
49
54
Base. lastindex (x:: MonomialVector ) = lastindex (x. Z)
50
55
Base. size (x:: MonomialVector ) = (length (x),)
Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ MP.leadingterm(p::Polynomial) = iszero(p) ? zeroterm(p) : first(terms(p))
121
121
function MP. removeleadingterm (p:: Polynomial )
122
122
Polynomial (p. a[2 : end ], p. x[2 : end ])
123
123
end
124
+ function MA. mutable_operate! (:: typeof (MP. removeleadingterm), p:: Polynomial )
125
+ deleteat! (p. a, 1 )
126
+ deleteat! (p. x, 1 )
127
+ return p
128
+ end
124
129
function MP. removemonomials (p:: Polynomial , x:: MonomialVector )
125
130
# use the fact that monomials are sorted to do this O(n) instead of O(n^2)
126
131
j = 1
You can’t perform that action at this time.
0 commit comments