Skip to content

Commit 296678b

Browse files
committed
Aqua + typos CI
add begin end around Aqua tests a
1 parent 7b3920c commit 296678b

File tree

9 files changed

+64
-35
lines changed

9 files changed

+64
-35
lines changed

.github/workflows/Downgrade.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- 'docs/**'
88
push:
99
branches:
10-
- master
10+
- main
1111
paths-ignore:
1212
- 'docs/**'
1313
jobs:

.github/workflows/SpellCheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Spell Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
typos-check:
7+
name: Spell Check with Typos
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Actions Repository
11+
uses: actions/checkout@v3
12+
- name: Check spelling
13+
uses: crate-ci/typos@v1.16.23

.typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[default.extend-words]
2+
numer = "numer"

Project.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,21 @@ SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
1414
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1515

1616
[compat]
17+
Aqua = "0.8"
1718
DataDrivenDiffEq = "1.3"
1819
DataDrivenSparse = "0.1.2"
1920
DataStructures = "0.18.13"
21+
LinearAlgebra = "1.10"
2022
SpecialFunctions = "2"
21-
Statistics = "1.9"
23+
Statistics = "1.10"
2224
SymbolicUtils = "1.4"
2325
Symbolics = "5.12"
24-
julia = "1.9"
25-
LinearAlgebra = "<0.0.1, 1"
26+
Test = "1"
27+
julia = "1.10"
2628

2729
[extras]
30+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
2831
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2932

3033
[targets]
31-
test = ["Test"]
34+
test = ["Aqua", "Test"]

src/integral.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using LinearAlgebra
22
using Statistics: mean, std
33

4-
Base.signbit(z::Complex{T}) where {T <: Number} = signbit(real(z))
5-
Base.signbit(x::SymbolicUtils.Sym{Number}) = false
64

