multiarray 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/packagetask'
6
6
  require 'rbconfig'
7
7
 
8
8
  PKG_NAME = 'multiarray'
9
- PKG_VERSION = '0.10.3'
9
+ PKG_VERSION = '0.10.4'
10
10
  RB_FILES = FileList[ 'lib/**/*.rb' ]
11
11
  TC_FILES = FileList[ 'test/tc_*.rb' ]
12
12
  TS_FILES = FileList[ 'test/ts_*.rb' ]
@@ -695,10 +695,10 @@ module Hornetseye
695
695
  define_unary_op :imag, :scalar
696
696
 
697
697
  def real_with_decompose
698
- if typecode < COMPLEX_
699
- decompose 0
700
- elsif typecode == OBJECT
698
+ if typecode == OBJECT or is_a?( Variable )
701
699
  real_without_decompose
700
+ elsif typecode < COMPLEX_
701
+ decompose 0
702
702
  else
703
703
  self
704
704
  end
@@ -719,10 +719,10 @@ module Hornetseye
719
719
  end
720
720
 
721
721
  def imag_with_decompose
722
- if typecode < COMPLEX_
723
- decompose 1
724
- elsif typecode == OBJECT
722
+ if typecode == OBJECT or is_a?( Variable )
725
723
  imag_without_decompose
724
+ elsif typecode < COMPLEX_
725
+ decompose 1
726
726
  else
727
727
  Hornetseye::lazy( *shape ) { typecode.new( 0 ) }
728
728
  end
@@ -338,21 +338,21 @@ class TC_MultiArray < Test::Unit::TestCase
338
338
  assert_equal M[ [ 1, 4 ], [ 5, 6 ] ], M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].r
339
339
  assert_equal M[ [ 2, 4 ], [ 5, 6 ] ], M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].g
340
340
  assert_equal M[ [ 3, 4 ], [ 5, 6 ] ], M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].b
341
- #assert_equal M[ [ 1, 4 ], [ 5, 6 ] ],
342
- # M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].collect { |x| x.r }
343
- #assert_equal M[ [ 2, 4 ], [ 5, 6 ] ],
344
- # M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].collect { |x| x.g }
345
- #assert_equal M[ [ 3, 4 ], [ 5, 6 ] ],
346
- # M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].collect { |x| x.b }
341
+ assert_equal M[ [ 1, 4 ], [ 5, 6 ] ],
342
+ M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].collect { |x| x.r }
343
+ assert_equal M[ [ 2, 4 ], [ 5, 6 ] ],
344
+ M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].collect { |x| x.g }
345
+ assert_equal M[ [ 3, 4 ], [ 5, 6 ] ],
346
+ M[ [ C( 1, 2, 3 ), 4 ], [ 5, 6 ] ].collect { |x| x.b }
347
347
  end
348
348
 
349
349
  def test_real_imag
350
350
  assert_equal M[ [ 1, 3 ], [ 4, 5 ] ], M[ [ X( 1, 2 ), 3 ], [ 4, 5 ] ].real
351
351
  assert_equal M[ [ 2, 0 ], [ 0, 0 ] ], M[ [ X( 1, 2 ), 3 ], [ 4, 5 ] ].imag
352
- #assert_equal M[ [ 1, 3 ], [ 4, 5 ] ],
353
- # M[ [ X( 1, 2 ), 3 ], [ 4, 5 ] ].collect { |x| x.real }
354
- #assert_equal M[ [ 2, 0 ], [ 0, 0 ] ],
355
- # M[ [ X( 1, 2 ), 3 ], [ 4, 5 ] ].collect { |x| x.imag }
352
+ assert_equal M[ [ 1, 3 ], [ 4, 5 ] ],
353
+ M[ [ X( 1, 2 ), 3 ], [ 4, 5 ] ].collect { |x| x.real }
354
+ assert_equal M[ [ 2, 0 ], [ 0, 0 ] ],
355
+ M[ [ X( 1, 2 ), 3 ], [ 4, 5 ] ].collect { |x| x.imag }
356
356
  end
357
357
 
358
358
  def test_inject
data/test/tc_sequence.rb CHANGED
@@ -220,9 +220,9 @@ class TC_Sequence < Test::Unit::TestCase
220
220
  assert_equal [ 1, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].r.to_a
221
221
  assert_equal [ 2, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].g.to_a
222
222
  assert_equal [ 3, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].b.to_a
223
- #assert_equal [ 1, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].collect { |x| x.r }.to_a
224
- #assert_equal [ 2, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].collect { |x| x.g }.to_a
225
- #assert_equal [ 3, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].collect { |x| x.b }.to_a
223
+ assert_equal [ 1, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].collect { |x| x.r }.to_a
224
+ assert_equal [ 2, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].collect { |x| x.g }.to_a
225
+ assert_equal [ 3, 4, 5 ], t[ C( 1, 2, 3 ), 4, 5 ].collect { |x| x.b }.to_a
226
226
  s = t[ 0, 0, 0 ]
227
227
  assert_equal 1, s.r = 1
228
228
  assert_equal S[ 1, 2, 3 ], s.g = S[ 1, 2, 3 ]
@@ -242,8 +242,8 @@ class TC_Sequence < Test::Unit::TestCase
242
242
  [ S( O, 2 ), S( X, 2 ) ].each do |t|
243
243
  assert_equal [ 1, 3 ], t[ X( 1, 2 ), 3 ].real.to_a
244
244
  assert_equal [ 2, 0 ], t[ X( 1, 2 ), 3 ].imag.to_a
245
- #assert_equal [ 1, 3 ], t[ X( 1, 2 ), 3 ].collect { |x| x.real }.to_a
246
- #assert_equal [ 2, 0 ], t[ X( 1, 2 ), 3 ].collect { |x| x.imag }.to_a
245
+ assert_equal [ 1, 3 ], t[ X( 1, 2 ), 3 ].collect { |x| x.real }.to_a
246
+ assert_equal [ 2, 0 ], t[ X( 1, 2 ), 3 ].collect { |x| x.imag }.to_a
247
247
  s = t[ 0, 0 ]
248
248
  assert_equal 1, s.real = 1
249
249
  assert_equal S[ 2, 3 ], s.imag = S[ 2, 3 ]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 10
8
- - 3
9
- version: 0.10.3
8
+ - 4
9
+ version: 0.10.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Wedekind