Skip to content

Template for double #54

Open
Open

Description

@stellarpower

I'm guessing there may be a reason linked deeply into the algorithm to use single-precision floats, instead of doubles, which are often the default in many applications and libraries today.

Would it be possible to template the algorithm's fundamental storage type in order to be able to use single- or double-precision floating-point numbers (or perhaps, even some more exotic types should there be a reason for these)?

Thanks

Activity

  1. fastlib commented on Jan 6, 2025

    @fastlib
    Owner

    Using single-precision floats instead of doubles has one major (and obvious) advantage: memory efficiency. Using singles reduces the number of cachemisses in the L caches, reduces memory usage and allows fftw to make better optimization plans. The only downside is the loss of precision. However, in my experience, the effect of this is negligible for the majority of real-world applications.

    I would be possible to make a templated version for fCWT, but why would you want this? I think it is less work to make a wrapper in said environments. I'm not sure, but my guess is that converting your signal from doubles to singles is much faster than doing the entire calculation in doubles.

  2. stellarpower commented on Jan 6, 2025

    @stellarpower
    ContributorAuthor

    Afraid as it was a year ago, so as of now I can't remember at all. I can see if I can check my code back again, although these days I'm using neural nets instead to get lower latency. Just allowing the compiler to cast is trivial so whether it was precision or some sort of ABI compatibility, I must have had a reason I was hitting to open the ticket. Although I also think templating is nice in general, then the user-programmer can choose, and it can open up the route for more optimisation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions