Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validated transforms #94

Open
MikaelSlevinsky opened this issue Nov 28, 2019 · 0 comments
Open

Validated transforms #94

MikaelSlevinsky opened this issue Nov 28, 2019 · 0 comments
Labels

Comments

@MikaelSlevinsky
Copy link
Member

This would be fun. As seen below, it almost "just works," but would require a careful investigation into https://github.com/MikaelSlevinsky/FastTransforms/blob/master/src/transforms_mpfr.c. The ccalls pass on Base.MPFR.RoundingMode[] to the C library, so it's just a matter of making sure every arithmetic operation is appropriate for RoundUp/Down. For example, I think the token error is due to using mpfr_neg.

julia> using FastTransforms

julia> setrounding(BigFloat, RoundDown)
MPFRRoundDown::MPFRRoundingMode = 3

julia> pd = plan_leg2cheb(BigFloat, 10)
FastTransforms Legendre--Chebyshev plan for 10-element array of BigFloat

julia> Pd = lmul!(pd, Matrix{BigFloat}(I, 10, 10));

julia> setrounding(BigFloat, RoundUp)
MPFRRoundUp::MPFRRoundingMode = 2

julia> pu = plan_leg2cheb(BigFloat, 10)
FastTransforms Legendre--Chebyshev plan for 10-element array of BigFloat

julia> Pu = lmul!(pu, Matrix{BigFloat}(I, 10, 10));

julia> Pu-Pd # rigorously off by only one entry
10×10 Array{BigFloat,2}:
 0.0  0.0  -2.15904e-78  0.0          2.15904e-78  0.0          2.15904e-78  0.0          3.23856e-78  0.0        
 0.0  0.0   0.0          8.63617e-78  0.0          8.63617e-78  0.0          1.07952e-77  0.0          8.63617e-78
 0.0  0.0   0.0          0.0          8.63617e-78  0.0          8.63617e-78  0.0          1.07952e-77  0.0        
 0.0  0.0   0.0          1.72723e-77  0.0          1.29543e-77  0.0          1.29543e-77  0.0          1.29543e-77
 0.0  0.0   0.0          0.0          1.72723e-77  0.0          1.72723e-77  0.0          1.51133e-77  0.0        
 0.0  0.0   0.0          0.0          0.0          2.59085e-77  0.0          1.94314e-77  0.0          1.51133e-77
 0.0  0.0   0.0          0.0          0.0          0.0          3.45447e-77  0.0          1.94314e-77  0.0        
 0.0  0.0   0.0          0.0          0.0          0.0          0.0          3.88628e-77  0.0          2.15904e-77
 0.0  0.0   0.0          0.0          0.0          0.0          0.0          0.0          3.88628e-77  0.0        
 0.0  0.0   0.0          0.0          0.0          0.0          0.0          0.0          0.0          4.31808e-77

julia> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant