New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing numpy.random distributions #1343
Merged
serge-sans-paille
merged 1 commit into
serge-sans-paille:master
from
PierreBlancfat:master
Sep 27, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_CHISQUARE_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_CHISQUARE_HPP | ||
|
||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> chisquare(float df, pS const &shape); | ||
|
||
auto chisquare(float df, long size) | ||
-> decltype(chisquare(df, types::array<long, 1>{{size}})); | ||
|
||
double chisquare(float df, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, chisquare); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_DIRICHLET_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_DIRICHLET_HPP | ||
|
||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> dirichlet(double alpha, pS const &shape); | ||
|
||
auto dirichlet(double alpha, long size) | ||
-> decltype(dirichlet(alpha, types::array<long, 1>{{size}})); | ||
|
||
double dirichlet(double alpha, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, dirichlet); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_EXPONENTIAL_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_EXPONENTIAL_HPP | ||
|
||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> exponential(double scale, pS const &shape); | ||
|
||
auto exponential(double scale, long size) | ||
-> decltype(exponential(scale, types::array<long, 1>{{size}})); | ||
|
||
double exponential(double scale = 1.0, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, exponential); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_F_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_F_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> f(double dfnum, double dfden, pS const &shape); | ||
|
||
auto f(double dfnum, double dfden, long size) | ||
-> decltype(f(dfnum, dfden, types::array<long, 1>{{size}})); | ||
|
||
double f(double dfnum, double dfden, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, f); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_GAMMA_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_GAMMA_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> gamma(double shape, double scale, | ||
pS const &array_shape); | ||
|
||
auto gamma(double shape, double scale, long size) | ||
-> decltype(gamma(shape, scale, types::array<long, 1>{{size}})); | ||
|
||
double gamma(double shape = 0.0, double scale = 1.0, | ||
types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, gamma); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_GEOMETRIC_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_GEOMETRIC_HPP | ||
|
||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> geometric(double p, pS const &shape); | ||
|
||
auto geometric(double p, long size) | ||
-> decltype(geometric(p, types::array<long, 1>{{size}})); | ||
|
||
double geometric(double, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, geometric); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_GUMBEL_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_GUMBEL_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> gumbel(double loc, double scale, | ||
pS const &shape); | ||
|
||
auto gumbel(double loc, double scale, long size) | ||
-> decltype(gumbel(loc, scale, types::array<long, 1>{{size}})); | ||
|
||
double gumbel(double loc = 0.0, double scale = 1.0, | ||
types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, gumbel); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LAPLACE_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_LAPLACE_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> laplace(double loc, double scale, | ||
pS const &shape); | ||
|
||
auto laplace(double loc, double scale, long size) | ||
-> decltype(laplace(loc, scale, types::array<long, 1>{{size}})); | ||
|
||
double laplace(double loc = 0.0, double scale = 1.0, | ||
types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, laplace); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGISTIC_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGISTIC_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> logistic(double loc, double scale, | ||
pS const &shape); | ||
|
||
auto logistic(double loc, double scale, long size) | ||
-> decltype(logistic(loc, scale, types::array<long, 1>{{size}})); | ||
|
||
double logistic(double loc = 0.0, double scale = 1.0, | ||
types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, logistic); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGNORMAL_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGNORMAL_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> lognormal(double mean, double sigma, | ||
pS const &shape); | ||
|
||
auto lognormal(double mean, double sigma, long size) | ||
-> decltype(lognormal(mean, sigma, types::array<long, 1>{{size}})); | ||
|
||
double lognormal(double mean = 0.0, double sigma = 1.0, | ||
types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, lognormal); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGSERIES_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGSERIES_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> logseries(double loc, pS const &shape); | ||
|
||
auto logseries(double loc, long size) | ||
-> decltype(logseries(loc, types::array<long, 1>{{size}})); | ||
|
||
double logseries(double loc, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, logseries); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
28 changes: 28 additions & 0 deletions
28
pythran/pythonic/include/numpy/random/negative_binomial.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_NEGATIVE_BINOMIAL_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_NEGATIVE_BINOMIAL_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> negative_binomial(double n, double p, | ||
pS const &shape); | ||
|
||
auto negative_binomial(double n, double p, long size) | ||
-> decltype(negative_binomial(n, p, types::array<long, 1>{{size}})); | ||
|
||
double negative_binomial(double n, double p, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, negative_binomial); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_PARETO_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_RANDOM_PARETO_HPP | ||
|
||
#include "pythonic/include/types/NoneType.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/types/tuple.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
#include <math.h> | ||
|
||
PYTHONIC_NS_BEGIN | ||
namespace numpy | ||
{ | ||
namespace random | ||
{ | ||
template <class pS> | ||
types::ndarray<double, pS> pareto(double a, pS const &shape); | ||
|
||
auto pareto(double a, long size) | ||
-> decltype(pareto(a, types::array<long, 1>{{size}})); | ||
|
||
double pareto(double a, types::none_type size = {}); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy::random, pareto); | ||
} | ||
} | ||
PYTHONIC_NS_END | ||
|
||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/float/double/ ?