File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ Base.iszero(m::AbstractMonomial) = false
5
5
Base. iszero (t:: AbstractTerm ) = iszero (coefficient (t))
6
6
Base. iszero (t:: AbstractPolynomial ) = iszero (nterms (t))
7
7
8
+ Base. isone (v:: AbstractVariable ) = false
9
+ Base. isone (m:: AbstractMonomial ) = isconstant (m)
10
+ Base. isone (t:: AbstractTerm ) = isone (coefficient (t)) && isconstant (monomial (t))
11
+ function Base. isone (p:: AbstractPolynomial )
12
+ return isone (nterms (p)) && isone (first (terms (p)))
13
+ end
14
+
8
15
# See https://github.com/blegat/MultivariatePolynomials.jl/issues/22
9
16
# avoids the call to be transfered to left_constant_eq
10
17
Base.:(== )(α:: Nothing , x:: APL ) = false
Original file line number Diff line number Diff line change 1
1
module TestAllocations
2
-
3
2
include (" utils.jl" )
4
3
5
4
function runtests ()
@@ -86,6 +85,12 @@ function test_isapproxzero()
86
85
alloc_test (0 ) do
87
86
isapproxzero (q; ztol = 1e-8 )
88
87
end
88
+ alloc_test (0 ) do
89
+ iszero (q)
90
+ end
91
+ alloc_test (0 ) do
92
+ isone (q)
93
+ end
89
94
end
90
95
91
96
function _test_gcd (T)
You can’t perform that action at this time.
0 commit comments