tatara 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +23 -0
- data/Gemfile.lock +2 -2
- data/README.md +4 -0
- data/docs/_config.yml +1 -0
- data/docs/index.md +100 -0
- data/docs/tatara/float.md +425 -0
- data/docs/tatara/float_array.md +256 -0
- data/docs/tatara/float_float_map.md +52 -0
- data/docs/tatara/float_integer_map.md +52 -0
- data/docs/tatara/float_string_map.md +52 -0
- data/docs/tatara/float_vector.md +269 -0
- data/docs/tatara/integer.md +480 -0
- data/docs/tatara/integer_array.md +256 -0
- data/docs/tatara/integer_float_map.md +52 -0
- data/docs/tatara/integer_integer_map.md +52 -0
- data/docs/tatara/integer_string_map.md +52 -0
- data/docs/tatara/integer_vector.md +268 -0
- data/docs/tatara/string.md +223 -0
- data/docs/tatara/string_array.md +254 -0
- data/docs/tatara/string_float_map.md +56 -0
- data/docs/tatara/string_int_map.md +55 -0
- data/docs/tatara/string_string_map.md +55 -0
- data/docs/tatara/string_vector.md +270 -0
- data/ext/tatara/array/array.hpp +60 -0
- data/ext/tatara/float/float.hpp +51 -0
- data/ext/tatara/integer/integer.hpp +67 -0
- data/ext/tatara/string/string.hpp +28 -0
- data/ext/tatara/tatara.cpp +138 -9
- data/ext/tatara/vector/vector.hpp +60 -0
- data/lib/tatara.rb +2 -0
- data/lib/tatara/array/array.rb +37 -0
- data/lib/tatara/tatara_ext.rb +6 -0
- data/lib/tatara/vector/vector.rb +37 -0
- data/lib/tatara/version.rb +1 -1
- metadata +27 -3
@@ -0,0 +1,256 @@
|
|
1
|
+
# Tatara::FloatArray
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::FloatArray` is `Array` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::FloatArray` use `Float` value.
|
7
|
+
But, you can use `Integer` for value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@f = Tatara::FloatArray.new
|
11
|
+
@f[0] = 4.2
|
12
|
+
# => Set value 4.2 for index of 0.
|
13
|
+
@f[1] = 8
|
14
|
+
# => Set value 8.0 for index of 1.
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not use `String` for value.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@f = Tatara::FloatArray.new
|
21
|
+
@f[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::FloatArray#new
|
27
|
+
|
28
|
+
Create new `Tatara::FloatArray` instance.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
@f = Tatara::FloatArray.new
|
32
|
+
```
|
33
|
+
|
34
|
+
### Tatara::FloatArray#\[\]
|
35
|
+
|
36
|
+
Access by index.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
@f = Tatara::FloatArray.new
|
40
|
+
@f[0] = 4.2
|
41
|
+
puts @f[0]
|
42
|
+
# => 4.2
|
43
|
+
```
|
44
|
+
|
45
|
+
### Tatara::FloatArray#\[\]=
|
46
|
+
|
47
|
+
Set value by index.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
@f = Tatara::FloatArray.new
|
51
|
+
@f[0] = 4.2
|
52
|
+
# => Set value 4.2 for index of 0.
|
53
|
+
```
|
54
|
+
|
55
|
+
### Tatara::FloatArray#push
|
56
|
+
|
57
|
+
Create new value on end of `Tatara::FloatArray`.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
@f = Tatara::FloatArray.new
|
61
|
+
@f.push(4.2)
|
62
|
+
# => Set value 4.2 on end of `Tatara::FloatArray`
|
63
|
+
```
|
64
|
+
|
65
|
+
### Tatara::FloatArray#size
|
66
|
+
|
67
|
+
Size of `Tatara::FloatArray`.
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
@f = Tatara::FloatArray.new
|
71
|
+
puts @f.size
|
72
|
+
# => 0
|
73
|
+
@f.push(4.2)
|
74
|
+
puts @f.size
|
75
|
+
# => 1
|
76
|
+
```
|
77
|
+
|
78
|
+
### Tatara::FloatArray#clear
|
79
|
+
|
80
|
+
Clear `Tatara::FloatArray`.
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
@f = Tatara::FloatArray.new
|
84
|
+
@f.push(4.2)
|
85
|
+
puts @f.size
|
86
|
+
# => 1
|
87
|
+
@f.clear
|
88
|
+
puts @f.size
|
89
|
+
# => 0
|
90
|
+
```
|
91
|
+
|
92
|
+
### Tatara::FloatArray#operator<<
|
93
|
+
|
94
|
+
Create new value on end of `Tatara::FloatArray`.
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
@f = Tatara::FloatArray.new
|
98
|
+
@f << 4.2
|
99
|
+
# => Set value 4.2 on end of `Tatara::FloatArray`
|
100
|
+
```
|
101
|
+
|
102
|
+
### Tatara::FloatArray#map
|
103
|
+
|
104
|
+
`map` method for `Tatara::FloatArray`.
|
105
|
+
It's likes `Array#map`
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
@f = Tatara::FloatArray.new
|
109
|
+
(1..3).each{|i| @f << i }
|
110
|
+
# => Set new value's
|
111
|
+
@f.map{|f|
|
112
|
+
puts f
|
113
|
+
}
|
114
|
+
# => 1.0 2.0 3.0
|
115
|
+
```
|
116
|
+
|
117
|
+
### Tatara::FloatArray#map!
|
118
|
+
|
119
|
+
`map!` method for `Tatara::FloatArray`.
|
120
|
+
It's likes `Array#map!`
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
@f = Tatara::FloatArray.new
|
124
|
+
(1..3).each{|i| @f << i }
|
125
|
+
# => Set new value's
|
126
|
+
@f.map!{|f| f * 2.0 }
|
127
|
+
@f.map{|f|
|
128
|
+
puts i
|
129
|
+
}
|
130
|
+
# => 2.0 4.0 6.0
|
131
|
+
```
|
132
|
+
|
133
|
+
### Tatara::FloatArray#each
|
134
|
+
|
135
|
+
`each` method for `Tatara::FloatArray`.
|
136
|
+
It's likes `Array#each`
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
@f = Tatara::FloatArray.new
|
140
|
+
(1..3).each{|i| @f << i }
|
141
|
+
# => Set new value's
|
142
|
+
@f.each{|f|
|
143
|
+
puts f
|
144
|
+
}
|
145
|
+
# => 1.0 2.0 3.0
|
146
|
+
```
|
147
|
+
|
148
|
+
### Tatara::FloatArray#each_with_index
|
149
|
+
|
150
|
+
`each_with_index` method for `Tatara::FloatArray`.
|
151
|
+
It's likes `Array#each_with_index`
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
@f = Tatara::FloatArray.new
|
155
|
+
(1..3).each{|i| @f << i }
|
156
|
+
# => Set new value's
|
157
|
+
@f.each_with_index{|v, i|
|
158
|
+
puts "#{i}:#{v}"
|
159
|
+
}
|
160
|
+
# => 1:1.0 2:2.0 3:3.0
|
161
|
+
```
|
162
|
+
|
163
|
+
### Tatara::FloatArray#intersection
|
164
|
+
|
165
|
+
Intersection value's
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
@f1 = Tatara::FloatArray.new
|
169
|
+
(1..10).each{|i| @f1 << i}
|
170
|
+
@f2 = Tatara::FloatArray.new
|
171
|
+
(10..20).each{|i| @f2 << i}
|
172
|
+
@f = @f1.intersection @f2
|
173
|
+
# => [10.0]
|
174
|
+
```
|
175
|
+
|
176
|
+
### Tatara::FloatArray#operator&
|
177
|
+
|
178
|
+
Intersection value's
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
@f1 = Tatara::FloatArray.new
|
182
|
+
(1..10).each{|i| @f1 << i}
|
183
|
+
@f2 = Tatara::FloatArray.new
|
184
|
+
(10..20).each{|i| @f2 << i}
|
185
|
+
@f = @f1 & @f2
|
186
|
+
# => [10.0]
|
187
|
+
```
|
188
|
+
|
189
|
+
### Tatara::FloatArray#sort
|
190
|
+
|
191
|
+
Sort value's.
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
@f = Tatara::FloatArray.new
|
195
|
+
[9, 1, 4].each{|i| @f << i }
|
196
|
+
@f = @f.sort
|
197
|
+
# => [1.0, 4.0, 9.0]
|
198
|
+
```
|
199
|
+
|
200
|
+
### Tatara::FloatArray#sort!
|
201
|
+
|
202
|
+
Sort value's.
|
203
|
+
|
204
|
+
```ruby
|
205
|
+
@f = Tatara::FloatArray.new
|
206
|
+
[9, 1, 4].each{|i| @f << i }
|
207
|
+
@f.sort!
|
208
|
+
# => [1.0, 4.0, 9.0]
|
209
|
+
```
|
210
|
+
|
211
|
+
|
212
|
+
### Tatara::FloatArray#reverse
|
213
|
+
|
214
|
+
Reverse value's.
|
215
|
+
|
216
|
+
```ruby
|
217
|
+
@f = Tatara::FloatArray.new
|
218
|
+
[9, 1, 4].each{|i| @f << i }
|
219
|
+
@f = @f.reverse
|
220
|
+
# => [4.0, 1.0, 9.0]
|
221
|
+
```
|
222
|
+
|
223
|
+
### Tatara::FloatArray#reverse!
|
224
|
+
|
225
|
+
Reverse value's.
|
226
|
+
|
227
|
+
```ruby
|
228
|
+
@f = Tatara::FloatArray.new
|
229
|
+
[9, 1, 4].each{|i| @f << i }
|
230
|
+
@f.reverse!
|
231
|
+
# => [4.0, 1.0, 9.0]
|
232
|
+
```
|
233
|
+
|
234
|
+
### Tatara::FloatArray#first
|
235
|
+
|
236
|
+
Get first value of `Tatara::FloatArray`.
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
@f = Tatara::FloatArray.new
|
240
|
+
(1..3).each{|i| @f << i }
|
241
|
+
# => Set new value's
|
242
|
+
puts @f.first
|
243
|
+
# => 1.0
|
244
|
+
```
|
245
|
+
|
246
|
+
### Tatara::FloatArray#last
|
247
|
+
|
248
|
+
Get last value of `Tatara::FloatArray`.
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
@f = Tatara::FloatArray.new
|
252
|
+
(1..3).each{|i| @f << i }
|
253
|
+
# => Set new value's
|
254
|
+
puts @f.last
|
255
|
+
# => 3.0
|
256
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Tatara::FloatFloatMap
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::FloatFloatMap` is `Map` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::FloatFloatMap` used by `Float` key, and `Float` value.
|
7
|
+
But, you can use `Integer` for key & value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@f = Tatara::FloatFloatMap.new
|
11
|
+
@f[0.5] = 4.2
|
12
|
+
# => Key: 0.5, Value: 4.2
|
13
|
+
@f[10] = 8
|
14
|
+
# => Key: 10.0, Value: 8.0
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not set `String`.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@f = Tatara::FloatFloatMap.new
|
21
|
+
@f[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::FloatFloatMap#new
|
27
|
+
|
28
|
+
Create new `Tatara::FloatFloatMap` instance.
|
29
|
+
```ruby
|
30
|
+
@f = Tatara::FloatFloatMap.new
|
31
|
+
```
|
32
|
+
|
33
|
+
### Tatara::FloatFloatMap#\[\]
|
34
|
+
|
35
|
+
Access by key.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
@f = Tatara::FloatFloatMap.new
|
39
|
+
@f[0.5] = 4.2
|
40
|
+
puts @i[0.5]
|
41
|
+
# => 4.2
|
42
|
+
```
|
43
|
+
|
44
|
+
### Tatara::FloatFloatMap#\[\]=
|
45
|
+
|
46
|
+
Set value by key.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
@f = Tatara::FloatFloatMap.new
|
50
|
+
@f[0.5] = 4.2
|
51
|
+
# => Set value is 4.2
|
52
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Tatara::FloatIntMap
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::FloatIntMap` is `Map` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::FloatIntMap` used by `Float` key, and `Integer` value.
|
7
|
+
But, you can use `Integer` for key.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@f = Tatara::FloatIntMap.new
|
11
|
+
@f[0.5] = 42
|
12
|
+
# => Key: 0.5, Value: 42.0
|
13
|
+
@f[10] = 8.4
|
14
|
+
# => Key: 10.0, Value: 8.4
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not set `String`.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@f = Tatara::FloatIntMap.new
|
21
|
+
@f[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::FloatIntMap#new
|
27
|
+
|
28
|
+
Create new `Tatara::FloatIntMap` instance.
|
29
|
+
```ruby
|
30
|
+
@f = Tatara::FloatIntMap.new
|
31
|
+
```
|
32
|
+
|
33
|
+
### Tatara::FloatIntMap#\[\]
|
34
|
+
|
35
|
+
Access by key.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
@f = Tatara::FloatIntMap.new
|
39
|
+
@f[0.5] = 4.2
|
40
|
+
puts @i[0.5]
|
41
|
+
# => 4.2
|
42
|
+
```
|
43
|
+
|
44
|
+
### Tatara::FloatIntMap#\[\]=
|
45
|
+
|
46
|
+
Set value by key.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
@f = Tatara::FloatIntMap.new
|
50
|
+
@f[0.5] = 4.2
|
51
|
+
# => Set value is 4.2
|
52
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Tatara::FloatStringMap
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::FloatStringMap` is `Map` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::FloatStringMap` used by `Float` key, and `String` value.
|
7
|
+
But, you can use `Integer` for key.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@f = Tatara::FloatStringMap.new
|
11
|
+
@f[0.5] = "42"
|
12
|
+
# => Key: 0.5, Value: "42"
|
13
|
+
@f[10] = "8"
|
14
|
+
# => Key: 10.0, Value: "8"
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not set `Integer` & `Float` for value.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@f = Tatara::FloatStringMap.new
|
21
|
+
@f[0.5] = 42
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::FloatStringMap#new
|
27
|
+
|
28
|
+
Create new `Tatara::FloatStringMap` instance.
|
29
|
+
```ruby
|
30
|
+
@f = Tatara::FloatStringMap.new
|
31
|
+
```
|
32
|
+
|
33
|
+
### Tatara::FloatStringMap#\[\]
|
34
|
+
|
35
|
+
Access by key.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
@f = Tatara::FloatStringMap.new
|
39
|
+
@f[0.5] = "42"
|
40
|
+
puts @i[0.5]
|
41
|
+
# => "42"
|
42
|
+
```
|
43
|
+
|
44
|
+
### Tatara::FloatStringMap#\[\]=
|
45
|
+
|
46
|
+
Set value by key.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
@f = Tatara::FloatStringMap.new
|
50
|
+
@f[0.5] = "42"
|
51
|
+
# => Set value is "42"
|
52
|
+
```
|
@@ -0,0 +1,269 @@
|
|
1
|
+
# Tatara::FloatVector
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::FloatVector` is `Vector` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::FloatVector` use `Float` value.
|
7
|
+
But, you can use `Integer` for value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@f = Tatara::FloatVector.new
|
11
|
+
@f[0] = 4.2
|
12
|
+
# => Set value 4.2 for index of 0.
|
13
|
+
@f[1] = 8
|
14
|
+
# => Set value 8.0 for index of 1.
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not use `String` for value.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@f = Tatara::FloatVector.new
|
21
|
+
@f[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::FloatVector#new
|
27
|
+
|
28
|
+
Create new `Tatara::FloatVector` instance.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
@f = Tatara::FloatVector.new
|
32
|
+
```
|
33
|
+
|
34
|
+
|
35
|
+
### Tatara::FloatVector#\[\]
|
36
|
+
|
37
|
+
Access by index.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
@f = Tatara::FloatVector.new
|
41
|
+
@f[0] = 4.2
|
42
|
+
puts @f[0]
|
43
|
+
# => 4.2
|
44
|
+
```
|
45
|
+
|
46
|
+
### Tatara::FloatVector#\[\]=
|
47
|
+
|
48
|
+
Set value by index.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
@f = Tatara::FloatVector.new
|
52
|
+
@f[0] = 4.2
|
53
|
+
# => Set value 4.2 for index of 0.
|
54
|
+
```
|
55
|
+
|
56
|
+
### Tatara::FloatVector#emplace_back
|
57
|
+
|
58
|
+
Create new value on end of `Tatara::FloatVector`.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
@f = Tatara::FloatVector.new
|
62
|
+
@f.emplace_back(4.2)
|
63
|
+
# => Set value 4.2 on end of `Tatara::FloatVector`
|
64
|
+
```
|
65
|
+
|
66
|
+
### Tatara::FloatVector#size
|
67
|
+
|
68
|
+
Size of `Tatara::FloatVector`.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
@f = Tatara::FloatVector.new
|
72
|
+
puts @f.size
|
73
|
+
# => 0
|
74
|
+
@f.emplace_back(4.2)
|
75
|
+
puts @f.size
|
76
|
+
# => 1
|
77
|
+
```
|
78
|
+
|
79
|
+
### Tatara::FloatVector#clear
|
80
|
+
|
81
|
+
Clear `Tatara::FloatVector`.
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
@f = Tatara::FloatVector.new
|
85
|
+
@f.emplace_back(4.2)
|
86
|
+
puts @f.size
|
87
|
+
# => 1
|
88
|
+
@f.clear
|
89
|
+
puts @f.size
|
90
|
+
# => 0
|
91
|
+
```
|
92
|
+
|
93
|
+
### Tatara::FloatVector#sum
|
94
|
+
|
95
|
+
Sum value's for `Tatara::FloatVector`.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
@f = Tatara::FloatVector.new
|
99
|
+
(1..3).each{|i|
|
100
|
+
@f.emplace_back(i)
|
101
|
+
}
|
102
|
+
puts @f.sum
|
103
|
+
# => 6.0
|
104
|
+
```
|
105
|
+
|
106
|
+
### Tatara::FloatVector#operator<<
|
107
|
+
|
108
|
+
Create new value on end of `Tatara::FloatVector`.
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
@f = Tatara::FloatVector.new
|
112
|
+
@f << 4.2
|
113
|
+
# => Set value 4.2 on end of `Tatara::FloatVector`
|
114
|
+
```
|
115
|
+
|
116
|
+
### Tatara::FloatVector#map
|
117
|
+
|
118
|
+
`map` method for `Tatara::FloatVector`.
|
119
|
+
It's likes `Array#map`
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
@f = Tatara::FloatVector.new
|
123
|
+
(1..3).each{|i| @f << i }
|
124
|
+
# => Set new value's
|
125
|
+
@f.map{|f|
|
126
|
+
puts f
|
127
|
+
}
|
128
|
+
# => 1.0 2.0 3.0
|
129
|
+
```
|
130
|
+
|
131
|
+
### Tatara::FloatVector#map!
|
132
|
+
|
133
|
+
`map!` method for `Tatara::FloatVector`.
|
134
|
+
It's likes `Array#map!`
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
@f = Tatara::FloatVector.new
|
138
|
+
(1..3).each{|i| @f << i }
|
139
|
+
# => Set new value's
|
140
|
+
@f.map!{|f| f * 2.0 }
|
141
|
+
@f.map{|f|
|
142
|
+
puts i
|
143
|
+
}
|
144
|
+
# => 2.0 4.0 6.0
|
145
|
+
```
|
146
|
+
|
147
|
+
### Tatara::FloatVector#each
|
148
|
+
|
149
|
+
`each` method for `Tatara::FloatVector`.
|
150
|
+
It's likes `Array#each`
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
@f = Tatara::FloatVector.new
|
154
|
+
(1..3).each{|i| @f << i }
|
155
|
+
# => Set new value's
|
156
|
+
@f.each{|f|
|
157
|
+
puts f
|
158
|
+
}
|
159
|
+
# => 1.0 2.0 3.0
|
160
|
+
```
|
161
|
+
|
162
|
+
### Tatara::FloatVector#each_with_index
|
163
|
+
|
164
|
+
`each_with_index` method for `Tatara::FloatVector`.
|
165
|
+
It's likes `Array#each_with_index`
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
@f = Tatara::FloatVector.new
|
169
|
+
(1..3).each{|i| @f << i }
|
170
|
+
# => Set new value's
|
171
|
+
@f.each_with_index{|v, i|
|
172
|
+
puts "#{i}:#{v}"
|
173
|
+
}
|
174
|
+
# => 1:1.0 2:2.0 3:3.0
|
175
|
+
```
|
176
|
+
|
177
|
+
### Tatara::FloatVector#intersection
|
178
|
+
|
179
|
+
Intersection value's
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
@f1 = Tatara::FloatVector.new
|
183
|
+
(1..10).each{|i| @f1 << i}
|
184
|
+
@f2 = Tatara::FloatVector.new
|
185
|
+
(10..20).each{|i| @f2 << i}
|
186
|
+
@f = @f1.intersection @f2
|
187
|
+
# => [10.0]
|
188
|
+
```
|
189
|
+
|
190
|
+
### Tatara::FloatVector#operator&
|
191
|
+
|
192
|
+
Intersection value's
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
@f1 = Tatara::FloatVector.new
|
196
|
+
(1..10).each{|i| @f1 << i}
|
197
|
+
@f2 = Tatara::FloatVector.new
|
198
|
+
(10..20).each{|i| @f2 << i}
|
199
|
+
@f = @f1 & @f2
|
200
|
+
# => [10.0]
|
201
|
+
```
|
202
|
+
|
203
|
+
### Tatara::FloatVector#sort
|
204
|
+
|
205
|
+
Sort value's.
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
@f = Tatara::FloatVector.new
|
209
|
+
[9, 1, 4].each{|i| @f << i }
|
210
|
+
@f = @f.sort
|
211
|
+
# => [1.0, 4.0, 9.0]
|
212
|
+
```
|
213
|
+
|
214
|
+
### Tatara::FloatVector#sort!
|
215
|
+
|
216
|
+
Sort value's.
|
217
|
+
|
218
|
+
```ruby
|
219
|
+
@f = Tatara::FloatVector.new
|
220
|
+
[9, 1, 4].each{|i| @f << i }
|
221
|
+
@f.sort!
|
222
|
+
# => [1.0, 4.0, 9.0]
|
223
|
+
```
|
224
|
+
|
225
|
+
### Tatara::FloatVector#reverse
|
226
|
+
|
227
|
+
Reverse value's.
|
228
|
+
|
229
|
+
```ruby
|
230
|
+
@f = Tatara::FloatVector.new
|
231
|
+
[9, 1, 4].each{|i| @f << i }
|
232
|
+
@f = @f.reverse
|
233
|
+
# => [4.0, 1.0, 9.0]
|
234
|
+
```
|
235
|
+
|
236
|
+
### Tatara::FloatVector#reverse!
|
237
|
+
|
238
|
+
Reverse value's.
|
239
|
+
|
240
|
+
```ruby
|
241
|
+
@f = Tatara::FloatVector.new
|
242
|
+
[9, 1, 4].each{|i| @f << i }
|
243
|
+
@f.reverse!
|
244
|
+
# => [4.0, 1.0, 9.0]
|
245
|
+
```
|
246
|
+
|
247
|
+
### Tatara::FloatVector#first
|
248
|
+
|
249
|
+
Get first value of `Tatara::FloatVector`.
|
250
|
+
|
251
|
+
```ruby
|
252
|
+
@f = Tatara::FloatVector.new
|
253
|
+
(1..3).each{|i| @f << i }
|
254
|
+
# => Set new value's
|
255
|
+
puts @f.first
|
256
|
+
# => 1.0
|
257
|
+
```
|
258
|
+
|
259
|
+
### Tatara::FloatVector#last
|
260
|
+
|
261
|
+
Get last value of `Tatara::FloatVector`.
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
@f = Tatara::FloatVector.new
|
265
|
+
(1..3).each{|i| @f << i }
|
266
|
+
# => Set new value's
|
267
|
+
puts @f.last
|
268
|
+
# => 3.0
|
269
|
+
```
|