Skip to content

Commit 4e7f9bd

Browse files
committed
QuasiArrays v0.13
1 parent 116019e commit 4e7f9bd

File tree

5 files changed

+33
-17
lines changed

5 files changed

+33
-17
lines changed

Project.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
2222
RecurrenceRelationships = "807425ed-42ea-44d6-a357-6771516d7b2c"
2323
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2424
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
25-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
25+
26+
[weakdeps]
27+
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
28+
29+
[extensions]
30+
MultivariateOrthogonalPolynomialsStatsBaseExt = "StatsBase"
2631

2732
[compat]
2833
ArrayLayouts = "1.11"
2934
BandedMatrices = "1"
3035
BlockArrays = "1.0"
3136
BlockBandedMatrices = "0.13"
3237
ClassicalOrthogonalPolynomials = "0.15.8"
33-
ContinuumArrays = "0.19.6"
38+
ContinuumArrays = "0.20"
3439
DomainSets = "0.7"
3540
FastTransforms = "0.17"
3641
FillArrays = "1.0"
@@ -39,19 +44,21 @@ InfiniteArrays = "0.15"
3944
InfiniteLinearAlgebra = "0.9, 0.10"
4045
LazyArrays = "2.3.1"
4146
LazyBandedMatrices = "0.11.3"
42-
QuasiArrays = "0.12.2"
47+
QuasiArrays = "0.13"
4348
Random = "1.11.0"
4449
RecurrenceRelationships = "0.2"
4550
SpecialFunctions = "1, 2"
4651
StaticArrays = "1"
52+
StatsBase = "0.34"
4753
julia = "1.10"
4854

4955
[extras]
5056
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
5157
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
5258
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
5359
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
60+
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
5461
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5562

5663
[targets]
57-
test = ["Base64", "ForwardDiff", "Random", "RecipesBase", "Test"]
64+
test = ["Base64", "ForwardDiff", "Random", "RecipesBase", "StatsBase", "Test"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module MultivariateOrthogonalPolynomialsStatsBaseExt
2+
using MultivariateOrthogonalPolynomials, StatsBase
3+
using MultivariateOrthogonalPolynomials.StaticArrays
4+
using MultivariateOrthogonalPolynomials.QuasiArrays
5+
using MultivariateOrthogonalPolynomials: ExpansionLayout, KronOPLayout
6+
import MultivariateOrthogonalPolynomials.QuasiArrays: sample_layout
7+
8+
function sample_layout(::ExpansionLayout{KronOPLayout{2}}, f::AbstractQuasiVector, n::Integer)
9+
F = reshape(f)
10+
x = sample(sum(F; dims=2), n)
11+
# x = sample(F[:,y]) # TODO: this should work
12+
y = [sample(F[x,:]) for x in x]
13+
map(SVector, x, y)
14+
end
15+
16+
sample_layout(lay::ExpansionLayout{KronOPLayout{2}}, f::AbstractQuasiVector) = only(sample_layout(lay, f, 1))
17+
18+
end

src/MultivariateOrthogonalPolynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import LazyArrays: arguments, paddeddata, LazyArrayStyle, LazyLayout, PaddedLayo
2121
import LazyBandedMatrices: LazyBandedBlockBandedLayout, AbstractBandedBlockBandedLayout, AbstractLazyBandedBlockBandedLayout, _krontrav_axes, DiagTravLayout, invdiagtrav, ApplyBandedBlockBandedLayout, krontrav
2222
import InfiniteArrays: InfiniteCardinal, OneToInf
2323

24-
import ClassicalOrthogonalPolynomials: jacobimatrix, Weighted, orthogonalityweight, HalfWeighted, WeightedBasis, pad, recurrencecoefficients, clenshaw, weightedgrammatrix, Clenshaw, OPLayout, sample, sample_layout
24+
import ClassicalOrthogonalPolynomials: jacobimatrix, Weighted, orthogonalityweight, HalfWeighted, WeightedBasis, pad, recurrencecoefficients, clenshaw, weightedgrammatrix, Clenshaw, OPLayout
2525
import HarmonicOrthogonalPolynomials: BivariateOrthogonalPolynomial, MultivariateOrthogonalPolynomial, Plan,
2626
AngularMomentum, angularmomentum, BlockOneTo, BlockRange1, interlace,
2727
MultivariateOPLayout, AbstractMultivariateOPLayout, MAX_PLOT_BLOCKS

src/rect.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,3 @@ function vec_layout(::KronExpansionLayout{OPLayout, OPLayout}, f)
203203
A,C,Bc = arguments(f)
204204
RectPolynomial(A, Bc') * DiagTrav(C)
205205
end
206-
207-
function sample_layout(::ExpansionLayout{MultivariateOrthogonalPolynomials.KronOPLayout{2}}, f::AbstractQuasiVector, n)
208-
F = reshape(f)
209-
x = sample(sum(F; dims=2), n)
210-
# x = sample(F[:,y]) # TODO: this should work
211-
y = [sample(F[x,:]) for x in x]
212-
map(SVector, x, y)
213-
end
214-
215-
sample_layout(lay::ExpansionLayout{MultivariateOrthogonalPolynomials.KronOPLayout{2}}, f::AbstractQuasiVector) = only(sample_layout(lay, f, 1))

test/test_rect.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using MultivariateOrthogonalPolynomials, ClassicalOrthogonalPolynomials, StaticArrays, LinearAlgebra, BlockArrays, FillArrays, Base64, LazyBandedMatrices, ArrayLayouts, Random, Test
2-
using ClassicalOrthogonalPolynomials: expand, coefficients, recurrencecoefficients, sample
1+
using MultivariateOrthogonalPolynomials, ClassicalOrthogonalPolynomials, StaticArrays, LinearAlgebra, BlockArrays, FillArrays, Base64, LazyBandedMatrices, ArrayLayouts, Random, StatsBase, Test
2+
using ClassicalOrthogonalPolynomials: expand, coefficients, recurrencecoefficients
33
using MultivariateOrthogonalPolynomials: weaklaplacian, ClenshawKron
44
using ContinuumArrays: plotgridvalues, ExpansionLayout
55
using Base: oneto
@@ -251,6 +251,7 @@ Random.seed!(3242)
251251
@test sum(F; dims=2)[0.1,1] 2.1748993079723618
252252

253253
x,y = coordinates(P)
254+
@test sample(f) isa SVector
254255
@test sum(sample(f, 100_000))/100_000 [sum(x .* f)/sum(f),sum(y .* f)/sum(f)] rtol=1E-1
255256
end
256257
end

0 commit comments

Comments
 (0)