multiarray 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/multiarray.rb +4 -4
- data/lib/multiarray/operations.rb +1 -1
- data/test/tc_multiarray.rb +3 -3
- metadata +3 -3
data/Rakefile
CHANGED
data/lib/multiarray.rb
CHANGED
@@ -582,7 +582,7 @@ require 'multiarray/gccfunction'
|
|
582
582
|
# Namespace of Hornetseye computer vision library
|
583
583
|
module Hornetseye
|
584
584
|
|
585
|
-
# Method for performing computations in lazy mode
|
585
|
+
# Method for performing computations in lazy mode resulting in a lazy expression
|
586
586
|
#
|
587
587
|
# @param [Array<Integer>] *shape Optional shape of result. The method
|
588
588
|
# attempts to infer the shape if not specified.
|
@@ -613,14 +613,14 @@ module Hornetseye
|
|
613
613
|
|
614
614
|
module_function :lazy
|
615
615
|
|
616
|
-
# Method for performing
|
616
|
+
# Method for performing a lazy computation and then forcing the result
|
617
617
|
#
|
618
618
|
# @param [Array<Integer>] *shape Optional shape of result. The method
|
619
619
|
# attempts to infer the shape if not specified.
|
620
620
|
# @yield Operation computing array elements.
|
621
621
|
#
|
622
622
|
# @return [Object,Node] Result of computation.
|
623
|
-
def
|
623
|
+
def finalise( *shape, &action )
|
624
624
|
previous = Thread.current[ :lazy ]
|
625
625
|
Thread.current[ :lazy ] = false
|
626
626
|
begin
|
@@ -631,7 +631,7 @@ module Hornetseye
|
|
631
631
|
end
|
632
632
|
end
|
633
633
|
|
634
|
-
module_function :
|
634
|
+
module_function :finalise
|
635
635
|
|
636
636
|
# Method for summing values
|
637
637
|
#
|
@@ -297,7 +297,7 @@ module Hornetseye
|
|
297
297
|
if other.is_a? Node
|
298
298
|
if variables.empty?
|
299
299
|
if other.array_type == array_type
|
300
|
-
Hornetseye::
|
300
|
+
Hornetseye::finalise { eq( other ).inject( true ) { |a,b| a.and b } }
|
301
301
|
else
|
302
302
|
false
|
303
303
|
end
|
data/test/tc_multiarray.rb
CHANGED
@@ -52,8 +52,8 @@ class TC_MultiArray < Test::Unit::TestCase
|
|
52
52
|
Hornetseye::sum *args, &action
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
56
|
-
Hornetseye::
|
55
|
+
def finalise( *args, &action )
|
56
|
+
Hornetseye::finalise *args, &action
|
57
57
|
end
|
58
58
|
|
59
59
|
def setup
|
@@ -373,7 +373,7 @@ class TC_MultiArray < Test::Unit::TestCase
|
|
373
373
|
m = M[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
|
374
374
|
assert_equal 21, sum { |i,j| m[ i, j ] }
|
375
375
|
assert_equal [ 5, 7, 9 ], sum { |i| m[ i ] }.to_a
|
376
|
-
assert_equal [ 6, 15 ],
|
376
|
+
assert_equal [ 6, 15 ], finalise { |j| sum { |i| m[ i, j ] } }.to_a
|
377
377
|
assert_equal [ [ 1, 2, 3 ] , [ 4, 5, 6 ] ], sum { || m }.to_a
|
378
378
|
end
|
379
379
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 14
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.14.0
|
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-12-
|
17
|
+
date: 2010-12-14 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|