octave-ruby 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,10 @@
1
+ == 1.0.1 / 2008-02-28
2
+
3
+ * 2 major bug fixes
4
+ * Ruby hashes with more than 1 key are converted to Octave properly
5
+ * Octave struct matrices with more than 1 key are converted to Ruby properly
6
+
7
+
1
8
  == 1.0.0 / 2008-01-02
2
9
 
3
10
  * 1 major enhancement
@@ -14,7 +14,7 @@ octave_value OR_Hash::to_octave()
14
14
  keys.append(std::string(RSTRING(RARRAY(names)->ptr[i])->ptr));
15
15
  }
16
16
 
17
- Octave_map struct_matrix = Octave_map(dim_vector(1, 1), Cell(keys));
17
+ Octave_map struct_matrix = Octave_map(dim_vector(number_of_keys, 1), Cell(keys));
18
18
  for (i = 0; i < number_of_keys; i++) {
19
19
  struct_matrix.contents(std::string(RSTRING(RARRAY(names)->ptr[i])->ptr))(i, 0) = OR_Variable(rb_hash_aref(ruby_val, rb_str_new2(RSTRING(RARRAY(names)->ptr[i])->ptr))).to_octave();
20
20
  }
@@ -13,10 +13,10 @@ VALUE OR_StructMatrix::to_ruby()
13
13
  int i;
14
14
  VALUE cells, row, cell;
15
15
 
16
- if (number_of_rows == 1 && number_of_columns == 1) {
16
+ if (number_of_columns == 1) {
17
17
  ruby_val = rb_hash_new();
18
18
  for (i = 0; i < number_of_keys; i++) {
19
- rb_hash_aset(ruby_val, rb_str_new2(keys[i].c_str()), OR_Variable(struct_matrix.contents(keys[i])(0)).to_ruby());
19
+ rb_hash_aset(ruby_val, rb_str_new2(keys[i].c_str()), OR_Variable(struct_matrix.contents(keys[i])(i)).to_ruby());
20
20
  }
21
21
  } else {
22
22
  int number_of_arguments_to_struct_matrix = number_of_keys + 2;
@@ -4,7 +4,7 @@ module Octave
4
4
 
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
- TINY = 0
7
+ TINY = 1
8
8
 
9
9
  STRING = [ MAJOR, MINOR, TINY ].join( "." )
10
10
  #:beta-tag:
@@ -57,6 +57,7 @@ class ConversionsTest < Test::Unit::TestCase
57
57
  assert_octave_and_ruby_equal "foo" => "bar"
58
58
  assert_octave_and_ruby_equal "foo" => [1,2,3]
59
59
  assert_octave_and_ruby_equal "foo" => { "bar" => [1,2,3, [4,5,6]] }
60
+ assert_octave_and_ruby_equal "foo" => { "bar" => [1,2,3, [4,5,6]], "baz" => "buz" }
60
61
  end
61
62
 
62
63
  def test_should_convert_octave_matrix
@@ -94,16 +95,13 @@ class ConversionsTest < Test::Unit::TestCase
94
95
  end
95
96
 
96
97
  def test_should_convert_octave_struct_matrix
97
- cats = Octave::StructMatrix.new(17, 1, "name")
98
- 17.times { |m| 1.times { |n| cats[m, n]["name"] = "Kitty #{m}.#{n}" } }
99
-
100
- struct_matrix = Octave::StructMatrix.new(17, 1, "name", "age", "married", "cats", "car")
98
+ struct_matrix = Octave::StructMatrix.new(17, 2, "name", "age", "married", "cats", "car")
101
99
  17.times do |m|
102
- 1.times do |n|
100
+ 2.times do |n|
103
101
  struct_matrix[m, n]["name"] = "Bob #{m}.#{n}"
104
102
  struct_matrix[m, n]["age"] = (rand * 100).to_i
105
103
  struct_matrix[m, n]["married"] = (rand > 0.5)
106
- struct_matrix[m, n]["cats"] = cats
104
+ struct_matrix[m, n]["cats"] = { "name" => "Kitty #{m}.#{n}" }
107
105
  struct_matrix[m, n]["car"] = nil
108
106
  end
109
107
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octave-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Younger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-07 00:00:00 -07:00
12
+ date: 2008-02-28 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.4.0
22
+ version: 1.5.0
23
23
  version:
24
24
  description: "== USAGE: require 'octave' engine = Octave::Engine.new engine.eval \"123.456 * 789.101112\" engine.rand(10) matrix = Octave::Matrix.new(20, 400) 20.times { |m| 400.times { |n| matrix[m, n] = rand } } engine.put_variable(\"m\", matrix) engine.save \"/tmp/20_x_400_matrix\" == REQUIREMENTS: * Octave * GCC or some other compiler to build the included extension * Mocha (For testing only)"
25
25
  email: