File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 119119
120120isapproxzero (m:: AbstractMonomialLike ; kwargs... ) = false
121121isapproxzero (t:: AbstractTermLike ; kwargs... ) = isapproxzero (coefficient (t); kwargs... )
122- isapproxzero (p:: APL ; kwargs... ) = all (isapproxzero .( terms (p) ; kwargs... ))
122+ isapproxzero (p:: APL ; kwargs... ) = all (term -> isapproxzero (term ; kwargs... ), terms (p ))
123123isapproxzero (p:: RationalPoly ; kwargs... ) = isapproxzero (p. num; kwargs... )
124124
125125Base. isapprox (t1:: AbstractTerm , t2:: AbstractTerm ; kwargs... ) = isapprox (coefficient (t1), coefficient (t2); kwargs... ) && monomial (t1) == monomial (t2)
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ function runtests()
1313end
1414
1515using MutableArithmetics
16+ import MultivariatePolynomials
17+ const MP = MultivariatePolynomials
1618using TypedPolynomials
1719
1820function test_polynomial_merge ()
@@ -28,5 +30,34 @@ function test_polynomial_merge()
2830 end
2931end
3032
33+ function test_isapproxzero ()
34+ @polyvar x y
35+ p = x * y + x + y + 1
36+ alloc_test (0 ) do
37+ isapproxzero (p)
38+ end
39+ q = 1e-10 * x * y + 1e-12 * x
40+ alloc_test (0 ) do
41+ isapproxzero (q)
42+ end
43+ alloc_test (0 ) do
44+ isapproxzero (q; ztol = 1e-8 )
45+ end
46+ end
47+
48+ function _test_gcd (T)
49+ o = one (T)
50+ @polyvar x y
51+ t1 = o * x * y
52+ t2 = o * x
53+ alloc_test (0 ) do
54+ gcd (t1, t2)
55+ end
56+ end
57+
58+ function test_gcd ()
59+ _test_gcd (Int)
60+ end
61+
3162end
3263TestAllocations. runtests ()
You can’t perform that action at this time.
0 commit comments