narray-convolve 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/README.md +10 -3
- data/lib/narray/convolve.rb +6 -7
- data/lib/narray/convolve/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfd31093f42b3aba3b73b6d43bd2e116c17634dbf25bb15da61a56080d4e3f9d
|
4
|
+
data.tar.gz: aa8c262649563c8919707c7f84ecde53d28db7eebf9a8ab0571d0e9bc6a1e3e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312ee0156ad4e5910a30c50c9c005ba5de37aaa9cb9333b01e4a0277243450a55031afd83446cac393d1a4cef25e5c42e9062ee1510a01c6a8cd24925067ed68
|
7
|
+
data.tar.gz: 7afa89c66ca279dcf07b7a4e6e089a5101688f46a4ecedde9f00c516332fee4588d2b1b183065188f421fb63a58b4de2fde460e029d6bcdd845124a796f6a067
|
data/README.md
CHANGED
@@ -23,7 +23,8 @@ Or install it yourself as:
|
|
23
23
|
## Usage
|
24
24
|
|
25
25
|
Narray::Convolve is similar to numpy.convolve, but with a different order of second arguments.
|
26
|
-
|
26
|
+
|
27
|
+
```ruby
|
27
28
|
irb(main):001:0> require "narray/convolve"
|
28
29
|
=> true
|
29
30
|
irb(main):002:0> n = Numo::DFloat[1,2,3]
|
@@ -39,15 +40,21 @@ irb(main):004:0> Narray::Convolve.convolve(n, m, :same)
|
|
39
40
|
Numo::DFloat(view)#shape=[3]
|
40
41
|
[1, 2.5, 4]
|
41
42
|
```
|
43
|
+
or
|
44
|
+
```ruby
|
45
|
+
> Narray::Convolve.convolve([1,2,3], [0,1,0.5].reverse, :same)
|
46
|
+
=> [1, 2.5, 4]
|
47
|
+
```
|
48
|
+
|
42
49
|
|
43
50
|
In case of Python
|
44
|
-
```
|
51
|
+
```python
|
45
52
|
>>> import numpy as np
|
46
53
|
>>> np.convolve([1,2,3],[0,1,0.5], 'same')
|
47
54
|
array([1. , 2.5, 4. ])
|
48
55
|
>>>
|
49
56
|
```
|
50
|
-
|
57
|
+
See also: [numpy.convolve — NumPy v1.20 Manual](https://numpy.org/doc/stable/reference/generated/numpy.convolve.html#numpy-convolve)
|
51
58
|
|
52
59
|
|
53
60
|
|
data/lib/narray/convolve.rb
CHANGED
@@ -9,9 +9,7 @@ module Narray
|
|
9
9
|
# Narray::Convolve is similar to numpy.convolve,
|
10
10
|
# but with a different order of second arguments.
|
11
11
|
#
|
12
|
-
# @example
|
13
|
-
# Narray::Convolve
|
14
|
-
#
|
12
|
+
# @example Narray::Convolve
|
15
13
|
# require "narray/convolve"
|
16
14
|
# n = Numo::DFloat[1,2,3]
|
17
15
|
# m = Numo::DFloat[0,1,0.5].reverse
|
@@ -23,14 +21,15 @@ module Narray
|
|
23
21
|
# Narray::Convolve.convolve([1,2,3], [0,1,0.5].reverse, :same)
|
24
22
|
# # => [1, 2.5, 4]
|
25
23
|
#
|
26
|
-
#
|
24
|
+
#
|
25
|
+
# @example In case of numpy.convolve
|
27
26
|
# >>> numpy.convolve([1,2,3],[0,1,0.5], 'same')
|
28
27
|
# array([1. , 2.5, 4. ])
|
29
|
-
#
|
28
|
+
# @See https://numpy.org/doc/stable/reference/generated/numpy.convolve.html#numpy-convolve [numpy.convolve — NumPy v1.20 Manual]
|
30
29
|
#
|
31
30
|
#
|
32
|
-
# @param n [Numo::DFloat or Array]
|
33
|
-
# @param m [Numo::DFloat or Array]
|
31
|
+
# @param n [Numo::DFloat or Array] 1st 1-dimensional input array.
|
32
|
+
# @param m [Numo::DFloat or Array] 2nd 1-dimensional input array.
|
34
33
|
# @param mode [Symbol] (:full, :same, :valid)
|
35
34
|
#
|
36
35
|
# @return [Numo::DFloat] convolution of n and m.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: narray-convolve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icm7216
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|