octave-ruby 1.0.7 → 1.0.8
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.
- data/History.txt +5 -0
- data/ext/octave_api/Makefile +3 -3
- data/ext/octave_api/or-hash.cpp +1 -1
- data/lib/octave/version.rb +1 -1
- data/test/driver/native/test_conversions.rb +20 -2
- metadata +4 -4
data/History.txt
CHANGED
data/ext/octave_api/Makefile
CHANGED
@@ -43,7 +43,7 @@ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
|
|
43
43
|
RUBY_EXTCONF_H =
|
44
44
|
CFLAGS = -fno-common -arch i386 -Os -pipe -fno-common
|
45
45
|
INCFLAGS = -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I.
|
46
|
-
CPPFLAGS = -DHAVE_OCTAVE_H -I/Applications/Octave.app/Contents/Resources/include -I/Applications/Octave.app/Contents/Resources/lib -I/Applications/Octave.app/Contents/Resources/include/octave-3.0.
|
46
|
+
CPPFLAGS = -DHAVE_OCTAVE_H -I/Applications/Octave.app/Contents/Resources/include -I/Applications/Octave.app/Contents/Resources/lib -I/Applications/Octave.app/Contents/Resources/include/octave-3.0.2/octave -I/Applications/Octave.app/Contents/Resources/lib/octave-3.0.2 -I/Applications/Octave.app/Contents/Resources/include/octave-3.0.2
|
47
47
|
CXXFLAGS = $(CFLAGS)
|
48
48
|
DLDFLAGS = -L. -arch i386
|
49
49
|
LDSHARED = g++ -pipe -bundle
|
@@ -68,8 +68,8 @@ COPY = cp
|
|
68
68
|
|
69
69
|
preload =
|
70
70
|
|
71
|
-
libpath = . $(libdir) /Applications/Octave.app/Contents/Resources/lib /Applications/Octave.app/Contents/Resources/lib/octave-3.0.
|
72
|
-
LIBPATH = -L"." -L"$(libdir)" -L"/Applications/Octave.app/Contents/Resources/lib" -L"/Applications/Octave.app/Contents/Resources/lib/octave-3.0.
|
71
|
+
libpath = . $(libdir) /Applications/Octave.app/Contents/Resources/lib /Applications/Octave.app/Contents/Resources/lib/octave-3.0.2
|
72
|
+
LIBPATH = -L"." -L"$(libdir)" -L"/Applications/Octave.app/Contents/Resources/lib" -L"/Applications/Octave.app/Contents/Resources/lib/octave-3.0.2"
|
73
73
|
DEFFILE =
|
74
74
|
|
75
75
|
CLEANFILES = mkmf.log
|
data/ext/octave_api/or-hash.cpp
CHANGED
@@ -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(
|
17
|
+
Octave_map struct_matrix = Octave_map(dim_vector(1, 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)) = OR_Variable(rb_hash_aref(ruby_val, rb_str_new2(RSTRING(RARRAY(names)->ptr[i])->ptr))).to_octave();
|
20
20
|
}
|
data/lib/octave/version.rb
CHANGED
@@ -49,18 +49,36 @@ class ConversionsTest < Test::Unit::TestCase
|
|
49
49
|
assert_instance_of Float, result
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def test_should_convert_array_from_and_to
|
53
53
|
assert_octave_and_ruby_equal [1, nil, 3.0]
|
54
54
|
assert_octave_and_ruby_equal [1, "2", false, ["foo", "bar", "baz"]]
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def test_should_convert_hash_from_and_to
|
58
58
|
assert_octave_and_ruby_equal "foo" => "bar"
|
59
59
|
assert_octave_and_ruby_equal "foo" => [1,2,3]
|
60
60
|
assert_octave_and_ruby_equal "foo" => { "bar" => [1,2,3, [4,5,6]] }
|
61
61
|
assert_octave_and_ruby_equal "foo" => { "bar" => [1,2,3, [4,5,6]], "baz" => "buz", "bob" => [7,8,9] }
|
62
62
|
end
|
63
63
|
|
64
|
+
def test_should_be_able_to_reference_structure_fields_from_hash
|
65
|
+
hash = { "foo" => { "bar" => [1,2,3, [4,5,6]] }, "baz" => { "buz" => [7,8,9] } }
|
66
|
+
@driver.put_variable "hash", hash
|
67
|
+
assert_equal hash["foo"]["bar"], @driver.feval("eval", "hash.foo.bar")
|
68
|
+
assert_equal hash["baz"]["buz"], @driver.feval("eval", "hash.baz.buz")
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_should_be_able_to_reference_structure_fields_from_octave_struct_matrix
|
72
|
+
bar_matrix = Octave::StructMatrix.new(1, 1, "bar")
|
73
|
+
bar_matrix[0,0]["bar"] = [1,2,3, [4,5,6]]
|
74
|
+
|
75
|
+
struct_matrix = Octave::StructMatrix.new(1, 1, "foo")
|
76
|
+
struct_matrix[0,0]["foo"] = bar_matrix
|
77
|
+
|
78
|
+
@driver.put_variable "struct_matrix", struct_matrix
|
79
|
+
assert_equal [1,2,3, [4,5,6]], @driver.feval("eval", "struct_matrix.foo.bar")
|
80
|
+
end
|
81
|
+
|
64
82
|
def test_should_convert_octave_matrix
|
65
83
|
matrix = Octave::Matrix.new(3, 3)
|
66
84
|
3.times { |m| 3.times { |n| matrix[m, n] = rand } }
|
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.
|
4
|
+
version: 1.0.8
|
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-
|
12
|
+
date: 2008-11-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
23
|
+
version: 1.8.2
|
24
24
|
version:
|
25
25
|
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)"
|
26
26
|
email:
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
requirements: []
|
98
98
|
|
99
99
|
rubyforge_project: octave-ruby
|
100
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.3.1
|
101
101
|
signing_key:
|
102
102
|
specification_version: 2
|
103
103
|
summary: A Ruby interface to the Octave interpreted language.
|