cephes | Mirror of the Cephes C source for reference

 by   jeremybarnes C Version: Current License: No License

kandi X-RAY | cephes Summary

kandi X-RAY | cephes Summary

cephes is a C library. cephes has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

Mirror of the Cephes C source for reference
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              cephes has a low active ecosystem.
              It has 72 star(s) with 26 fork(s). There are 8 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              cephes has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of cephes is current.

            kandi-Quality Quality

              cephes has no bugs reported.

            kandi-Security Security

              cephes has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              cephes does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              cephes releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cephes
            Get all kandi verified functions for this library.

            cephes Key Features

            No Key Features are available at this moment for cephes.

            cephes Examples and Code Snippets

            No Code Snippets are available at this moment for cephes.

            Community Discussions

            QUESTION

            Python - OpenDrive Map - Spiral / Clothoid / Euler Spiral / Cornu Spiral Interpolation using Fresnel Integrals
            Asked 2019-Oct-25 at 13:39

            The map format OpenDrive, provides (among others) the geometry of a road. Each segment of the road can have a different geometry (e.g. line, arc, spiral, polynomial). The provided information for a road geometry "spiral", is the following:

            ...

            ANSWER

            Answered 2018-Mar-06 at 13:43

            I am not sure if your current code is correct. I wrote a short script to interpolate Euler spirals using similar parameters and it gives different results:

            Source https://stackoverflow.com/questions/48884655

            QUESTION

            Writing a Typescript Library with a Web Assembly Dependency?
            Asked 2019-May-23 at 21:25

            I'm planning on writing a typescript library for distributions on that will depend on cephes.

            In order for the web assembly to be used in the browser we have to compile it like this:

            ...

            ANSWER

            Answered 2019-May-23 at 21:25

            I think you should be as straightforward as possible. Since your consumers can't really get around having to await, I would suggest that you leave it to your consumers to await cephes.compiled.

            If you're bundling cephes, you might want to re-export cephes.compiled from your library so that your consumers can just use your library:

            Source https://stackoverflow.com/questions/56282457

            QUESTION

            How does Numpy/Scipy turn C functions into vectorized Python functions?
            Asked 2019-Jan-17 at 14:23

            As I understand it, vectorized numpy functions are faster than Python loops because loops are done in C or Fortran. I would like to know where in the source code this happens.

            For example, the scipy.special.bdtr binomial CDF function accepts array-like arguments k,n,p and will return an ndarray provided the arguments are broadcastable. The documentation says that scipy.special.bdtr is a wrapper for a routine in the Cephes Mathematical Functions Library. Digging through the source code on Github, I found a scipy/special/cephes/bdtr.c file containing the C code for the routine; here are what I believe to be the first three lines of the relevant C function:

            double bdtr(k, n, p)

            int k, n;

            double p;

            It appears that the underlying C function does not operate on arrays, and I can't find the source code where this function is converted to a Python function that operates on arrays.

            ...

            ANSWER

            Answered 2019-Jan-17 at 14:23

            In the case of scipy.special functions, the C code only contains the "kernels" of the functions, that is, how to apply the function to scalars. Each of these is then wrapped into a ufunc with automatically generated Cython code. To do this, it uses C header files, like scipy/special/cephes.h, Cython declaration files, like scipy/special/_cephes.pxd, the file scipy/special/functions.json, where all the functions to be generated for scipy.special are listed, and finally scipy/special/_generate_pyx.py, which is where the Cython code is actually produced.

            Source https://stackoverflow.com/questions/54237595

            QUESTION

            Why does my scipy build break?
            Asked 2017-Oct-26 at 08:29

            I am new to scientific computing and trying to contribute to scipy but I can't get it to build.

            I git clone'd the source then ran python setup.py build. I get a break saying:

            scipy/special/cephes/bdtr.c: In function ‘cephes_bdtrc’: scipy/special/cephes/bdtr.c:157:5: error: non-floating-point argument in call to function ‘__builtin_isnan’ if (npy_isnan(k) || npy_isnan(n) || npy_isnan(p)) {

            Ubuntu 16.04, Intel i7. For other work I have Anaconda 1.6.3 installed. Python 2.7.13 and gfortran.

            I followed the setup here and here.

            Any ideas? Maybe a gcc switch?

            ...

            ANSWER

            Answered 2017-Oct-26 at 08:29

            This appears to be a bug in this particular scipy/numpy combination. n and k are integer variables, so they cannot be NaNs, introduced in commit ede5590b12dbeecd244fdafa4443b6c3a9d9ef40 (BUG: special: fix ufunc results for nan arguments).

            You could change the reported line locally to

            Source https://stackoverflow.com/questions/46943869

            QUESTION

            sine cosine modular extended precision arithmetic
            Asked 2017-Mar-01 at 20:31

            I've seen in many impletation of sine/cosine a so called extended modular precision arithmetic. But what it is for? For instance in the cephes implemetation, after reduction to the range [0,pi/4], they are doing this modular precision arithmetic to improve the precision.

            Hereunder the code:

            ...

            ANSWER

            Answered 2017-Mar-01 at 20:31

            In the context of argument reduction for trigonometric functions, what you are looking at is Cody-Waite argument reduction, a technique introduced in the book: William J. Cody and William Waite, Software Manual for the Elementary Functions, Prentice-Hall, 1980. The goal is to achieve, for arguments up to a certain magnitude, an accurate reduced argument, despite subtractive cancellation in intermediate computation. For this purpose, the relevant constant is represented with more than native precision, by using a sum of multiple numbers of decreasing magnitude (here: DP1, DP2, DP3), such that all of the intermediate products except the least significant one can be computed without rounding error.

            Consider as an example the computation of sin (113) in IEEE-754 binary32 (single precision). The typical argument reduction would conceptually compute i=rintf(x/(π/2)); reduced_x = x-i*(π/2). The binary32 number closest to π/2 is 0x1.921fb6p+0. We compute i=72, the product rounds to 0x1.c463acp+6, which is close to the argument x=0x1.c40000p+6. During subtraction, some leading bits cancel, and we wind up with reduced_x = -0x1.8eb000p-4. Note the trailing zeros introduced by renormalization. These zero bits carry no useful information. Applying an accurate approximation to the reduced argument, sin(x) = -0x1.8e0eeap-4, whereas the true result is -0x1.8e0e9d39...p-4. We wind up with large relative error and large ulp error.

            We can remedy this by using a two-step Cody-Waite argument reduction. For example, we could use pio2_hi = 0x1.921f00p+0, and pio2_lo = 0x1.6a8886p-17. Note the eight trailing zero bits in single-precision representation ofpio2_hi, which allow us to multiply with any 8-bit integer i and still have the product i * pio2_hi representable exactly as a single-precision number. When we compute ((x - i * pio2_hi) - i * pio2_lo), we get reduced_x = -0x1.8eafb4p-4, and therefore sin(x) = -0x1.8e0e9ep-4, a quite accurate result.

            The best way to split the constant into a sum will depend on the magnitude of i we need to handle, on the maximum number of bits subject to subtractive cancellation for a given argument range (based on how close integer multiples of π/2 can get to integers), and performance considerations. Typical real-life use cases involve two- to four-stage Cody-Waite reduction schemes. The availability of fused multiple-add (FMA) allows the use of constituent constants with fewer trailing zero bits. See this paper: Sylvie Boldo, Marc Daumas, and Ren-Cang Li, "Formally verified argument reduction with a fused multiply-add." IEEE Transactions on Computers, 58 :1139–1145, 2009. For a worked example using fmaf() you might want to look at the code in one of my previous answers.

            Source https://stackoverflow.com/questions/42455143

            QUESTION

            Pure-Python inverse error function
            Asked 2017-Feb-22 at 12:09

            Are there any pure-python implementations of the inverse error function?

            I know that SciPy has scipy.special.erfinv(), but that relies on some C extensions. I'd like a pure python implementation.

            I've tried writing my own using the Wikipedia and Wolfram references, but it always seems to diverge from the true value when the arg is > 0.9.

            I've also attempted to port the underlying C code that Scipy uses (ndtri.c and the cephes polevl.c functions) but that's also not passing my unit tests.

            Edit: As requested, I've added the ported code.

            Docstrings (and doctests) have been removed because they're longer than the functions. I haven't yet put much effort into making the port more pythonic - I'll worry about that once I get something that passes unit tests.

            Supporting functions from cephes polevl.c ...

            ANSWER

            Answered 2017-Feb-22 at 02:12

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install cephes

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/jeremybarnes/cephes.git

          • CLI

            gh repo clone jeremybarnes/cephes

          • sshUrl

            git@github.com:jeremybarnes/cephes.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular C Libraries

            linux

            by torvalds

            scrcpy

            by Genymobile

            netdata

            by netdata

            redis

            by redis

            git

            by git

            Try Top Libraries by jeremybarnes

            jml

            by jeremybarnesC++

            github_contest

            by jeremybarnesC++

            cityhash

            by jeremybarnesShell

            libjmvcc

            by jeremybarnesC++

            ausdm

            by jeremybarnesC++