GithubHelp home page GithubHelp logo

astralord / randlib Goto Github PK

View Code? Open in Web Editor NEW
71.0 8.0 12.0 11.24 MB

:rocket: A library designed to facilitate work with probability, statistics and stochastic calculus

License: MIT License

C++ 98.31% C 0.52% QMake 1.17%
random stochastic random-number-generators probability-distributions mathematics statistics c-plus-plus c-plus-plus-17 normal-distribution gamma-distribution

randlib's Issues

Severe integer overflow occuring, leading to undefined behavior

200896062499134299656951336898466838917540340798867777940435335160044860953395980941180138112097309735631594101037399609671032132186331495273609598531966730972945653558819806475064353856858157445040809209560358463319644664891114256430017824141796753818192338642302693327818731986039603200000000000000000000000000000000000000000000.l,
9680322675255249156123346514615331205418161260462873360750859919944104623425228207640470674933540169424682360525991982916161596983449594045525553704253602287443197783274656957056546338783001340434094795097553229620273057440272298773179365935914105128629426348958748638226084106818484328004851174161755668480000000000000000000000000000000000000000000000.l,
788657867364790503552363213932185062295135977687173263294742533244359449963403342920304284011984623904177212138919638830257642790242637105061926624952829931113462857270763317237396988943922445621451664240254033291864131227428294853277524242407573903240321257405579568660226031904170324062351700858796178922222789623703897374720000000000000000000000000000000000000000000000000.l,
105823620292236563784274284243348353057589905787169019562352737522144487532400210147849369011714673954768265316577892528273760626189481169051055226066650741189573897273684791411180134039439160066561895838501000817711682625725670477616267598661259194975646029749546282594356217374097544153589482020891750774735012558313460846824864172030239122128896000000000000000000000000000000000000000000000000000.l,
22838603359146414573972658651153337270429730715462287017736347161260276926030248458777765497919211029457065581960747795750095505232241970499561769723020565876672261660609763234049775547325430135571331468257475537994508495233770658945310210552725163342784668756149049213658078338458534285571551800849578848226429898670032945513859929938621783523490272646966918544936140800000000000000000000000000000000000000000000000000000.l,
7758587304686725201813174298892781442413952130995533365303964524344944412641389739603152000644515957408814002319492032321234250506968028455594445689972313374305301019340949789291189972149450405025159624155827152329676580440959428615802893638146558163235483142136540783687811997927615346859658417205832954125915861983307177232587595821512723429698627780530255874167602077755356592824804966400000000000000000000000000000000000000000000000000000000.l,
4067885363647058120493575921486885310172051259182827146069755969081486918925585104009100729728348522923820890245870098659147156051905732563147381599098459244752463027688115705371704628286326621238456543307267608612545168337779669138759451760395968217423617954330737034164596496963986817722252221059768080852489940995605579171999666916004042965293896799800598079985264195119506681577622056215044851618236292136960000000000000000000000000000000000000000000000000000000000.l,
3232856260909107732320814552024368470994843717673780666747942427112823747555111209488817915371028199450928507353189432926730931712808990822791030279071281921676527240189264733218041186261006832925365133678939089569935713530175040513178760077247933065402339006164825552248819436572586057399222641254832982204849137721776650641276858807153128978777672951913990844377478702589172973255150283241787320658188482062478582659808848825548800000000000000000000000000000000000000000000000000000000000000.l,

There is no way these values could be properly represented as the long double type you defined them as. See this article from GeeksforGeeks for a simple reference on why this occurs and how this could be affecting your intended values. And this StackOverflow post is pertinent because of the type declaration.

Some of the functions declared constexpr are not cross-compilable

I don't know if this is directly pertinent to you, depending on what platforms you want to support. If it's not feel free to close the issue.

There are a multitude of places throughout the code base that use the identifier constexpr, but make calls to std::pow, std::log, and std::sqrt in the definitions. These are not actually defined as constexpr in the c++ standard (see this stackoverflow post) and as such any standard compiler other than GCC will throw errors when trying to compile the library.

I have made a workaround for this on my personal fork of this repository using a few header only files from the kthohr/gcem library. I don't know if you want to bring in external libraries but it is at least worth looking at if you need a launch point. Likewise, you are welcome to review my fork for reference. If you want I will be happy to open a pull request from that fork here, but there are significant modifications to the structuring and include paths on mine (It's currently a work in progress).

Implement special functions

  • logarithm of modified Bessel function of the first and second kind

  • lower and upper incomplete gamma functions (and their logarithms)

  • Marcum-Q and Marcum-P functions

  • erfinv and erfcinv

  • incomplete beta function

Implement log-stable distribution

Most of the properties of log-stable distribution are easy to derive using the relationship with stable distribution. However, the problem arises with characteristic function, which can't be expressed analytically and is hard to compute numerically due to singularity of probability density function at point 0 in some cases (e.g. Log-Cauchy distribution). All ideas are welcome.

Use C++17 simplifications

  • Use structured bindings, e.g.
    auto [a, b, c] = array
    instead of
    std::tie(a, b, c) = array
    Search by DoublePair or std::tuple. This could also be useful for loops through tuple arrays (if one uses std::map in pdf for example)
  • Init statements for if / switch (look for temp variables)

Unit-testing

  • maximum likelihood fit: f(a-eps) < f(a) < f(a+eps)

  • mode value: f(x-eps) < f(x) < f(x+eps)

  • pdf and logpdf coherence: f(x) = exp(logf(x))

Implement pdf and cdf for stable distribution

The problems are with

  • alpha close to 1 with non-zero beta
  • beta close to 0, when alpha = 1
  • asymptotic series expansion for alpha = 1 and non-zero beta
  • cdf representation for short tails (beta = 1)

Problems

cloned this repository.
But in Qt creator has problem : no viable constructor or deduction guide for deduction of template arguments of 'NormalRand';
Wrote code according your manual
NormalRand X(0, 1);
std::vector data(1e6);
X.Sample(data);

Change Fit interface

Use Fit() for MLE and Fit(unbiased = true) for UMVU. Remove method of moments

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.