Skip to content

Validated transforms #94

Open
Open
@MikaelSlevinsky

Description

@MikaelSlevinsky

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> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions