Skip to content

Commit 81b94a7

Browse files
authored
Use SVector instead of Vec (#846)
* Use SVector instead of Vec * Lower compat bound for BandedMatrices
1 parent 1615fdb commit 81b94a7

File tree

7 files changed

+49
-81
lines changed

7 files changed

+49
-81
lines changed

Project.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name = "ApproxFun"
22
uuid = "28f2ccd6-bb30-5033-b560-165f7b14dc2f"
3-
version = "0.13.11"
3+
version = "0.13.12"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
77
ApproxFunBase = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
88
ApproxFunFourier = "59844689-9c9d-51bf-9583-5b794ec66d30"
99
ApproxFunOrthogonalPolynomials = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
1010
ApproxFunSingularities = "f8fcb915-6b99-5be2-b79a-d6dbef8e6e7e"
11+
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
1112
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
1213
DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
1314
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
@@ -17,15 +18,17 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1718
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1819
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1920
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
21+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2022

2123
[compat]
2224
AbstractFFTs = "1.0"
23-
ApproxFunBase = "0.7.30"
25+
ApproxFunBase = "0.7.34"
2426
ApproxFunBaseTest = "0.1"
2527
ApproxFunFourier = "0.3"
2628
ApproxFunOrthogonalPolynomials = "0.5"
2729
ApproxFunSingularities = "0.3"
2830
Aqua = "0.5"
31+
BandedMatrices = "0.16, 0.17"
2932
Calculus = "0.5"
3033
DomainSets = "0.3, 0.4, 0.5"
3134
DualNumbers = "0.6.2"
@@ -34,14 +37,16 @@ FastTransforms = "0.13, 0.14"
3437
RecipesBase = "1.0"
3538
Reexport = "1.0"
3639
SpecialFunctions = "1.1, 2"
40+
StaticArrays = "1"
3741
julia = "1.6"
3842

3943
[extras]
4044
ApproxFunBaseTest = "a931bfaf-0cfd-4a5c-b69c-bf2eed002b43"
4145
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
46+
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
4247
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4348
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4449
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4550

4651
[targets]
47-
test = ["ApproxFunBaseTest", "Aqua", "Documenter", "Random", "Test"]
52+
test = ["ApproxFunBaseTest", "Aqua", "BlockBandedMatrices", "Documenter", "Random", "Test"]

examples/Eigenvalue_symmetric.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using ApproxFun
1212
using LinearAlgebra
13+
using BandedMatrices
1314

1415
# Define parameters
1516
ω = 25.0
@@ -32,7 +33,7 @@ R = D1*Q;
3233
# This inversion is computed approximately, such that
3334
# ``\mathrm{C}^{-1} \mathrm{C} ≈ \mathrm{I}`` up to a certain bandwidth
3435
C = Conversion(domainspace(L), rangespace(L))
35-
P = cache(PartialInverseOperator(C, (0, ApproxFun.bandwidth(L, 1) + ApproxFun.bandwidth(R, 1) + ApproxFun.bandwidth(C, 2))));
36+
P = cache(PartialInverseOperator(C, (0, bandwidth(L, 1) + bandwidth(R, 1) + bandwidth(C, 2))));
3637

3738
A = R'D1*P*L*D2*R
3839
B = R'R;

examples/PDE_Helmholtz.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ L = [Dirichlet(d); Laplacian()+100I];
1818

1919
# We compute the QR decomposition of the operator to speed up the solution
2020
Q = qr(L);
21-
ApproxFun.resizedata!(Q,:,4000);
21+
ApproxFunBase.resizedata!(Q,:,4000);
2222

2323
# The boundary condition is a function that is equal to one on each edge
2424
boundary_cond = ones((d));

src/ApproxFun.jl

Lines changed: 32 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -10,84 +10,53 @@ import Calculus
1010
@reexport using ApproxFunOrthogonalPolynomials
1111
@reexport using ApproxFunSingularities
1212

13-
import ApproxFunBase: normalize!, flipsign, FiniteRange, Fun, MatrixFun, UnsetSpace, VFun, RowVector,
14-
UnivariateSpace, AmbiguousSpace, SumSpace, SubSpace, WeightSpace, NoSpace, Space,
15-
HeavisideSpace, PointSpace,
16-
IntervalOrSegment, RaggedMatrix, AlmostBandedMatrix,
17-
AnyDomain, ZeroSpace, ArraySpace, TrivialInterlacer, BlockInterlacer,
18-
AbstractTransformPlan, TransformPlan, ITransformPlan,
19-
ConcreteConversion, ConcreteMultiplication, ConcreteDerivative, ConcreteIntegral, CalculusOperator,
20-
ConcreteVolterra, Volterra, VolterraWrapper,
21-
MultiplicationWrapper, ConversionWrapper, DerivativeWrapper, Evaluation, EvaluationWrapper,
22-
Conversion, defaultConversion, defaultcoefficients, default_Fun, Multiplication, Derivative, Integral, bandwidths,
23-
ConcreteEvaluation, ConcreteDefiniteLineIntegral, ConcreteDefiniteIntegral, ConcreteIntegral,
24-
DefiniteLineIntegral, DefiniteIntegral, ConcreteDefiniteIntegral, ConcreteDefiniteLineIntegral, IntegralWrapper,
25-
ReverseOrientation, ReverseOrientationWrapper, ReverseWrapper, Reverse, NegateEven,
26-
Dirichlet, ConcreteDirichlet, DirichletWrapper,
27-
TridiagonalOperator, SubOperator, Space, @containsconstants, spacescompatible,
28-
hasfasttransform, canonicalspace, domain, setdomain, prectype, domainscompatible,
29-
plan_transform, plan_itransform, plan_transform!, plan_itransform!, transform, itransform, hasfasttransform,
30-
CanonicalTransformPlan, ICanonicalTransformPlan,
31-
Integral,
32-
domainspace, rangespace, boundary,
33-
union_rule, conversion_rule, maxspace_rule, conversion_type, maxspace, hasconversion, points,
34-
rdirichlet, ldirichlet, lneumann, rneumann, ivp, bvp,
35-
linesum, differentiate, integrate, linebilinearform, bilinearform,
36-
UnsetNumber, coefficienttimes, subspace_coefficients, sumspacecoefficients, specialfunctionnormalizationpoint,
37-
Segment, IntervalOrSegmentDomain, PiecewiseSegment, isambiguous, Vec, eps, isperiodic,
38-
arclength, complexlength,
39-
invfromcanonicalD, fromcanonical, tocanonical, fromcanonicalD, tocanonicalD, canonicaldomain, setcanonicaldomain, mappoint,
40-
reverseorientation, checkpoints, evaluate, mul_coefficients, coefficients, coefficientmatrix, isconvertible,
41-
clenshaw, ClenshawPlan, sineshaw,
42-
toeplitz_getindex, toeplitz_axpy!, sym_toeplitz_axpy!, hankel_axpy!, ToeplitzOperator, SymToeplitzOperator, hankel_getindex,
43-
SpaceOperator, ZeroOperator, InterlaceOperator,
44-
interlace!, reverseeven!, negateeven!, cfstype, pad!, alternatesign!, mobius,
45-
extremal_args, hesseneigvals, chebyshev_clenshaw, recA, recB, recC, roots,splitatroots,
46-
chebmult_getindex, intpow, alternatingsum,
47-
domaintype, diagindshift, rangetype, weight, isapproxinteger, default_Dirichlet, scal!, dotu,
48-
components, promoterangespace, promotedomainspace, choosedomainspace,
49-
block, blockstart, blockstop, blocklengths, isblockbanded, pointscompatible,
13+
import ApproxFunBase: Fun, UnsetSpace, VFun, UnivariateSpace, SumSpace, Space,
14+
HeavisideSpace, PointSpace, IntervalOrSegment, ArraySpace,
15+
TransformPlan, ITransformPlan, Evaluation,
16+
Conversion, default_Fun, Derivative, Integral,
17+
Dirichlet, domain, plan_transform,
18+
plan_itransform, transform, domainspace,
19+
rangespace, boundary, points, differentiate, integrate,
20+
Segment, arclength, fromcanonical, checkpoints, evaluate,
21+
coefficients, coefficientmatrix, clenshaw, ClenshawPlan,
22+
SpaceOperator, InterlaceOperator, cfstype, pad!,
23+
isapproxinteger, components, promotedomainspace, choosedomainspace,
5024
AbstractProductSpace, MultivariateFun, BivariateSpace,
51-
@wrapperstructure, @wrapperspaces, @wrapper, @calculus_operator, resizedata!, slnorm,
52-
sample, chop!, isbanded, colrange, bandwidth,
53-
∇, 𝒟, Δ, ∫, ⨜, Σ, ∮, ⨍, ⨎
25+
@calculus_operator, slnorm, sample, chop!, 𝒟, ∫, ⨜, ⨍
5426

5527
export ∫, ⨜, ⨍, 𝒟
5628

5729
import ApproxFunOrthogonalPolynomials: order
5830

31+
import BandedMatrices: bandwidths
5932

6033
import AbstractFFTs: Plan, fft, ifft
61-
import FFTW: plan_r2r!, fftwNumber, REDFT10, REDFT01, REDFT00, RODFT00, R2HC, HC2R,
62-
r2r!, r2r, plan_fft, plan_ifft, plan_ifft!, plan_fft!
34+
import FFTW: plan_fft, plan_ifft, plan_ifft!
6335

64-
import Base: values, convert, getindex, setindex!, *, +, -, ==, <, <=, >, |, !, !=, eltype, iterate,
65-
>=, /, ^, \, , transpose, size, tail, broadcast, broadcast!, copyto!, copy, to_index, (:),
66-
similar, map, vcat, hcat, hvcat, show, summary, stride, sum, cumsum, sign, conj, inv,
67-
complex, reverse, exp, sqrt, abs, abs2, sign, issubset, values, in, first, last, rand, intersect, setdiff,
68-
isless, union, angle, join, isnan, isapprox, isempty, sort, merge, promote_rule,
69-
minimum, maximum, extrema, argmax, argmin, findmax, findmin, isfinite,
70-
zeros, zero, one, promote_rule, repeat, length, resize!, isinf,
71-
getproperty, findfirst, unsafe_getindex, fld, cld, div, real, imag,
72-
@_inline_meta, eachindex, firstindex, lastindex, keys, isreal, OneTo,
73-
Array, Vector, Matrix, view, ones, @propagate_inbounds, print_array,
74-
split
36+
import Base: convert, getindex, *, +, -, /, ^, \, sum, cumsum,
37+
first, last, isempty, zeros, promote_rule, real,
38+
# the following functions names are listed in Calculus.symbolic_derivatives_1arg(),
39+
# and methods are added to them here
40+
sqrt, cbrt, abs2, inv, log, log10, log2, log1p,
41+
exp, exp2, expm1, sin, cos, tan, sec, csc, cot,
42+
sind, cosd, tand, secd, cscd, cotd, asin, acos, atan, asec, acsc, acot,
43+
asind, acosd, atand, asecd, acscd, acotd, sinh, cosh, tanh, sech, csch,
44+
coth, asinh, acosh, atanh, asech, acsch, acoth, deg2rad, rad2deg
7545

76-
import Base.Broadcast: BroadcastStyle, Broadcasted, AbstractArrayStyle, broadcastable,
77-
DefaultArrayStyle, broadcasted
46+
import LinearAlgebra: eigvals, dot, adjoint
7847

79-
80-
81-
import LinearAlgebra: BlasInt, BlasFloat, norm, ldiv!, mul!, det, eigvals, dot, cross,
82-
qr, qr!, rank, isdiag, istril, istriu, issymmetric, ishermitian,
83-
Tridiagonal, diagm, diagm_container, factorize, nullspace,
84-
Hermitian, Symmetric, adjoint, transpose, char_uplo
48+
import SpecialFunctions: erf, erfinv, erfc, erfcinv, erfi, gamma, lgamma, digamma, invdigamma,
49+
trigamma, airyai, airybi, airyaiprime, airybiprime, besselj0, besselj1,
50+
bessely0, bessely1, erfcx, dawson
8551

8652
# import Arpack: eigs
8753

8854

89-
import FastTransforms: ChebyshevTransformPlan, IChebyshevTransformPlan, plan_chebyshevtransform,
90-
plan_chebyshevtransform!, plan_ichebyshevtransform, plan_ichebyshevtransform!
55+
import FastTransforms: ChebyshevTransformPlan, plan_chebyshevtransform,
56+
plan_chebyshevtransform!, plan_ichebyshevtransform,
57+
plan_ichebyshevtransform!
58+
59+
using StaticArrays: SVector
9160

9261
"""
9362
`Curve` Represents a domain defined by the image of a Fun. Example
@@ -106,11 +75,6 @@ Curve(f::Fun{<:Space{<:ChebyshevInterval}}) = IntervalCurve(f)
10675

10776
export Curve
10877

109-
110-
111-
import Base: view
112-
113-
11478
##Testing
11579
export bisectioninv
11680

src/Extras/dualnumbers.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,15 @@ function dualFun(f,S,n)
7171
end
7272

7373
function dualcfsFun(f,S)
74-
T = float(eltype(domain(S)))
75-
if T <: Complex
76-
T = T.parameters[1] #get underlying real representation
77-
end
74+
T = real(float(eltype(domain(S))))
7875
r=checkpoints(S)
7976
f0=f(first(r))
8077

8178
if isa(f0,AbstractArray) && size(S) size(f0)
8279
return dualcfsFun(f,Space(fill(S,size(f0))))
8380
end
8481

85-
tol =T==Any ? 100eps() : 100eps(T)
82+
tol = 100eps(T)
8683

8784

8885
fr=typeof(f0)[f(x) for x=r]

src/Plot/Plot.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ end
110110
# end
111111
end
112112

113-
@recipe function f(dd::Segment{<:Vec{2}})
113+
@recipe function f(dd::Segment{<:SVector{2}})
114114
a,b = endpoints(dd)
115115
[a[1],b[1]], [a[2],b[2]]
116116
end

test/runtests.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using ApproxFun, Random, Test
22
using ApproxFunBase: testbandedblockbandedoperator, blocklengths, ∞
3+
using BlockBandedMatrices: blockbandwidths, subblockbandwidths
34

45
using Aqua
56
@testset "Project quality" begin
@@ -99,8 +100,8 @@ end
99100

100101
sp = Space(dom)
101102
Dr = Derivative(sp, [1,0])
102-
@test ApproxFunBase.blockbandwidths(Dr) == (-1,1)
103-
@test ApproxFunBase.subblockbandwidths(Dr) == (1,3)
103+
@test blockbandwidths(Dr) == (-1,1)
104+
@test subblockbandwidths(Dr) == (1,3)
104105

105106
= Derivative(sp, [0,1])
106107
Mr = Multiplication(Fun( (r, θ) -> r, sp ), sp)

0 commit comments

Comments
 (0)