peng-lab/BaSiCPy

Implement a DCT abstract base class

Closed this issue · 2 comments

The discrete cosine transform is one of the core computations in BaSiC. There is interest in benchmarking the DCT from different libraries, and there may be merit to support different approaches based on dependency issues. Thus, we should institute an abstract base class that defines expected methods for different implementations.

  • Create an abstract base class with methods dct() and idct().
  • Implement the existing DCT approach from the main branch, using scipy.dct and scipy.idct
  • Create autogenerated unit tests that find different implementations of DCT
  • Create autogenerated benchmarks that run different implementations of the DCT

Should we incorporate a global or env variable into this like DCT_BACKEND?

Then use something like dct_factory with DCT_BACKEND determining the concrete DCT class.

That's a good question. I don't see the problem with implementing something like that. I was thinking we could just have a dictionary that maps a set of backend keys to classes, and then we can have dct_backend be an input into BaSiC for now. My guess is that our final implementation will only have Jax in it, so a lot of this will probably just be temporary code while we do benchmarking.