multiarray 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -3
- data/lib/multiarray/malloc.rb +0 -7
- data/lib/multiarray/operations.rb +16 -0
- data/lib/multiarray/rgb.rb +4 -0
- data/lib/multiarray/sequence.rb +1 -1
- data/test/tc_sequence.rb +4 -0
- metadata +3 -4
- data/TODO +0 -32
data/Rakefile
CHANGED
@@ -6,11 +6,11 @@ require 'rake/packagetask'
|
|
6
6
|
require 'rbconfig'
|
7
7
|
|
8
8
|
PKG_NAME = 'multiarray'
|
9
|
-
PKG_VERSION = '0.6.
|
9
|
+
PKG_VERSION = '0.6.1'
|
10
10
|
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
11
11
|
TC_FILES = FileList[ 'test/tc_*.rb' ]
|
12
12
|
TS_FILES = FileList[ 'test/ts_*.rb' ]
|
13
|
-
PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '
|
13
|
+
PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
|
14
14
|
RB_FILES + TS_FILES + TC_FILES
|
15
15
|
BIN_FILES = [ 'README.md', 'COPYING', '.document' ] +
|
16
16
|
RB_FILES + TS_FILES + TC_FILES
|
@@ -20,7 +20,7 @@ AUTHOR = %q{Jan Wedekind}
|
|
20
20
|
EMAIL = %q{jan@wedesoft.de}
|
21
21
|
HOMEPAGE = %q{http://wedesoft.github.com/multiarray/}
|
22
22
|
|
23
|
-
$SITELIBDIR =
|
23
|
+
$SITELIBDIR = RbConfig::CONFIG[ 'sitelibdir' ]
|
24
24
|
|
25
25
|
task :default => :all
|
26
26
|
|
@@ -68,6 +68,7 @@ Rake::PackageTask.new PKG_NAME, PKG_VERSION do |p|
|
|
68
68
|
end
|
69
69
|
|
70
70
|
begin
|
71
|
+
require 'rubygems'
|
71
72
|
require 'rubygems/builder'
|
72
73
|
$SPEC = Gem::Specification.new do |s|
|
73
74
|
s.name = PKG_NAME
|
data/lib/multiarray/malloc.rb
CHANGED
@@ -102,6 +102,22 @@ module Hornetseye
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
def to_type_with_rgb( dest )
|
106
|
+
if typecode < RGB_
|
107
|
+
if dest < FLOAT_
|
108
|
+
lazy { r * 0.299 + g * 0.587 + b * 0.114 }.to_type dest
|
109
|
+
elsif dest < INT_
|
110
|
+
lazy { ( r * 0.299 + g * 0.587 + b * 0.114 ).round }.to_type dest
|
111
|
+
else
|
112
|
+
to_type_without_rgb dest
|
113
|
+
end
|
114
|
+
else
|
115
|
+
to_type_without_rgb dest
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
alias_method_chain :to_type, :rgb
|
120
|
+
|
105
121
|
def conditional( a, b )
|
106
122
|
unless a.is_a? Node
|
107
123
|
a = Node.match( a, b.is_a?( Node ) ? b : nil ).new a
|
data/lib/multiarray/rgb.rb
CHANGED
@@ -133,9 +133,13 @@ module Hornetseye
|
|
133
133
|
|
134
134
|
define_unary_op :~
|
135
135
|
define_unary_op :-@
|
136
|
+
define_unary_op :floor
|
137
|
+
define_unary_op :ceil
|
138
|
+
define_unary_op :round
|
136
139
|
define_binary_op :+
|
137
140
|
define_binary_op :-
|
138
141
|
define_binary_op :*
|
142
|
+
define_binary_op :**
|
139
143
|
define_binary_op :/
|
140
144
|
define_binary_op :%
|
141
145
|
define_binary_op :&
|
data/lib/multiarray/sequence.rb
CHANGED
data/test/tc_sequence.rb
CHANGED
@@ -509,6 +509,7 @@ class TC_Sequence < Test::Unit::TestCase
|
|
509
509
|
|
510
510
|
def test_pow
|
511
511
|
assert_equal [ 1, 4, 9 ], ( S[ 1, 2, 3 ] ** 2 ).to_a
|
512
|
+
assert_equal [ C( 2, 4, 8 ) ], ( 2 ** S[ C( 1, 2, 3 ) ] ).to_a
|
512
513
|
assert_in_delta 0.0, ( ( S( X, 1 )[ X( 1, 2 ) ] ** 2 )[ 0 ] - X( -3, 4 ) ).abs,
|
513
514
|
1.0e-5
|
514
515
|
assert_in_delta 0.0, ( Math::E ** S( X, 1 )[ X( 0, Math::PI ) ][ 0 ] + 1 ).abs,
|
@@ -545,14 +546,17 @@ class TC_Sequence < Test::Unit::TestCase
|
|
545
546
|
|
546
547
|
def test_floor
|
547
548
|
assert_equal S[ 0.0, 0.0, 1.0 ], S[ 0.3, 0.7, 1.3 ].floor
|
549
|
+
assert_equal S[ C( 0.0, 0.0, 1.0 ) ], S[ C( 0.3, 0.7, 1.3 ) ].floor
|
548
550
|
end
|
549
551
|
|
550
552
|
def test_ceil
|
551
553
|
assert_equal S[ 1.0, 1.0, 2.0 ], S[ 0.3, 0.7, 1.3 ].ceil
|
554
|
+
assert_equal S[ C( 1.0, 1.0, 2.0 ) ], S[ C( 0.3, 0.7, 1.3 ) ].ceil
|
552
555
|
end
|
553
556
|
|
554
557
|
def test_round
|
555
558
|
assert_equal S[ 0.0, 1.0, 1.0 ], S[ 0.3, 0.7, 1.3 ].round
|
559
|
+
assert_equal S[ C( 0.0, 1.0, 1.0 ) ], S[ C( 0.3, 0.7, 1.3 ) ].round
|
556
560
|
end
|
557
561
|
|
558
562
|
def test_cond
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 1
|
9
|
+
version: 0.6.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-05 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -56,7 +56,6 @@ files:
|
|
56
56
|
- Rakefile
|
57
57
|
- README.md
|
58
58
|
- COPYING
|
59
|
-
- TODO
|
60
59
|
- .document
|
61
60
|
- lib/multiarray/object.rb
|
62
61
|
- lib/multiarray/operations.rb
|
data/TODO
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# weighted histograms
|
2
|
-
# lut/warp, histogram: clipping, masks?
|
3
|
-
# lut, histogram with x and y coming from different tables?
|
4
|
-
# pointer-increments for better efficiency, optimize Node#diagonal
|
5
|
-
# random numbers
|
6
|
-
# Geometric Hashing? Bounded Hough Transform!!! RANSAC?
|
7
|
-
# each, each_with_index, multi_each, collect, multi_collect, zip?
|
8
|
-
|
9
|
-
# downsampling after correlation?
|
10
|
-
# YARD documentation with pictures, demo video, @group ..., @endgroup
|
11
|
-
# CK_Thesis.pdf: tensor voting
|
12
|
-
# maxint -> native_int
|
13
|
-
|
14
|
-
# downsampling after correlation?
|
15
|
-
|
16
|
-
a = lazy( 16, 32 ) { |i,j| Sequence[ i, j ] } # ???
|
17
|
-
a = lazy( 8, 8 ) { |i,j| Sequence[ i, a[j] * sin( i + b[j] ) ] }.hist 8, 8
|
18
|
-
parallel { ... }
|
19
|
-
|
20
|
-
lines:
|
21
|
-
[ i, a[j] * sin( i + b[j] ) ].hist
|
22
|
-
|
23
|
-
lines:
|
24
|
-
lazy { |i,j| i.zip( a[j] * sin( i + b[j] ) ) }.histogram 32, 20
|
25
|
-
|
26
|
-
lines:
|
27
|
-
lazy { |i,j| Sequence[ i, a[j] * sin( i + b[j] ) ] }.histogram 32, 20
|
28
|
-
combined histograms?
|
29
|
-
|
30
|
-
circle:
|
31
|
-
[ sin( i ) * r, cos( i ) * r ].hist
|
32
|
-
|