vector_space 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vector_space/family.rb +2 -2
- data/lib/vector_space/vector_space.rb +2 -2
- metadata +21 -7
data/lib/vector_space/family.rb
CHANGED
@@ -21,7 +21,7 @@ module VectorSpace
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def zero(attributes = {})
|
24
|
-
new Hash[
|
24
|
+
new Hash[[[index, attributes[index] || reflect_on_component(index).default]] + dimensions.map { |dimension| [dimension, reflect_on_component(dimension).zero] }]
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -38,7 +38,7 @@ module VectorSpace
|
|
38
38
|
|
39
39
|
private
|
40
40
|
def operate_on_values(*vectors, &block)
|
41
|
-
self.class.new Hash[
|
41
|
+
self.class.new Hash[map_components(index, *vectors) { |*values| values.inject { |a, b| a if a == b } } + map_components(dimensions, *vectors, &block)]
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -18,7 +18,7 @@ module VectorSpace
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def zero
|
21
|
-
new Hash[
|
21
|
+
new Hash[dimensions.map { |dimension| [dimension, reflect_on_component(dimension).zero] }]
|
22
22
|
end
|
23
23
|
|
24
24
|
def order
|
@@ -95,7 +95,7 @@ module VectorSpace
|
|
95
95
|
|
96
96
|
private
|
97
97
|
def operate_on_values(*vectors, &block)
|
98
|
-
self.class.new Hash[
|
98
|
+
self.class.new Hash[map_components(dimensions, *vectors, &block)]
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vector_space
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Tom Stuart
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-09-11 00:00:00 +01:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -45,23 +51,31 @@ rdoc_options: []
|
|
45
51
|
require_paths:
|
46
52
|
- lib
|
47
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
48
55
|
requirements:
|
49
56
|
- - ">="
|
50
57
|
- !ruby/object:Gem::Version
|
51
|
-
|
52
|
-
|
58
|
+
hash: 57
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 8
|
62
|
+
- 7
|
63
|
+
version: 1.8.7
|
53
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
54
66
|
requirements:
|
55
67
|
- - ">="
|
56
68
|
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
57
72
|
version: "0"
|
58
|
-
version:
|
59
73
|
requirements: []
|
60
74
|
|
61
75
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.3.
|
76
|
+
rubygems_version: 1.3.7
|
63
77
|
signing_key:
|
64
78
|
specification_version: 3
|
65
|
-
summary: A Ruby library for treating multidimensional values as elements of a vector space
|
79
|
+
summary: A Ruby library for treating multidimensional values as elements of a vector space.
|
66
80
|
test_files: []
|
67
81
|
|