carray-gsl 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,44 @@
1
+ #
2
+ #
3
+ #
4
+
5
+ #
6
+ # :type => type
7
+ #
8
+ # * "linear"
9
+ # * "polynomial"
10
+ # * "cspline"
11
+ # * "cspline_periodic"
12
+ # * "akima"
13
+ # * "akima_periodic"
14
+ #
15
+
16
+ require "carray/math/interp"
17
+ require "gsl"
18
+
19
+ class CA::Interp::GSLSpline < CA::Interp::Adapter
20
+
21
+ install_adapter "gsl:spline"
22
+
23
+ def initialize (scales, value, options={})
24
+ @y = value
25
+ @x = scales
26
+ type = options[:type] || "linear"
27
+ CArray.attach(@x, @y) {
28
+ @interp = GSL::Spline.alloc(type, @x.na, @y.na)
29
+ }
30
+ end
31
+
32
+ def evaluate (x0)
33
+ case x0
34
+ when CArray
35
+ return x0.attach { @interp.eval(x0.na).ca }
36
+ else
37
+ return @interp.eval(x0)
38
+ end
39
+ end
40
+
41
+ alias grid evaluate
42
+
43
+ end
44
+
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: carray-gsl
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Hiroki Motoyoshi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |2
14
+ Extension for accessing Ruby/GSL with CArray
15
+ email: ''
16
+ executables: []
17
+ extensions:
18
+ - extconf.rb
19
+ extra_rdoc_files: []
20
+ files:
21
+ - README.md
22
+ - carray-gsl.gemspec
23
+ - carray_gsl.c
24
+ - carray_mathfunc_gsl.c
25
+ - extconf.rb
26
+ - lib/autoload/autoload_math_gsl.rb
27
+ - lib/carray-gsl.rb
28
+ - lib/math/gsl.rb
29
+ - lib/math/interp/adapter_gsl_spline.rb
30
+ homepage: https://github.com/himotoyoshi/carray-gsl
31
+ licenses: []
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.8.1
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 2.6.4
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Extension for accessing Ruby/GSL with CArray
53
+ test_files: []
54
+ has_rdoc: false