Skip to content

Commit

Permalink
Export norm (#332)
Browse files Browse the repository at this point in the history
* Export norm

* Remove unnecesary using LinearAlgebra

* Bump patch version

---------

Co-authored-by: Luis Benet <[email protected]>
  • Loading branch information
lbenet and Luis Benet authored Jun 23, 2023
1 parent 4f9d799 commit ff1f680
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TaylorSeries"
uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea"
repo = "https://github.com/JuliaDiff/TaylorSeries.jl.git"
version = "0.15.1"
version = "0.15.2"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
2 changes: 1 addition & 1 deletion src/TaylorSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export getcoeff, derivative, integrate, differentiate,
# jacobian, hessian, jacobian!, hessian!,
∇, taylor_expand, update!,
constant_term, linear_polynomial, nonlinear_polynomial,
normalize_taylor
normalize_taylor, norm

const TS = TaylorSeries

Expand Down
36 changes: 36 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file is part of the TaylorSeries.jl Julia package, MIT license
#
# Luis Benet & David P. Sanders
# UNAM
#
# MIT Expat license
#

using PrecompileTools

@setup_workload begin
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
# precompile file and potentially make loading faster.
t = Taylor1(20)
δ = set_variables("δ", order=6, numvars=2)
tN = one(δ[1]) + Taylor1(typeof(δ[1]), 20)
# tb = Taylor1(Float128, 20)
# δb = zero(Float128) .+ δ
# tbN = one(δb[1]) + Taylor1(typeof(δb[1]), 20)
#
@compile_workload begin
# all calls in this block will be precompiled, regardless of whether
# they belong to your package or not (on Julia 1.8 and higher)
for x in (:t, :tN)
@eval begin
T = numtype($x)
zero($x)
sin($x)
cos($x)
$x/sqrt($x^2+(2*$x)^2)
evaluate(($x)^3, 0.125)
($x)[2]
end
end
end
end
2 changes: 1 addition & 1 deletion test/manyvariables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using TaylorSeries

using Test
using LinearAlgebra
# using LinearAlgebra

@testset "Test hash tables" begin
# Issue #85 is solved!
Expand Down
6 changes: 3 additions & 3 deletions test/mixtures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using TaylorSeries

using Test
using LinearAlgebra
# using LinearAlgebra

@testset "Tests with mixtures of Taylor1 and TaylorN" begin
@test TaylorSeries.NumberNotSeries == Union{Real,Complex}
Expand Down Expand Up @@ -231,7 +231,7 @@ using LinearAlgebra
F(x) = [sin(sin(x[4]+x[3])), sin(cos(x[3]-x[2])), cos(sin(x[1]^2+x[2]^2)), cos(cos(x[2]*x[3]))]
Q = F(v+dx)
diff_evals = cos(sin(dx[1]))-p(P[1])
@test norm( norm.(map(x->x.coeffs, diff_evals.coeffs),Inf) , Inf) < 1e-15
@test norm(diff_evals, Inf) < 1e-15
#evaluate a Taylor1 at a TaylorN
@test p(P) == evaluate(p, P)
@test q(Q) == evaluate(q, Q)
Expand Down Expand Up @@ -279,7 +279,7 @@ using LinearAlgebra
a11 = Taylor1([t,t^2,exp(-t),sin(t),cos(t)])
b11 = t+t*(t^2)+(t^2)*(exp(-t))+(t^3)*sin(t)+(t^4)*cos(t)
diff_a11b11 = a11(t)-b11
@test norm(diff_a11b11.coeffs,Inf) < 1E-19
@test norm(diff_a11b11.coeffs, Inf) < 1E-19

X, Y = set_variables(Taylor1{Float64}, "x y")
@test typeof( norm(X) ) == Float64
Expand Down
4 changes: 2 additions & 2 deletions test/onevariable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ Base.iszero(::SymbNumber) = false
@test typeof( norm(Taylor1(rnd)) ) == Float64
@test norm(Taylor1(rnd)) > 0
@test norm(t_a) == norm(a)
@test norm(Taylor1(a,15),3) == sum((a.^3))^(1/3)
@test norm(t_a,Inf) == 12
@test norm(Taylor1(a,15), 3) == sum((a.^3))^(1/3)
@test norm(t_a, Inf) == 12
@test norm(t_C) == norm(complex(3.0,4.0)*a)

@test TaylorSeries.rtoldefault(Taylor1{Int}) == 0
Expand Down

2 comments on commit ff1f680

@lbenet
Copy link
Member Author

@lbenet lbenet commented on ff1f680 Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/86135

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.15.2 -m "<description of version>" ff1f6806dcd65ac6af9e417bcfd71ce483abfa3e
git push origin v0.15.2

Please sign in to comment.