Coder Social home page Coder Social logo

Comments (3)

imraniac avatar imraniac commented on May 30, 2024

The problem might be in CO_AutoCorr.c, there are two definitions of the complex data type which depends on the compiler.

#if defined(__GNUC__) || defined(__GNUG__)
typedef double complex cplx;
#elif defined(_MSC_VER)
typedef _Dcomplex cplx;

There could be an implementation bug which needs to be resolved

from catch22.

chlubba avatar chlubba commented on May 30, 2024

Hi @imraniac,

thank you for taking a look into the code. You are right that this compiler-depencency is the source of differences between platforms.

Unfortunately, it is to our knowledge unavoidable to branch on the type of compiler because the implementation of complex numbers differs between GCC (Linux) and the MS Visual Studio compiler (Windows). The complex datatype and the associated methods are different between these compilers. Therefore, no single, identical version of the code works for both. I.e. if you write the code to work for GCC, it won't run on Windows and vice versa. The only solution so far to make catch22 compile using either compiler, are these preprocessor-branches you identified and two different versions of the C-implementation, one for each compiler.

And apparently, some complex number computations differ between the two catch22 versions. The differences most likely affect the FFT, accordingly the co_autocorr function, and possibly other functions.

Suggestions on how to handle the complex data-type in a unified way across platforms are very welcome! Otherwise the two different branches of the C-implementation have to become better aligned to behave exactly identically.

Carl

from catch22.

chlubba avatar chlubba commented on May 30, 2024

This issue should now be fixed in release v0.2.0 onwards.

from catch22.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.