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
55Base. iszero (t:: AbstractTerm ) = iszero (coefficient (t))
66Base. iszero (t:: AbstractPolynomial ) = iszero (nterms (t))
77
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+
815# See https://github.com/blegat/MultivariatePolynomials.jl/issues/22
916# avoids the call to be transfered to left_constant_eq
1017Base.:(== )(α:: Nothing , x:: APL ) = false
Original file line number Diff line number Diff line change 11module TestAllocations
2-
32include (" utils.jl" )
43
54function runtests ()
@@ -86,6 +85,12 @@ function test_isapproxzero()
8685 alloc_test (0 ) do
8786 isapproxzero (q; ztol = 1e-8 )
8887 end
88+ alloc_test (0 ) do
89+ iszero (q)
90+ end
91+ alloc_test (0 ) do
92+ isone (q)
93+ end
8994end
9095
9196function _test_gcd (T)
You can’t perform that action at this time.
0 commit comments