From 9c921b38c0b7276dae3f18d062f0e705498a9651 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 21 Sep 2023 13:52:38 +0400 Subject: [PATCH] Remove fromcanonical in points for BivariateSpace (#603) * Remove fromcanonical in points for BivariateSpace * Add trivial tests * Bump version to v0.9.16 --- Project.toml | 2 +- src/Multivariate/TensorSpace.jl | 16 +++++++++++++--- test/SpacesTest.jl | 7 +++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 139b7082..12501311 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ApproxFunBase" uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05" -version = "0.9.15" +version = "0.9.16" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" diff --git a/src/Multivariate/TensorSpace.jl b/src/Multivariate/TensorSpace.jl index 8666a75c..b44c0ae6 100644 --- a/src/Multivariate/TensorSpace.jl +++ b/src/Multivariate/TensorSpace.jl @@ -565,10 +565,20 @@ end points(d::Union{EuclideanDomain{2},BivariateSpace},n,m) = points(d,n,m,1),points(d,n,m,2) function points(d::BivariateSpace,n,m,k) - ptsx=points(columnspace(d,1),n) - ptst=points(factor(d,2),m) + k ∈ (1,2) || throw(ArgumentError("k must be 1 or 2")) - promote_type(eltype(ptsx),eltype(ptst))[fromcanonical(d,x,t)[k] for x in ptsx, t in ptst] + ptsx = points(columnspace(d,1), n) + ptst = points(factor(d,2), m) + + T = promote_eltypeof(ptsx, ptst) + + A = if k == 1 + repeat(ptsx, 1, m) + else # k == 2 + repeat(reshape(ptst, 1, m), n) + end + + convert(AbstractArray{T}, A) end diff --git a/test/SpacesTest.jl b/test/SpacesTest.jl index fcb2b0b6..f287e542 100644 --- a/test/SpacesTest.jl +++ b/test/SpacesTest.jl @@ -295,6 +295,13 @@ using LinearAlgebra @test a == a @test a != b end + + @testset "points" begin + S = PointSpace(1:4) ⊗ PointSpace(1:4) + P = points(S, 4, 4) + @test P[1] == repeat(1:4, 1, 4) + @test P[2] == repeat((1:4)', 4, 1) + end end @testset "ConstantSpace" begin