grand 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -11
  3. data/lib/grand/version.rb +1 -1
  4. data/lib/grand.rb +2 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f657eb7e201e1d99586c69a65b93231e5944c011
4
- data.tar.gz: d2156e38330556779ea2ba4712cd32a3979cd1df
3
+ metadata.gz: 79966081fc76d3aa05452572e08c7c2a993ec01e
4
+ data.tar.gz: 6ceeb90e5a9262cb773301684c97bc85b391c8c3
5
5
  SHA512:
6
- metadata.gz: 2500d29d7b0dce3769ba68889e82d93696f897913cc75c397e94e3d40d49c6e91c6360c6f093f1c084e7aa9e184a646eb4a137691c6678a6b038fecec269cdc3
7
- data.tar.gz: e0b855e118fb0f66c5f036a12f403597402a91733c2142f13ec5b74f821a22a05be82a71c9622b71c9cb79b374141f55396a528869f323f93a9ed1361f0ea24b
6
+ metadata.gz: 32e08c56d809188e322881e4e6f5d572e3d476824c09c372fbd67625e725e8521f613d6f7d9ba9322e58948142abb5916a83c150c0d36f194d314ffa014a8ad6
7
+ data.tar.gz: 3bf5b3959ddec40e8e5315eb73aeefa1aeb19e27165a76b8758789127147d7e2bf86bea7d49c5e3d04c6f4a521a7f5f672eceeef1352e79cb0e6c324d132a0c0
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # GRand
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/grand`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
3
  I needed something similar to `nrand` in numpy. see - https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randn.html
6
4
 
7
5
  ## Installation
@@ -23,15 +21,17 @@ Or install it yourself as:
23
21
  ## Usage
24
22
 
25
23
  > require 'grand'
26
- => true
27
- > GRand::nrand(1, 2)
28
- => [[-0.5259311445434742, 0.5058339155942712]]
29
- > GRand::nrand(3, 2)
30
- => [[1.0015454079393156, -0.2544992806165275], [-0.7978337095145441, -1.7813946216288779], [0.9631364295796622, 2.157358119782299]]
31
- > GRand::nrand(2, 1)
32
- => [[-0.634759160869425], [0.549004503513128]]
33
- > GRand::nrand(3, 3, 3)
34
- => [[[-1.689589847133065, -0.41054654640696786, 0.36381728856120105], [-0.9437196021569799, 1.19558636009585, -1.1605453269136559], [1.0837506708104712, -1.1395537425254014, 0.5925022408229144]], [[-1.7133014088074843, -0.805051352081152, 0.3746241803203248], [0.3642622933280586, 0.5843943798812012, 1.141236536447513], [-0.25543269419159714, 1.1743836190357984, -0.5161554049975062]], [[-0.03303459622587511, -3.5547854922416438, 0.17581738567933877], [-0.979119743081027, 1.397273496753393, 0.18670646583239753], [-0.26985128879011183, -0.5662975999343106, 0.46600852896034334]]]
24
+ => true
25
+ > GRand::randn
26
+ => 0.8459468356387407
27
+ > GRand::randn(1, 2)
28
+ => [[-0.5259311445434742, 0.5058339155942712]]
29
+ > GRand::rand(n3, 2)
30
+ => [[1.0015454079393156, -0.2544992806165275], [-0.7978337095145441, -1.7813946216288779], [0.9631364295796622, 2.157358119782299]]
31
+ > GRand::randn(2, 1)
32
+ => [[-0.634759160869425], [0.549004503513128]]
33
+ > GRand::randn(3, 3, 3)
34
+ => [[[-1.689589847133065, -0.41054654640696786, 0.36381728856120105], [-0.9437196021569799, 1.19558636009585, -1.1605453269136559], [1.0837506708104712, -1.1395537425254014, 0.5925022408229144]], [[-1.7133014088074843, -0.805051352081152, 0.3746241803203248], [0.3642622933280586, 0.5843943798812012, 1.141236536447513], [-0.25543269419159714, 1.1743836190357984, -0.5161554049975062]], [[-0.03303459622587511, -3.5547854922416438, 0.17581738567933877], [-0.979119743081027, 1.397273496753393, 0.18670646583239753], [-0.26985128879011183, -0.5662975999343106, 0.46600852896034334]]]
35
35
 
36
36
  ## Development
37
37
 
data/lib/grand/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GRand
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
data/lib/grand.rb CHANGED
@@ -2,11 +2,11 @@ require 'grand/version'
2
2
  require 'rubystats'
3
3
 
4
4
  module GRand
5
- def self.nrand(*d)
5
+ def self.randn(*d)
6
6
  return normal_distribution.rng if d.size == 0
7
7
 
8
8
  x = d.shift
9
- x.times.map{ self.nrand(*d) }
9
+ x.times.map{ self.randn(*d) }
10
10
  end
11
11
 
12
12
  def self.normal_distribution
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Ostermayr