pnmatrix 1.2.4
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.
- checksums.yaml +7 -0
- data/ext/nmatrix/binary_format.txt +53 -0
- data/ext/nmatrix/data/complex.h +388 -0
- data/ext/nmatrix/data/data.cpp +274 -0
- data/ext/nmatrix/data/data.h +651 -0
- data/ext/nmatrix/data/meta.h +64 -0
- data/ext/nmatrix/data/ruby_object.h +386 -0
- data/ext/nmatrix/extconf.rb +70 -0
- data/ext/nmatrix/math/asum.h +99 -0
- data/ext/nmatrix/math/cblas_enums.h +36 -0
- data/ext/nmatrix/math/cblas_templates_core.h +507 -0
- data/ext/nmatrix/math/gemm.h +241 -0
- data/ext/nmatrix/math/gemv.h +178 -0
- data/ext/nmatrix/math/getrf.h +255 -0
- data/ext/nmatrix/math/getrs.h +121 -0
- data/ext/nmatrix/math/imax.h +82 -0
- data/ext/nmatrix/math/laswp.h +165 -0
- data/ext/nmatrix/math/long_dtype.h +62 -0
- data/ext/nmatrix/math/magnitude.h +54 -0
- data/ext/nmatrix/math/math.h +751 -0
- data/ext/nmatrix/math/nrm2.h +165 -0
- data/ext/nmatrix/math/rot.h +117 -0
- data/ext/nmatrix/math/rotg.h +106 -0
- data/ext/nmatrix/math/scal.h +71 -0
- data/ext/nmatrix/math/trsm.h +336 -0
- data/ext/nmatrix/math/util.h +162 -0
- data/ext/nmatrix/math.cpp +1368 -0
- data/ext/nmatrix/nm_memory.h +60 -0
- data/ext/nmatrix/nmatrix.cpp +285 -0
- data/ext/nmatrix/nmatrix.h +476 -0
- data/ext/nmatrix/ruby_constants.cpp +151 -0
- data/ext/nmatrix/ruby_constants.h +106 -0
- data/ext/nmatrix/ruby_nmatrix.c +3130 -0
- data/ext/nmatrix/storage/common.cpp +77 -0
- data/ext/nmatrix/storage/common.h +183 -0
- data/ext/nmatrix/storage/dense/dense.cpp +1096 -0
- data/ext/nmatrix/storage/dense/dense.h +129 -0
- data/ext/nmatrix/storage/list/list.cpp +1628 -0
- data/ext/nmatrix/storage/list/list.h +138 -0
- data/ext/nmatrix/storage/storage.cpp +730 -0
- data/ext/nmatrix/storage/storage.h +99 -0
- data/ext/nmatrix/storage/yale/class.h +1139 -0
- data/ext/nmatrix/storage/yale/iterators/base.h +143 -0
- data/ext/nmatrix/storage/yale/iterators/iterator.h +131 -0
- data/ext/nmatrix/storage/yale/iterators/row.h +450 -0
- data/ext/nmatrix/storage/yale/iterators/row_stored.h +140 -0
- data/ext/nmatrix/storage/yale/iterators/row_stored_nd.h +169 -0
- data/ext/nmatrix/storage/yale/iterators/stored_diagonal.h +124 -0
- data/ext/nmatrix/storage/yale/math/transpose.h +110 -0
- data/ext/nmatrix/storage/yale/yale.cpp +2074 -0
- data/ext/nmatrix/storage/yale/yale.h +203 -0
- data/ext/nmatrix/types.h +55 -0
- data/ext/nmatrix/util/io.cpp +279 -0
- data/ext/nmatrix/util/io.h +115 -0
- data/ext/nmatrix/util/sl_list.cpp +627 -0
- data/ext/nmatrix/util/sl_list.h +144 -0
- data/ext/nmatrix/util/util.h +78 -0
- data/lib/nmatrix/blas.rb +378 -0
- data/lib/nmatrix/cruby/math.rb +744 -0
- data/lib/nmatrix/enumerate.rb +253 -0
- data/lib/nmatrix/homogeneous.rb +241 -0
- data/lib/nmatrix/io/fortran_format.rb +138 -0
- data/lib/nmatrix/io/harwell_boeing.rb +221 -0
- data/lib/nmatrix/io/market.rb +263 -0
- data/lib/nmatrix/io/point_cloud.rb +189 -0
- data/lib/nmatrix/jruby/decomposition.rb +24 -0
- data/lib/nmatrix/jruby/enumerable.rb +13 -0
- data/lib/nmatrix/jruby/error.rb +4 -0
- data/lib/nmatrix/jruby/math.rb +501 -0
- data/lib/nmatrix/jruby/nmatrix_java.rb +840 -0
- data/lib/nmatrix/jruby/operators.rb +283 -0
- data/lib/nmatrix/jruby/slice.rb +264 -0
- data/lib/nmatrix/lapack_core.rb +181 -0
- data/lib/nmatrix/lapack_plugin.rb +44 -0
- data/lib/nmatrix/math.rb +953 -0
- data/lib/nmatrix/mkmf.rb +100 -0
- data/lib/nmatrix/monkeys.rb +137 -0
- data/lib/nmatrix/nmatrix.rb +1172 -0
- data/lib/nmatrix/rspec.rb +75 -0
- data/lib/nmatrix/shortcuts.rb +1163 -0
- data/lib/nmatrix/version.rb +39 -0
- data/lib/nmatrix/yale_functions.rb +118 -0
- data/lib/nmatrix.rb +28 -0
- data/spec/00_nmatrix_spec.rb +892 -0
- data/spec/01_enum_spec.rb +196 -0
- data/spec/02_slice_spec.rb +407 -0
- data/spec/03_nmatrix_monkeys_spec.rb +80 -0
- data/spec/2x2_dense_double.mat +0 -0
- data/spec/4x4_sparse.mat +0 -0
- data/spec/4x5_dense.mat +0 -0
- data/spec/blas_spec.rb +215 -0
- data/spec/elementwise_spec.rb +311 -0
- data/spec/homogeneous_spec.rb +100 -0
- data/spec/io/fortran_format_spec.rb +88 -0
- data/spec/io/harwell_boeing_spec.rb +98 -0
- data/spec/io/test.rua +9 -0
- data/spec/io_spec.rb +159 -0
- data/spec/lapack_core_spec.rb +482 -0
- data/spec/leakcheck.rb +16 -0
- data/spec/math_spec.rb +1363 -0
- data/spec/nmatrix_yale_resize_test_associations.yaml +2802 -0
- data/spec/nmatrix_yale_spec.rb +286 -0
- data/spec/rspec_monkeys.rb +56 -0
- data/spec/rspec_spec.rb +35 -0
- data/spec/shortcuts_spec.rb +474 -0
- data/spec/slice_set_spec.rb +162 -0
- data/spec/spec_helper.rb +172 -0
- data/spec/stat_spec.rb +214 -0
- data/spec/test.pcd +20 -0
- data/spec/utm5940.mtx +83844 -0
- metadata +295 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# = NMatrix
|
|
3
|
+
#
|
|
4
|
+
# A linear algebra library for scientific computation in Ruby.
|
|
5
|
+
# NMatrix is part of SciRuby.
|
|
6
|
+
#
|
|
7
|
+
# NMatrix was originally inspired by and derived from NArray, by
|
|
8
|
+
# Masahiro Tanaka: http://narray.rubyforge.org
|
|
9
|
+
#
|
|
10
|
+
# == Copyright Information
|
|
11
|
+
#
|
|
12
|
+
# SciRuby is Copyright (c) 2010 - 2016, Ruby Science Foundation
|
|
13
|
+
# NMatrix is Copyright (c) 2012 - 2016, John Woods and the Ruby Science Foundation
|
|
14
|
+
#
|
|
15
|
+
# Please see LICENSE.txt for additional copyright notices.
|
|
16
|
+
#
|
|
17
|
+
# == Contributing
|
|
18
|
+
#
|
|
19
|
+
# By contributing source code to SciRuby, you agree to be bound by
|
|
20
|
+
# our Contributor Agreement:
|
|
21
|
+
#
|
|
22
|
+
# * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
|
|
23
|
+
#++
|
|
24
|
+
|
|
25
|
+
class NMatrix
|
|
26
|
+
# Note that the format of the VERSION string is needed for NMatrix
|
|
27
|
+
# native IO. If you change the format, please make sure that native
|
|
28
|
+
# IO can still understand NMatrix::VERSION.
|
|
29
|
+
module VERSION #:nodoc:
|
|
30
|
+
MAJOR = 1
|
|
31
|
+
MINOR = 2
|
|
32
|
+
TINY = 4
|
|
33
|
+
#PRE = "a"
|
|
34
|
+
|
|
35
|
+
STRING = [MAJOR, MINOR, TINY].compact.join(".")
|
|
36
|
+
#STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# = NMatrix
|
|
3
|
+
#
|
|
4
|
+
# A linear algebra library for scientific computation in Ruby.
|
|
5
|
+
# NMatrix is part of SciRuby.
|
|
6
|
+
#
|
|
7
|
+
# NMatrix was originally inspired by and derived from NArray, by
|
|
8
|
+
# Masahiro Tanaka: http://narray.rubyforge.org
|
|
9
|
+
#
|
|
10
|
+
# == Copyright Information
|
|
11
|
+
#
|
|
12
|
+
# SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation
|
|
13
|
+
# NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation
|
|
14
|
+
#
|
|
15
|
+
# Please see LICENSE.txt for additional copyright notices.
|
|
16
|
+
#
|
|
17
|
+
# == Contributing
|
|
18
|
+
#
|
|
19
|
+
# By contributing source code to SciRuby, you agree to be bound by
|
|
20
|
+
# our Contributor Agreement:
|
|
21
|
+
#
|
|
22
|
+
# * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
|
|
23
|
+
#
|
|
24
|
+
# == yale_functions.rb
|
|
25
|
+
#
|
|
26
|
+
# This file contains some shortcut functions for the specialty
|
|
27
|
+
# Yale matrix extensions (mostly for debugging and experimental
|
|
28
|
+
# purposes, but sometimes applicable when you need to speed up
|
|
29
|
+
# your code a lot).
|
|
30
|
+
#++
|
|
31
|
+
|
|
32
|
+
module NMatrix::YaleFunctions
|
|
33
|
+
# call-seq:
|
|
34
|
+
# yale_nd_row_size(i) -> Fixnum
|
|
35
|
+
#
|
|
36
|
+
# Returns the size of a given non-diagonal row.
|
|
37
|
+
def yale_nd_row_size i
|
|
38
|
+
yale_ija(i+1) - yale_ija(i)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# call-seq:
|
|
42
|
+
# yale_ja_at(i) -> Array
|
|
43
|
+
#
|
|
44
|
+
# Returns the non-diagonal column indices which are stored in a given row.
|
|
45
|
+
def yale_ja_at i
|
|
46
|
+
yale_nd_row(i, :keys)
|
|
47
|
+
end
|
|
48
|
+
alias :yale_nd_row_as_array :yale_ja_at
|
|
49
|
+
|
|
50
|
+
# call-seq:
|
|
51
|
+
# yale_ja_set_at(i) -> Set
|
|
52
|
+
#
|
|
53
|
+
# Returns the non-diagonal column indices which are stored in a given row, as a Set.
|
|
54
|
+
def yale_ja_set_at i
|
|
55
|
+
require 'set'
|
|
56
|
+
yale_nd_row(i, :keys).to_set
|
|
57
|
+
end
|
|
58
|
+
alias :yale_nd_row_as_set :yale_ja_set_at
|
|
59
|
+
|
|
60
|
+
# call-seq:
|
|
61
|
+
# yale_ja_sorted_set_at -> SortedSet
|
|
62
|
+
#
|
|
63
|
+
# Returns the non-diagonal column indices which are stored in a given row, as a Set.
|
|
64
|
+
def yale_ja_sorted_set_at i
|
|
65
|
+
require 'set'
|
|
66
|
+
SortedSet.new(yale_nd_row(i, :keys))
|
|
67
|
+
end
|
|
68
|
+
alias :yale_nd_row_as_sorted_set :yale_ja_sorted_set_at
|
|
69
|
+
|
|
70
|
+
# call-seq:
|
|
71
|
+
# yale_nd_row_as_hash(i) -> Hash
|
|
72
|
+
#
|
|
73
|
+
# Returns the non-diagonal column indices and entries stored in a given row.
|
|
74
|
+
def yale_nd_row_as_hash i
|
|
75
|
+
yale_nd_row(i, :hash)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# call-seq:
|
|
79
|
+
# yale_ja_d_keys_at(i) -> Array
|
|
80
|
+
#
|
|
81
|
+
# Returns the diagonal and non-digonal column indices stored in a given row.
|
|
82
|
+
def yale_ja_d_keys_at i
|
|
83
|
+
ary = yale_nd_row(i, :keys)
|
|
84
|
+
return ary if i >= self.shape[1] || self[i,i] == self.default_value
|
|
85
|
+
ary << i
|
|
86
|
+
end
|
|
87
|
+
alias :yale_row_as_array :yale_ja_d_keys_at
|
|
88
|
+
|
|
89
|
+
# call-seq:
|
|
90
|
+
# yale_ja_d_keys_set_at(i) -> Set
|
|
91
|
+
#
|
|
92
|
+
# Returns the diagonal and non-diagonal column indices stored in a given row.
|
|
93
|
+
def yale_ja_d_keys_set_at i
|
|
94
|
+
require 'set'
|
|
95
|
+
yale_ja_d_keys_at(i).to_set
|
|
96
|
+
end
|
|
97
|
+
alias :yale_row_as_set :yale_ja_d_keys_set_at
|
|
98
|
+
|
|
99
|
+
# call-seq:
|
|
100
|
+
# yale_ja_d_keys_sorted_set_at(i) -> SortedSet
|
|
101
|
+
#
|
|
102
|
+
# Returns the diagonal and non-diagonal column indices stored in a given row.
|
|
103
|
+
def yale_ja_d_keys_sorted_set_at i
|
|
104
|
+
require 'set'
|
|
105
|
+
SortedSet.new(yale_row_as_array(i))
|
|
106
|
+
end
|
|
107
|
+
alias :yale_row_as_sorted_set :yale_ja_d_keys_sorted_set_at
|
|
108
|
+
|
|
109
|
+
# call-seq:
|
|
110
|
+
# yale_row_as_hash(i) -> Hash
|
|
111
|
+
#
|
|
112
|
+
# Returns the diagonal and non-diagonal column indices and entries stored in a given row.
|
|
113
|
+
def yale_row_as_hash i
|
|
114
|
+
h = yale_nd_row(i, :hash)
|
|
115
|
+
return h if i >= self.shape[1] || self[i,i] == self.default_value
|
|
116
|
+
h[i] = self[i,i]
|
|
117
|
+
end
|
|
118
|
+
end
|
data/lib/nmatrix.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# = NMatrix
|
|
2
|
+
#
|
|
3
|
+
# A linear algebra library for scientific computation in Ruby.
|
|
4
|
+
# NMatrix is part of SciRuby.
|
|
5
|
+
#
|
|
6
|
+
# NMatrix was originally inspired by and derived from NArray, by
|
|
7
|
+
# Masahiro Tanaka: http://narray.rubyforge.org
|
|
8
|
+
#
|
|
9
|
+
# == Copyright Information
|
|
10
|
+
#
|
|
11
|
+
# SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation
|
|
12
|
+
# NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation
|
|
13
|
+
#
|
|
14
|
+
# Please see LICENSE.txt for additional copyright notices.
|
|
15
|
+
#
|
|
16
|
+
# == Contributing
|
|
17
|
+
#
|
|
18
|
+
# By contributing source code to SciRuby, you agree to be bound by
|
|
19
|
+
# our Contributor Agreement:
|
|
20
|
+
#
|
|
21
|
+
# * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
|
|
22
|
+
#
|
|
23
|
+
# == nmatrix.rb
|
|
24
|
+
#
|
|
25
|
+
# This file is a stub that only loads the main NMatrix file.
|
|
26
|
+
#
|
|
27
|
+
|
|
28
|
+
require 'nmatrix/nmatrix.rb'
|