carray 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +43 -0
- data/carray.gemspec +39 -0
- data/extconf.rb +261 -0
- data/version.h +18 -0
- data/version.rb +54 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf6af5998261685894713277e535670c15dc07cb
|
4
|
+
data.tar.gz: 13a271c75c85d433815db4582e488998f9e27bd4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d903afcd8db08b76f1dd3ac950b0a4e9f1000f91b599dc28560e6e2cf65f069b3172ff89e5a11da7a4e80077898eee32a2ad8b46b011707f6309c72a3c9e69c0
|
7
|
+
data.tar.gz: 45041c0d4e3ec28c7831e781475f02fb79e83e3b09512a7b6cb494f1b615a959d7c6a9785b458a8886cfd574ade868afc95a9f27ef2499b5898a8fc03520a476
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
Ruby/CArray
|
2
|
+
===========
|
3
|
+
|
4
|
+
Ruby/CArray is an extension library for the multi-dimensional array class.
|
5
|
+
|
6
|
+
Requirements
|
7
|
+
------------
|
8
|
+
|
9
|
+
* Ruby 2.2.0 or later
|
10
|
+
* C compiler
|
11
|
+
+ IEEE754 floating point number
|
12
|
+
+ C99 complex number
|
13
|
+
* Optionally required gems
|
14
|
+
+ narray
|
15
|
+
+ narray_miss
|
16
|
+
+ axlsx
|
17
|
+
+ spreadsheet
|
18
|
+
+ sqlite3
|
19
|
+
* Optional command
|
20
|
+
+ Gnuplot
|
21
|
+
+ ImageMagick (stream, convert, display, identify)
|
22
|
+
|
23
|
+
Directories
|
24
|
+
-----------
|
25
|
+
|
26
|
+
. - Ruby/CArray extension source codes
|
27
|
+
lib - Ruby/CArray standard library in Ruby
|
28
|
+
ext - optional extension libraries for Ruby/CArray
|
29
|
+
examples - some examples
|
30
|
+
test - some unit tests (incomplete)
|
31
|
+
spec - some rspec (incomplete)
|
32
|
+
utils - support tools for development.
|
33
|
+
|
34
|
+
Author
|
35
|
+
------
|
36
|
+
|
37
|
+
Hiroki Motoyoshi
|
38
|
+
|
39
|
+
Copying
|
40
|
+
-------
|
41
|
+
|
42
|
+
You can redistribute this library package and/or modify it under the terms of
|
43
|
+
the Ruby Licence. See the file 'COPYING' in this directory.
|
data/carray.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
files = Dir.glob("**/*") - [
|
3
|
+
Dir.glob("vendor"),
|
4
|
+
Dir.glob("ext/**/{Makefile,mkmf.log}"),
|
5
|
+
Dir.glob("**/*.{o,so,bundle}"),
|
6
|
+
Dir.glob("**/*~"),
|
7
|
+
Dir.glob("carray-*.gem"),
|
8
|
+
].flatten
|
9
|
+
|
10
|
+
Gem::Specification::new do |s|
|
11
|
+
require "./version.rb"
|
12
|
+
version, date = carray_version()
|
13
|
+
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.name = "carray"
|
16
|
+
s.summary = "Multi-dimesional array class"
|
17
|
+
s.description = <<-HERE
|
18
|
+
CArray is a uniform multi-dimensional rectangular array class.
|
19
|
+
It provides the various types of sub-arrays and references
|
20
|
+
pointing the data elements of original array (slice, grid, selection ...).
|
21
|
+
Element-wise masking and mathematical operations are natively supported.
|
22
|
+
HERE
|
23
|
+
s.version = version
|
24
|
+
s.author = "Hiroki Motoyoshi"
|
25
|
+
s.email = ""
|
26
|
+
s.homepage = 'https://github.com/himotoyoshi/carray'
|
27
|
+
s.files = files
|
28
|
+
s.has_rdoc = true
|
29
|
+
s.rdoc_options = [
|
30
|
+
"--main=rdoc_main.rb",
|
31
|
+
"rdoc_main.rb",
|
32
|
+
"rdoc_ext.rb",
|
33
|
+
"rdoc_math.rb",
|
34
|
+
"rdoc_stat.rb",
|
35
|
+
Dir.glob("lib/carray/**/*.rb")
|
36
|
+
].flatten
|
37
|
+
s.requirements << "C compiler supports C99 complex and "
|
38
|
+
s.required_ruby_version = ">= 1.8.1"
|
39
|
+
end
|
data/extconf.rb
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
#
|
2
|
+
# extconf.rb for Ruby/CArray
|
3
|
+
#
|
4
|
+
|
5
|
+
$top_srcdir = ""
|
6
|
+
|
7
|
+
require 'mkmf'
|
8
|
+
require 'rbconfig'
|
9
|
+
|
10
|
+
#
|
11
|
+
# from mkmf.rb
|
12
|
+
#
|
13
|
+
def create_header(header = "extconf.h")
|
14
|
+
message "creating %s\n", header
|
15
|
+
sym = header.tr("a-z./\055", "A-Z___")
|
16
|
+
hdr = ["#ifndef #{sym}\n#define #{sym}\n"]
|
17
|
+
for line in $defs
|
18
|
+
case line
|
19
|
+
when /^-D(SIZEOF_[^=]+)(?:=(.*))?/
|
20
|
+
hdr << "#ifndef #$1\n#define #$1 #{$2 ? Shellwords.shellwords($2)[0].gsub(/(?=\t+)/, "\
|
21
|
+
\\n") : 1}\n#endif\n"
|
22
|
+
when /^-D([^=]+)(?:=(.*))?/
|
23
|
+
hdr << "#define #$1 #{$2 ? Shellwords.shellwords($2)[0].gsub(/(?=\t+)/, "\
|
24
|
+
\\n") : 1}\n"
|
25
|
+
when /^-U(.*)/
|
26
|
+
hdr << "#undef #$1\n"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
hdr << "#endif\n"
|
30
|
+
hdr = hdr.join
|
31
|
+
unless (IO.read(header) == hdr rescue false)
|
32
|
+
open(header, "wb") do |hfile|
|
33
|
+
hfile.write(hdr)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
$extconf_h = header
|
37
|
+
end
|
38
|
+
|
39
|
+
# --- ruby version code ---
|
40
|
+
|
41
|
+
major = RbConfig::CONFIG['MAJOR'].to_i
|
42
|
+
minor = RbConfig::CONFIG['MINOR'].to_i
|
43
|
+
teeny = RbConfig::CONFIG['TEENY'].to_i
|
44
|
+
RUBY_VERSION_CODE = major * 100 + minor * 10 + teeny
|
45
|
+
$defs.push "-DRUBY_VERSION_CODE=#{RUBY_VERSION_CODE}"
|
46
|
+
|
47
|
+
# --- add option "--sitelibdir=dir" ---
|
48
|
+
|
49
|
+
if String === (optarg = arg_config("--sitelibdir"))
|
50
|
+
dir = File.expand_path(optarg)
|
51
|
+
if File.exist?(dir)
|
52
|
+
CONFIG['sitelibdir'] = dir
|
53
|
+
else
|
54
|
+
raise "invalid sitelibdir specified"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# --- add option "--with-cc=cc"
|
59
|
+
|
60
|
+
if String === (optarg = arg_config("--with-cc"))
|
61
|
+
CONFIG['CC'] = optarg
|
62
|
+
if CONFIG['LDSHARED'] =~ /^cc /
|
63
|
+
CONFIG['LDSHARED'].sub!(/^cc/, optarg)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# --- seting $CFLAGS
|
68
|
+
|
69
|
+
$CFLAGS += " -Wall -O2"
|
70
|
+
p $CFLAGS
|
71
|
+
# $CFLAGS += " -m128bit-long-double" ### gcc only
|
72
|
+
|
73
|
+
|
74
|
+
# --- check data types
|
75
|
+
|
76
|
+
header = ["ruby.h"]
|
77
|
+
|
78
|
+
if have_header("sys/types.h")
|
79
|
+
header.push "sys/types.h"
|
80
|
+
end
|
81
|
+
|
82
|
+
if have_header("stdint.h")
|
83
|
+
header.push "stdint.h"
|
84
|
+
end
|
85
|
+
|
86
|
+
have_type("int8_t", header)
|
87
|
+
have_type("uint8_t", header)
|
88
|
+
have_type("int16_t", header)
|
89
|
+
have_type("uint16_t", header)
|
90
|
+
have_type("int32_t", header)
|
91
|
+
have_type("uint32_t", header)
|
92
|
+
have_type("int64_t", header)
|
93
|
+
have_type("uint64_t", header)
|
94
|
+
|
95
|
+
if RUBY_VERSION_CODE < 191
|
96
|
+
if have_type("long long", header)
|
97
|
+
check_sizeof("long long")
|
98
|
+
end
|
99
|
+
if have_type("float", header)
|
100
|
+
check_sizeof("float", header)
|
101
|
+
end
|
102
|
+
if have_type("double", header)
|
103
|
+
check_sizeof("double", header)
|
104
|
+
end
|
105
|
+
if have_type("long double", header)
|
106
|
+
check_sizeof("long double")
|
107
|
+
end
|
108
|
+
if have_header("complex.h")
|
109
|
+
complex_h = "complex.h"
|
110
|
+
if have_type("float complex", complex_h)
|
111
|
+
check_sizeof("float complex", complex_h)
|
112
|
+
end
|
113
|
+
if have_type("double complex", complex_h)
|
114
|
+
check_sizeof("double complex", complex_h)
|
115
|
+
end
|
116
|
+
else
|
117
|
+
complex_h = nil
|
118
|
+
end
|
119
|
+
else
|
120
|
+
have_type("long long", header)
|
121
|
+
have_type("float", header)
|
122
|
+
have_type("double", header)
|
123
|
+
if have_header("complex.h")
|
124
|
+
complex_h = "complex.h"
|
125
|
+
have_type("float complex", complex_h)
|
126
|
+
have_type("double complex", complex_h)
|
127
|
+
else
|
128
|
+
complex_h = nil
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# --- check tgmath.h
|
133
|
+
|
134
|
+
have_header("tgmath.h")
|
135
|
+
|
136
|
+
# --- check mergesort routine
|
137
|
+
|
138
|
+
have_func("mergesort", "stdlib.h")
|
139
|
+
|
140
|
+
# --- setup install files
|
141
|
+
|
142
|
+
$INSTALLFILES = []
|
143
|
+
$INSTALLFILES << ['carray.h', '$(archdir)']
|
144
|
+
$INSTALLFILES << ['carray_config.h', '$(archdir)']
|
145
|
+
|
146
|
+
# --- cygwin/mingw
|
147
|
+
#
|
148
|
+
# Installing the static link library "libcarray.a".
|
149
|
+
# This technique is based on extconf.rb in Ruby/NArray distribution.
|
150
|
+
#
|
151
|
+
|
152
|
+
if /cygwin|mingw/ =~ RUBY_PLATFORM
|
153
|
+
sitearchdir = Config::CONFIG["sitearchdir"]
|
154
|
+
$DLDFLAGS << " -L#{sitearchdir} -Wl,--out-implib=libcarray.a "
|
155
|
+
unless File.exist? "libcarray.a"
|
156
|
+
$TOUCHED_LIBCARRAY_A = true
|
157
|
+
open("libcarray.a", "w") {}
|
158
|
+
end
|
159
|
+
$INSTALLFILES << ['libcarray.a', '$(archdir)']
|
160
|
+
end
|
161
|
+
|
162
|
+
# --- create carray_config.h
|
163
|
+
#
|
164
|
+
# Creating "carray_config.h".
|
165
|
+
#
|
166
|
+
|
167
|
+
config_h = "carray_config.h"
|
168
|
+
create_header(config_h)
|
169
|
+
|
170
|
+
$defs = [] # Now these definitions are in carray_config.h.
|
171
|
+
|
172
|
+
# --- create carray_math.c, carray_stat_proc.c
|
173
|
+
|
174
|
+
if ( not File.exist?("carray_cast_func.c") ) or
|
175
|
+
File.stat("carray_cast_func.rb").mtime > File.stat("carray_cast_func.c").mtime
|
176
|
+
system("ruby carray_cast_func.rb > carray_cast_func.c")
|
177
|
+
end
|
178
|
+
|
179
|
+
if ( not File.exist?("carray_math.c") ) or
|
180
|
+
File.stat("carray_math.rb").mtime > File.stat("carray_math.c").mtime
|
181
|
+
system("ruby carray_math.rb")
|
182
|
+
end
|
183
|
+
|
184
|
+
if ( not File.exist?("carray_stat_proc.c") ) or
|
185
|
+
File.stat("carray_stat_proc.rb").mtime > File.stat("carray_stat_proc.c").mtime
|
186
|
+
system("ruby carray_stat_proc.rb > carray_stat_proc.c")
|
187
|
+
end
|
188
|
+
|
189
|
+
puts "creating rdoc_ext.rb"
|
190
|
+
system %{
|
191
|
+
ruby utils/extract_rdoc.rb > rdoc_ext.rb
|
192
|
+
}
|
193
|
+
|
194
|
+
# --- create Makefile
|
195
|
+
|
196
|
+
create_makefile("carray_ext")
|
197
|
+
|
198
|
+
# --- remove dummy 'libcarray.a' for cygwin/mingw
|
199
|
+
|
200
|
+
if $TOUCHED_LIBCARRAY_A
|
201
|
+
File.unlink("libcarray.a")
|
202
|
+
end
|
203
|
+
|
204
|
+
# --- modify Makefile
|
205
|
+
|
206
|
+
makefile_orig = File.read("Makefile")
|
207
|
+
|
208
|
+
mk = open("Makefile", "w")
|
209
|
+
mk.puts makefile_orig
|
210
|
+
|
211
|
+
mk.write <<MAKEFILE_LOCAL
|
212
|
+
CA_VERSION = ${shell ${RUBY} version.rb}
|
213
|
+
GEMFILE = carray-${CA_VERSION}.gem
|
214
|
+
|
215
|
+
carray_cast_func.c: carray_cast_func.rb
|
216
|
+
${RUBY} carray_cast_func.rb > carray_cast_func.c
|
217
|
+
|
218
|
+
carray_stat_proc.c: carray_stat_proc.rb
|
219
|
+
${RUBY} carray_stat_proc.rb > carray_stat_proc.c
|
220
|
+
|
221
|
+
carray_math.c: carray_math.rb
|
222
|
+
${RUBY} carray_math.rb
|
223
|
+
|
224
|
+
${GEMFILE}: all carray.gemspec
|
225
|
+
@export IN_GEM_BUILD=1; \\
|
226
|
+
gem build carray.gemspec
|
227
|
+
|
228
|
+
build-gem: ${GEMFILE}
|
229
|
+
|
230
|
+
install-gem: ${GEMFILE}
|
231
|
+
@export IN_GEM_BUILD=1; \\
|
232
|
+
gem install ${GEMFILE}
|
233
|
+
|
234
|
+
uninstall-gem:
|
235
|
+
gem uninstall carray --version "${CA_VERSION}"
|
236
|
+
|
237
|
+
package:
|
238
|
+
@rake package;
|
239
|
+
|
240
|
+
test:
|
241
|
+
@rake test
|
242
|
+
|
243
|
+
.PHONY: test
|
244
|
+
|
245
|
+
rdoc:
|
246
|
+
sh utils/create_rdoc.sh
|
247
|
+
|
248
|
+
clean-generated:
|
249
|
+
@rm -f carray_config.h lib/carray/config.rb
|
250
|
+
@rm -f carray_cast_func.c carray_math.c carray_stat_proc.c
|
251
|
+
@rm -f ${GEMFILE}
|
252
|
+
@rm -rf pkg
|
253
|
+
@rm -f rdoc_ext.rb
|
254
|
+
@rm -rf doc
|
255
|
+
@rm -rf conftest.dSYM ext/*/conftest.dSYM
|
256
|
+
|
257
|
+
distclean: clean-generated
|
258
|
+
MAKEFILE_LOCAL
|
259
|
+
mk.close
|
260
|
+
|
261
|
+
|
data/version.h
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
/* ---------------------------------------------------------------------------
|
2
|
+
|
3
|
+
version.h
|
4
|
+
|
5
|
+
This file is part of Ruby/CArray extension library.
|
6
|
+
You can redistribute it and/or modify it under the terms of
|
7
|
+
the Ruby Licence.
|
8
|
+
|
9
|
+
Copyright (C) 2005 Hiroki Motoyoshi
|
10
|
+
|
11
|
+
---------------------------------------------------------------------------- */
|
12
|
+
|
13
|
+
#define CA_VERSION "1.1.4"
|
14
|
+
#define CA_VERSION_CODE 114
|
15
|
+
#define CA_VERSION_MAJOR 1
|
16
|
+
#define CA_VERSION_MINOR 1
|
17
|
+
#define CA_VERSION_TEENY 4
|
18
|
+
#define CA_VERSION_DATE "2016/05/06"
|
data/version.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# version.rb
|
4
|
+
#
|
5
|
+
# This file is part of Ruby/CArray extension library.
|
6
|
+
# You can redistribute it and/or modify it under the terms of
|
7
|
+
# the Ruby Licence.
|
8
|
+
#
|
9
|
+
# Copyright (C) 2005 Hiroki Motoyoshi
|
10
|
+
#
|
11
|
+
# ----------------------------------------------------------------------------
|
12
|
+
|
13
|
+
def carray_version
|
14
|
+
|
15
|
+
io = open(File.join(File.dirname(__FILE__), "version.h"))
|
16
|
+
while line = io.gets
|
17
|
+
case line
|
18
|
+
when /^#define CA_VERSION (.*)$/
|
19
|
+
ca_version = $1.strip[1..-2]
|
20
|
+
when /^#define CA_VERSION_CODE (.*)$/
|
21
|
+
ca_version_code = $1.to_i
|
22
|
+
when /^#define CA_VERSION_MAJOR (.*)$/
|
23
|
+
ca_version_major = $1.to_i
|
24
|
+
when /^#define CA_VERSION_MINOR (.*)$/
|
25
|
+
ca_version_minor = $1.to_i
|
26
|
+
when /^#define CA_VERSION_TEENY (.*)$/
|
27
|
+
ca_version_teeny = $1.to_i
|
28
|
+
when /^#define CA_VERSION_DATE (.*)$/
|
29
|
+
ca_version_date = $1.strip[1..-2]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
io.close
|
33
|
+
|
34
|
+
ca_version2 = format("%i.%i.%i",
|
35
|
+
ca_version_major, ca_version_minor, ca_version_teeny)
|
36
|
+
ca_version_code2 =
|
37
|
+
100 * ca_version_major + 10*ca_version_minor + ca_version_teeny
|
38
|
+
|
39
|
+
if ca_version != ca_version2 or ca_version_code != ca_version_code2
|
40
|
+
raise "invalid version.h"
|
41
|
+
end
|
42
|
+
|
43
|
+
return [ca_version, ca_version_date]
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
if __FILE__ == $0
|
48
|
+
|
49
|
+
version, date = carray_version()
|
50
|
+
puts version
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: carray
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.4
|
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
|
+
CArray is a uniform multi-dimensional rectangular array class.
|
15
|
+
It provides the various types of sub-arrays and references
|
16
|
+
pointing the data elements of original array (slice, grid, selection ...).
|
17
|
+
Element-wise masking and mathematical operations are natively supported.
|
18
|
+
email: ''
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- README.md
|
24
|
+
- carray.gemspec
|
25
|
+
- extconf.rb
|
26
|
+
- version.h
|
27
|
+
- version.rb
|
28
|
+
homepage: https://github.com/himotoyoshi/carray
|
29
|
+
licenses: []
|
30
|
+
metadata: {}
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options:
|
33
|
+
- "--main=rdoc_main.rb"
|
34
|
+
- rdoc_main.rb
|
35
|
+
- rdoc_ext.rb
|
36
|
+
- rdoc_math.rb
|
37
|
+
- rdoc_stat.rb
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.8.1
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements:
|
51
|
+
- 'C compiler supports C99 complex and '
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 2.6.3
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: Multi-dimesional array class
|
57
|
+
test_files: []
|