Comments (8)
This doesn't work every time:
Richards-MBP-2:~ Mikael$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.3-pre.0 (2017-12-18 07:11 UTC)
_/ |\__'_|_|_|\__'_| | Commit 93168a6826* (90 days old release-0.6)
|__/ | x86_64-apple-darwin17.2.0
julia> using FastTransforms, StaticArrays
julia> pts=paduapoints(10)
66×2 Array{Float64,2}:
1.0 0.959493
1.0 0.654861
1.0 0.142315
1.0 -0.415415
1.0 -0.841254
1.0 -1.0
0.951057 1.0
0.951057 0.841254
0.951057 0.415415
0.951057 -0.142315
⋮
-0.951057 -0.142315
-0.951057 -0.654861
-0.951057 -0.959493
-1.0 0.959493
-1.0 0.654861
-1.0 0.142315
-1.0 -0.415415
-1.0 -0.841254
-1.0 -1.0
julia> ptr=reinterpret(Ptr{SVector{2,Float64}},pointer(pts')) # reinterpret the memory of pts'
Ptr{SVector{2,Float64}} @0x00000001299d0e00
julia> unsafe_wrap(Vector{SVector{2,Float64}},
ptr,
size(pts,1),true)
66-element Array{SVector{2,Float64},1}:
[2.27902e-314, 2.29691e-314]
[2.29752e-314, 2.27908e-314]
[2.29752e-314, 2.27902e-314]
[2.29752e-314, 2.45615e-314]
[2.29752e-314, 2.27902e-314]
[2.27902e-314, 2.45615e-314]
[2.27902e-314, 2.45616e-314]
[2.29752e-314, 2.27908e-314]
[2.29752e-314, 2.45615e-314]
[2.27902e-314, 2.2969e-314]
⋮
[0.0, 0.0]
[0.0, 0.0]
[2.29752e-314, 2.27902e-314]
[2.29752e-314, 2.27902e-314]
[2.29752e-314, 2.45598e-314]
[2.27902e-314, 2.45616e-314]
[2.27902e-314, 2.45619e-314]
[-1.0, -0.841254]
[-1.0, -1.0]
julia> pts=paduapoints(10)
66×2 Array{Float64,2}:
1.0 0.959493
1.0 0.654861
1.0 0.142315
1.0 -0.415415
1.0 -0.841254
1.0 -1.0
0.951057 1.0
0.951057 0.841254
0.951057 0.415415
0.951057 -0.142315
⋮
-0.951057 -0.142315
-0.951057 -0.654861
-0.951057 -0.959493
-1.0 0.959493
-1.0 0.654861
-1.0 0.142315
-1.0 -0.415415
-1.0 -0.841254
-1.0 -1.0
julia> ptr=reinterpret(Ptr{SVector{2,Float64}},pointer(pts')) # reinterpret the memory of pts'
Ptr{SVector{2,Float64}} @0x0000000129311bb0
julia> unsafe_wrap(Vector{SVector{2,Float64}},
ptr,
size(pts,1),true)
66-element Array{SVector{2,Float64},1}:
[1.0, 0.959493]
[1.0, 0.654861]
[1.0, 0.142315]
[1.0, -0.415415]
[1.0, -0.841254]
[1.0, -1.0]
[0.951057, 1.0]
[0.951057, 0.841254]
[0.951057, 0.415415]
[0.951057, -0.142315]
⋮
[-0.951057, -0.142315]
[-0.951057, -0.654861]
[-0.951057, -0.959493]
[-1.0, 0.959493]
[-1.0, 0.654861]
[-1.0, 0.142315]
[-1.0, -0.415415]
[-1.0, -0.841254]
[-1.0, -1.0]
julia>
from fasttransforms.jl.
Hmm, but it's unrelated to the question. If I transpose the points first, then it works on the first shot:
julia> using FastTransforms, StaticArrays
julia> pts=paduapoints(10)'
2×66 Array{Float64,2}:
1.0 1.0 1.0 1.0 1.0 1.0 0.951057 0.951057 0.951057 0.951057 0.951057 … -0.951057 -0.951057 -0.951057 -0.951057 -0.951057 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0
0.959493 0.654861 0.142315 -0.415415 -0.841254 -1.0 1.0 0.841254 0.415415 -0.142315 -0.654861 0.841254 0.415415 -0.142315 -0.654861 -0.959493 0.959493 0.654861 0.142315 -0.415415 -0.841254 -1.0
julia> ptr=reinterpret(Ptr{SVector{2,Float64}},pointer(pts)) # reinterpret the memory of pts'
Ptr{SVector{2,Float64}} @0x00000001261ca040
julia> unsafe_wrap(Vector{SVector{2,Float64}},
ptr,
size(pts,2),true)
66-element Array{SVector{2,Float64},1}:
[1.0, 0.959493]
[1.0, 0.654861]
[1.0, 0.142315]
[1.0, -0.415415]
[1.0, -0.841254]
[1.0, -1.0]
[0.951057, 1.0]
[0.951057, 0.841254]
[0.951057, 0.415415]
[0.951057, -0.142315]
[0.951057, -0.654861]
[0.951057, -0.959493]
[0.809017, 0.959493]
[0.809017, 0.654861]
[0.809017, 0.142315]
[0.809017, -0.415415]
[0.809017, -0.841254]
[0.809017, -1.0]
[0.587785, 1.0]
[0.587785, 0.841254]
[0.587785, 0.415415]
[0.587785, -0.142315]
[0.587785, -0.654861]
[0.587785, -0.959493]
[0.309017, 0.959493]
[0.309017, 0.654861]
[0.309017, 0.142315]
[0.309017, -0.415415]
[0.309017, -0.841254]
⋮
[-0.309017, 0.654861]
[-0.309017, 0.142315]
[-0.309017, -0.415415]
[-0.309017, -0.841254]
[-0.309017, -1.0]
[-0.587785, 1.0]
[-0.587785, 0.841254]
[-0.587785, 0.415415]
[-0.587785, -0.142315]
[-0.587785, -0.654861]
[-0.587785, -0.959493]
[-0.809017, 0.959493]
[-0.809017, 0.654861]
[-0.809017, 0.142315]
[-0.809017, -0.415415]
[-0.809017, -0.841254]
[-0.809017, -1.0]
[-0.951057, 1.0]
[-0.951057, 0.841254]
[-0.951057, 0.415415]
[-0.951057, -0.142315]
[-0.951057, -0.654861]
[-0.951057, -0.959493]
[-1.0, 0.959493]
[-1.0, 0.654861]
[-1.0, 0.142315]
[-1.0, -0.415415]
[-1.0, -0.841254]
[-1.0, -1.0]
julia>
from fasttransforms.jl.
For my purposes I need multi dimensional transforms. So, I want to be able to Approximate a function from 2D to ND and transform the whole thing. In that case columns representing each dimension make the most sense to me. But I’ve also gone back and forth on this three times. Ultimately the initial point storage really doesn’t matter much, since it has to be copied into the plan anyways.
from fasttransforms.jl.
How does that relate to Padua points? It sounds like you want the standard tensor transforms.
from fasttransforms.jl.
Yeah, it doesn't really relate. The relevant point for me (which I didn't mention) is that to me each column ought to represent one dimension and each row ought to represent a point, just because that's how I think about tables and matrices. Because Julia uses column major arrays one may be tempted to transpose the matrix but unless there's actually a significant performance gain, I would be hesitant.
For users for whom this is actually a performance bottleneck I would be more in favour of offering an iterator of points which users may collect in any way they like. The default would be to write them in a matrix as is currently done.
from fasttransforms.jl.
I don't think iterator is the right approach, better to be a lazy AbstractVector{SVector{2,T}}
.
from fasttransforms.jl.
For Padua points this doesn't work so well because the way you make them is by iterating through. You could rewrite the generation such that it uses explicit indexing but it would be a bit ugly. An iterator would be easier code.
In any case, is the creation of the points actually a performance bottleneck for anyone?
from fasttransforms.jl.
Here's the code in FastTransforms
FastTransforms.jl/src/PaduaTransform.jl
Lines 207 to 228 in 8be10bf
and here's my code
So, yeah, you can probably invert that to index explicitly but it might be a bit ugly.
from fasttransforms.jl.
Related Issues (20)
- jac2cheb: Crash on M1 (with Rosetta)
- Remove DSP dependency HOT 4
- Should multiplication of `FTPlan` take `StridedArray`s as arguments instead of `Array`s? HOT 1
- Move Chebyshev functionality to Chebyshevtransforms.jl
- What algorithm does cheb2leg() use? HOT 2
- Potentially suboptimal performance in r2r transforms? HOT 1
- sph methods slow? HOT 4
- Chebyshev transforms do not work with the FFTW v1.6. HOT 2
- Add a slow path in ultra2ultra transforms?
- Reduction in accuracy in `cheb2leg ∘ leg2cheb` on v0.15 HOT 4
- Regression in `ultra2ultra` with identical orders HOT 1
- Write test for Normalization in `cheb2leg` and `leg2cheb` HOT 4
- `cheb2ultra` seems unreasonably slow HOT 2
- Julia rewrite of libFastTransforms HOT 2
- 1d transforms with multi-dimensional regions are slow HOT 3
- Use Toeplitz-dot-Hankel for very large dimensional transforms HOT 4
- Add multidimensional interface for lib transforms HOT 3
- Avoid reexporting dependencies?
- Move out forwardrecurrence and clenshaw
- Segmentation fault for spherical harmonic transform HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fasttransforms.jl.