Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs

# Sporadic fixes in test_random.py
e76aa3a5a4b889c0434f0103ec102a50b93ab1ca
109 changes: 108 additions & 1 deletion mkl_random/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,58 @@

from . import _init_helper

from .mklrand import *
from .mklrand import (
MKLRandomState,
RandomState,
seed,
get_state,
set_state,
random_sample,
choice,
randint,
bytes,
uniform,
rand,
randn,
random_integers,
standard_normal,
normal,
beta,
exponential,
standard_exponential,
standard_gamma,
gamma,
f,
noncentral_f,
chisquare,
noncentral_chisquare,
standard_cauchy,
standard_t,
vonmises,
pareto,
weibull,
power,
laplace,
gumbel,
logistic,
lognormal,
rayleigh,
wald,
triangular,
binomial,
negative_binomial,
poisson,
zipf,
geometric,
hypergeometric,
logseries,
multivariate_normal,
multinormal_cholesky,
multinomial,
dirichlet,
shuffle,
permutation,
)
from ._version import __version__

try:
Expand All @@ -42,4 +93,60 @@
test = PytestTester(__name__)
del PytestTester

import mkl_random.interfaces

__all__ = [
"MKLRandomState",
"RandomState",
"seed",
"get_state",
"set_state",
"random_sample",
"choice",
"randint",
"bytes",
"uniform",
"rand",
"randn",
"random_integers",
"standard_normal",
"normal",
"beta",
"exponential",
"standard_exponential",
"standard_gamma",
"gamma",
"f",
"noncentral_f",
"chisquare",
"noncentral_chisquare",
"standard_cauchy",
"standard_t",
"vonmises",
"pareto",
"weibull",
"power",
"laplace",
"gumbel",
"logistic",
"lognormal",
"rayleigh",
"wald",
"triangular",
"binomial",
"negative_binomial",
"poisson",
"zipf",
"geometric",
"hypergeometric",
"logseries",
"multivariate_normal",
"multinormal_cholesky",
"multinomial",
"dirichlet",
"shuffle",
"permutation",
"interfaces",
]

del _init_helper
18 changes: 18 additions & 0 deletions mkl_random/interfaces/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Interfaces
The `mkl_random` package provides interfaces that serve as drop-in replacements for equivalent functions in NumPy.

---

## NumPy interface - `mkl_random.interfaces.numpy_random`

This interface is a drop-in replacement for the legacy portion of the [`numpy.random`](https://numpy.org/devdocs/reference/random/legacy.html) module and includes **all** classes and functions available there:

* random generator: `RandomState`.

* seeding and state functions: `get_state`, `set_state`, and `seed`.

* simple random data: `rand`, `randn`, `randint`, `random_integers`, `random_sample`, `choice` and `bytes`.

* permutations: `shuffle` and `permutation`

* distributions: `beta`, `binomial`, `chisquare`, `dirichlet`, `exponential`, `f`, `gamma`, `geometric`, `gumbel`, `hypergeometric`, `laplace`, `logistic`, `lognormal`, `multinomial`, `multivariate_normal`, `negative_binomial`, `noncentral_chisquare`, `noncentral_f`, `normal`, `pareto`, `poisson`, `power`, `rayleigh`, `standard_cauchy`, `standard_exponential`, `standard_gamma`, `standard_normal`, `standard_t`, `triangular`, `uniform`, `vonmises`, `wald`, `weibull`, and `zipf`.
27 changes: 27 additions & 0 deletions mkl_random/interfaces/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python
# Copyright (c) 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from . import numpy_random
Loading
Loading