Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`cheb2leg(::Matrix)` should do tensor product Cheb -> tensor product Leg

未关闭
#135 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
julia
领域
backend

调研方向

首先定位 cheb2leg(::Matrix) 和 chebyshevtransform(::Matrix) 入口点。将当前按列处理的行为与 issue 中展示的 cheb2leg2d workaround 进行比较,然后为张量积 Chebyshev 输入添加覆盖。完成的标准是矩阵转换会在两个维度上应用,并生成预期的张量积 Legendre 系数。

由索引模型根据 Issue 内容生成。

描述

Note that chebyshevtransform(::Matrix) is a 2D transform:

julia> using FastTransforms, ClassicalOrthogonalPolynomials

julia> n,m = 3,4; f = (x,y) -> chebyshevt(n, x)chebyshevt(m,y)
#13 (generic function with 1 method)

julia> x = ChebyshevGrid{1}(10);

julia> chebyshevtransform(f.(x', x))
10×10 Matrix{Float64}:
 0.0   1.79736e-18  0.0  1.62102e-17  0.0   9.42055e-18  0.0   1.70874e-18  0.0  -9.27717e-18
 0.0   0.0          0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0   1.11341e-18  0.0  7.41045e-17  0.0  -4.09803e-19  0.0   1.07597e-17  0.0   5.84104e-19
 0.0   0.0          0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0   5.90641e-17  0.0  1.0          0.0   1.50729e-16  0.0   2.84217e-16  0.0   8.12948e-17
 0.0   0.0          0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  -2.19853e-17  0.0  3.47114e-16  0.0  -1.88411e-17  0.0  -1.22156e-17  0.0  -1.4348e-17
 0.0   0.0          0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0   6.63185e-18  0.0  2.18604e-16  0.0   1.14231e-17  0.0  -4.61608e-19  0.0   5.85226e-18
 0.0   0.0          0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0

On the other hand, the following applies 1D transform to each column:

julia> n,m = 3,4; f = (x,y) -> legendrep(n, x)legendrep(m,y)
#15 (generic function with 1 method)

julia> cheb2leg(chebyshevtransform(f.(x', x)))
10×10 Matrix{Float64}:
 0.0  1.83296e-17  0.0   6.46249e-17  0.0   7.18753e-18  0.0   1.30004e-18  0.0  -1.21711e-18
 0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  1.19456e-17  0.0  -8.58383e-17  0.0   9.06258e-19  0.0   2.95814e-17  0.0   4.36288e-19
 0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  0.375        0.0   0.625        0.0   6.39255e-17  0.0   1.35064e-16  0.0   1.36998e-16
 0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  5.4873e-17   0.0   1.12785e-16  0.0  -4.54724e-17  0.0  -1.78334e-17  0.0  -1.84471e-17
 0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  1.45648e-16  0.0   2.70896e-16  0.0   7.99515e-18  0.0   9.33654e-18  0.0   3.97946e-18
 0.0  0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0

The following gives a quick work-around that I think should be the default behaviour:

julia> function cheb2leg2d(A::AbstractMatrix)
       B = cheb2leg(A); cheb2leg(B')'
       end
cheb2leg2d (generic function with 1 method)

julia> cheb2leg2d(chebyshevtransform(f.(x',x)))
10×10 adjoint(::Matrix{Float64}) with eltype Float64:
 0.0  -2.15114e-17  0.0   9.6853e-17   0.0   1.35234e-17  0.0   4.64116e-18  0.0  -3.28115e-18
 0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0   6.13301e-17  0.0  -1.44889e-16  0.0  -3.0644e-17   0.0   7.0058e-17   0.0   1.17616e-18
 0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  -2.34741e-17  0.0   1.0          0.0  -5.64224e-17  0.0   1.4927e-16   0.0   3.69325e-16
 0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  -4.39458e-18  0.0   2.26976e-16  0.0  -6.76889e-17  0.0  -1.92562e-17  0.0  -4.97304e-17
 0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
 0.0  -1.88093e-17  0.0   4.23769e-16  0.0   4.91028e-18  0.0   1.72571e-17  0.0   1.0728e-17
 0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0          0.0   0.0
主要语言
Julia
星标
282
派生
27
平均合并
53 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaApproximation/FastTransforms.jl 的其他 Issue

查看 JuliaApproximation/FastTransforms.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。