75
"""
86
integrate(eq, x; kwargs...)

src/sparse.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ function prune_basis(eq, x, basis; plan = default_plan())
5252
return basis[l]
5353
end
5454

55-
# init_basis_matrix tranforms the integration problem into a linear system
56-
#
57-
# It returns A, X, V, where
55+
# init_basis_matrix transforms the integration problem into a linear system
56+
#
57+
# It returns A, X, V, where
5858
#
5959
# A: the normalized training matrix, we seek a vector q such that A * q = 1
6060
# X: a vector of complex test points
@@ -217,14 +217,14 @@ function hints(eq, x, basis; plan = default_plan())
217217

218218
return h, ε
219219
catch e
220-
# println("Error from hints: ", e)
220+
# println("Error from hints: ", e)
221221
end
222222

223223
return 0, Inf
224224
end
225225

226226
# best_hints works is the link between numerical and symbolic integration.
227-
# It convers a symbolic integrad eq into a univariate expression, performs
227+
# It converts a symbolic integrad eq into a univariate expression, performs
228228
# symbolic-numeric integration, and the returns a list of symbolic ansatzes
229229
# corresponding to the solution
230230
function best_hints(eq, x, basis; plan = default_plan(), num_trials = 10)

src/symbolic.jl

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
########################### Utility functions #########################
22

3-
# beautify convers floats to integers/rational numbers with small
3+
# beautify converts floats to integers/rational numbers with small
44
# denominators if possible
55
function beautify(eq)
66
if is_add(eq)
@@ -47,22 +47,22 @@ function split_terms(eq, x)
4747
end
4848
end
4949

50-
# is_holonomic checks whether y is a holonomic function, i.e.,
50+
# is_holonomic checks whether y is a holonomic function, i.e.,
5151
# is closed under differentiation w.r.t. x
52-
#
52+
#
5353
# For our purpose, we define a holonomic function as one composed
5454
# of the positive powers of x, sin, cos, exp, sinh, and cosh
55-
#
55+
#
5656
# Args:
5757
# y: the expression to check for holonomy
5858
# x: independent variable
59-
#
59+
#
6060
# Returns:
6161
# true if y is holonomic
6262
function is_holonomic(y, x)
6363
y = value(y)
6464

65-
# technically, polynomials are not holonomic, but
65+
# technically, polynomials are not holonomic, but
6666
# practically we can include them
6767
if is_polynomial(y, x)
6868
return true
@@ -90,8 +90,8 @@ function is_holonomic(y, x)
9090
return false
9191
end
9292

93-
# blender generates a list of ansatzes based on repetative
94-
# differentiation. It works for holonomic functions, which
93+
# blender generates a list of ansatzes based on repetitive
94+
# differentiation. It works for holonomic functions, which
9595
# are closed under differentiation.
9696
function blender(y, x; n = 3)
9797
basis = value(y)
@@ -111,7 +111,7 @@ function blender(y, x; n = 3)
111111
return split_terms(basis, x)
112112
end
113113

114-
# subs_symbols returns a dictionary of the symbolic constants
114+
# subs_symbols returns a dictionary of the symbolic constants
115115
# in the expression and random real value assignments.
116116
#
117117
# Args:
@@ -138,8 +138,8 @@ function subs_symbols(eq, x; include_x = false, radius = 5.0, as_complex = true)
138138
return S
139139
end
140140

141-
# atomize splits terms into a part dependent on x and a part
142-
# constant w.r.t. variables in xs.
141+
# atomize splits terms into a part dependent on x and a part
142+
# constant w.r.t. variables in xs.
143143
#
144144
# For example, `atomize(a*sin(b*x), x)` is `(a, sin(b*x))`)
145145
function atomize(eq, xs...)
@@ -165,7 +165,7 @@ function atomize(eq, xs...)
165165
end
166166
end
167167

168-
# apply_coefs generates the final integral based on the list
168+
# apply_coefs generates the final integral based on the list
169169
# of coefficients (q) and a list of ansatzes (ker).
170170
function apply_coefs(q, ker)
171171
s = 0
@@ -201,11 +201,11 @@ complex_from_num(x) = Complex(value(real(x)), value(imag(x)))
201201
########################### Symbolic Integration #############################
202202

203203
# integrate_symbolic is the main entry point for symbolic integration.
204-
#
204+
#
205205
# Argu:
206206
# eq: the expression to integrate
207207
# x: independent variable
208-
#
208+
#
209209
# Returns:
210210
# the integral or nothing if no solution
211211
function integrate_symbolic(eq, x; plan = default_plan())
@@ -226,10 +226,10 @@ struct Problem
226226
x::Expression # independent variable
227227
coef::Expression # coefficient of the integrand
228228
ker::Array{Expression} # the pruned list of the basis expressions (kernel)
229-
plan::NumericalPlan # the numerial plan, containing various parameters
229+
plan::NumericalPlan # the numerical plan, containing various parameters
230230
end
231231

232-
# Constructor to create a Problem for integrand eq
232+
# Constructor to create a Problem for integrand eq
233233
function Problem(eq, x; plan = default_plan())
234234
eq = expand(eq)
235235
coef, eq = atomize(eq, x)
@@ -314,14 +314,14 @@ subs_symbols(prob::Problem) = subs_symbols(prob.eq, prob.x)
314314
abstract type IntegrationAlgorithm end
315315

316316
struct SymbolicIntegrator <: IntegrationAlgorithm
317-
eqs::Vector{Equation} # list of equations of the form Σ θ[i]*frag[i] ~ 0
317+
eqs::Vector{Equation} # list of equations of the form Σ θ[i]*frag[i] ~ 0
318318
vars::Vector{Expression} # list of dummy variables (θ[1], θ[2], ...)
319319
frags::Dict # Dict of fragments of form frag => expression in θs
320320
end
321321

322322
@variables θ[1:30]
323323

324-
# Constructor creating a SymbolicIntegrator algorithm
324+
# Constructor creating a SymbolicIntegrator algorithm
325325
# from an integration Problem
326326
function SymbolicIntegrator(prob::Problem)
327327
frags = Dict()
@@ -355,16 +355,16 @@ function solver(prob::Problem, alg::SymbolicIntegrator)
355355
sol = apply_coefs(q, prob.ker)
356356
return sol
357357
catch e
358-
# println(e)
358+
# println(e)
359359
end
360360

361361
return nothing
362362
end
363363

364364
# If the linear system generated by the SymbolicIntegrator solver is
365-
# under-determined, make_square uses semi-numerical methods to
365+
# under-determined, make_square uses semi-numerical methods to
366366
# generate a full-rank linear system.
367-
#
367+
#
368368
# The output is another SymbolicIntegrator or nothing if unsuccessful.
369369
function make_square(prob::Problem, alg::SymbolicIntegrator)
370370
n = length(alg.vars)
@@ -390,10 +390,10 @@ function make_square(prob::Problem, alg::SymbolicIntegrator)
390390
end
391391

392392
struct NumericIntegrator
393-
A::AbstractMatrix # training dataset as a normalized linear system
393+
A::AbstractMatrix # training dataset as a normalized linear system
394394
X::AbstractVector # vector of test points
395395
V::AbstractMatrix # verification dataset
396-
basis::Vector{Expression} # expand basis
396+
basis::Vector{Expression} # expand basis
397397
end
398398

399399
# Constructor to create a NumericIntegrator algorithm from prob

test/qa.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using SymbolicNumericIntegration, Aqua
2+
@testset "Aqua" begin
3+
Aqua.find_persistent_tasks_deps(SymbolicNumericIntegration)
4+
Aqua.test_ambiguities(SymbolicNumericIntegration, recursive = false)
5+
Aqua.test_deps_compat(SymbolicNumericIntegration)
6+
Aqua.test_piracies(SymbolicNumericIntegration, broken = true)
7+
Aqua.test_project_extras(SymbolicNumericIntegration)
8+
Aqua.test_stale_deps(SymbolicNumericIntegration)
9+
Aqua.test_unbound_args(SymbolicNumericIntegration)
10+
Aqua.test_undefined_exports(SymbolicNumericIntegration)
11+
end

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ using SymbolicUtils.Rewriters
77

88
using Test
99

10+
@testset "Quality Assurance" begin include("qa.jl") end
11+
1012
include("axiom.jl")
1113

1214
##############################################################################

0 commit comments

Comments
 (0)