nmatrix 0.1.0 → 0.2.0

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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/ext/nmatrix/data/complex.h +20 -55
  3. data/ext/nmatrix/data/data.cpp +11 -44
  4. data/ext/nmatrix/data/data.h +174 -311
  5. data/ext/nmatrix/data/meta.h +1 -7
  6. data/ext/nmatrix/data/ruby_object.h +3 -85
  7. data/ext/nmatrix/extconf.rb +2 -73
  8. data/ext/nmatrix/math.cpp +170 -813
  9. data/ext/nmatrix/math/asum.h +2 -25
  10. data/ext/nmatrix/math/{inc.h → cblas_enums.h} +11 -22
  11. data/ext/nmatrix/math/cblas_templates_core.h +507 -0
  12. data/ext/nmatrix/math/gemm.h +2 -32
  13. data/ext/nmatrix/math/gemv.h +1 -35
  14. data/ext/nmatrix/math/getrf.h +21 -6
  15. data/ext/nmatrix/math/getrs.h +0 -8
  16. data/ext/nmatrix/math/imax.h +0 -22
  17. data/ext/nmatrix/math/long_dtype.h +0 -3
  18. data/ext/nmatrix/math/math.h +11 -337
  19. data/ext/nmatrix/math/nrm2.h +2 -23
  20. data/ext/nmatrix/math/rot.h +1 -25
  21. data/ext/nmatrix/math/rotg.h +4 -13
  22. data/ext/nmatrix/math/scal.h +0 -22
  23. data/ext/nmatrix/math/trsm.h +0 -55
  24. data/ext/nmatrix/math/util.h +148 -0
  25. data/ext/nmatrix/nmatrix.cpp +0 -14
  26. data/ext/nmatrix/nmatrix.h +92 -84
  27. data/ext/nmatrix/ruby_constants.cpp +0 -2
  28. data/ext/nmatrix/ruby_constants.h +0 -2
  29. data/ext/nmatrix/ruby_nmatrix.c +86 -45
  30. data/ext/nmatrix/storage/dense/dense.cpp +1 -7
  31. data/ext/nmatrix/storage/storage.h +0 -1
  32. data/ext/nmatrix/ttable_helper.rb +0 -6
  33. data/ext/nmatrix/util/io.cpp +1 -1
  34. data/lib/nmatrix.rb +1 -19
  35. data/lib/nmatrix/blas.rb +33 -11
  36. data/lib/nmatrix/io/market.rb +3 -3
  37. data/lib/nmatrix/lapack_core.rb +181 -0
  38. data/lib/nmatrix/lapack_plugin.rb +44 -0
  39. data/lib/nmatrix/math.rb +382 -131
  40. data/lib/nmatrix/monkeys.rb +2 -3
  41. data/lib/nmatrix/nmatrix.rb +166 -13
  42. data/lib/nmatrix/shortcuts.rb +72 -7
  43. data/lib/nmatrix/version.rb +2 -2
  44. data/spec/00_nmatrix_spec.rb +154 -5
  45. data/spec/02_slice_spec.rb +2 -6
  46. data/spec/03_nmatrix_monkeys_spec.rb +7 -1
  47. data/spec/blas_spec.rb +60 -33
  48. data/spec/homogeneous_spec.rb +10 -10
  49. data/spec/lapack_core_spec.rb +482 -0
  50. data/spec/math_spec.rb +436 -52
  51. data/spec/shortcuts_spec.rb +28 -4
  52. data/spec/spec_helper.rb +14 -2
  53. data/spec/utm5940.mtx +83844 -0
  54. metadata +49 -76
  55. data/.gitignore +0 -27
  56. data/.rspec +0 -2
  57. data/.travis.yml +0 -15
  58. data/CONTRIBUTING.md +0 -82
  59. data/Gemfile +0 -2
  60. data/History.txt +0 -677
  61. data/LICENSE.txt +0 -23
  62. data/Manifest.txt +0 -92
  63. data/README.rdoc +0 -150
  64. data/Rakefile +0 -216
  65. data/ext/nmatrix/data/rational.h +0 -440
  66. data/ext/nmatrix/math/geev.h +0 -82
  67. data/ext/nmatrix/math/ger.h +0 -96
  68. data/ext/nmatrix/math/gesdd.h +0 -80
  69. data/ext/nmatrix/math/gesvd.h +0 -78
  70. data/ext/nmatrix/math/getf2.h +0 -86
  71. data/ext/nmatrix/math/getri.h +0 -108
  72. data/ext/nmatrix/math/potrs.h +0 -129
  73. data/ext/nmatrix/math/swap.h +0 -52
  74. data/lib/nmatrix/lapack.rb +0 -240
  75. data/nmatrix.gemspec +0 -55
  76. data/scripts/mac-brew-gcc.sh +0 -50
  77. data/scripts/mac-mavericks-brew-gcc.sh +0 -22
  78. data/spec/lapack_spec.rb +0 -459
@@ -1,23 +0,0 @@
1
- This version of NMatrix is licensed under the BSD 2-clause license.
2
-
3
- * http://sciruby.com
4
- * http://github.com/sciruby/sciruby/wiki/License
5
-
6
- You *must* read the Contributor Agreement before contributing code to the SciRuby Project. This is available online:
7
-
8
- * http://github.com/sciruby/sciruby/wiki/Contributor-Agreement
9
-
10
- -----
11
-
12
- Copyright (c) 2010 - 2015, John Woods and the Ruby Science Foundation
13
- All rights reserved.
14
-
15
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16
-
17
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18
-
19
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20
-
21
- * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22
-
23
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,92 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.rdoc
4
- LICENSE.txt
5
- CONTRIBUTING.md
6
- Rakefile
7
- Gemfile
8
- Guardfile
9
- nmatrix.gemspec
10
- .travis.yml
11
- lib/nmatrix.rb
12
- lib/nmatrix/rspec.rb
13
- lib/nmatrix/io/market.rb
14
- lib/nmatrix/io/mat5_reader.rb
15
- lib/nmatrix/io/mat_reader.rb
16
- lib/nmatrix/io/point_cloud.rb
17
- lib/nmatrix/io/fortran_format.rb
18
- lib/nmatrix/io/harwell_boeing.rb
19
- lib/nmatrix/blas.rb
20
- lib/nmatrix/enumerate.rb
21
- lib/nmatrix/homogeneous.rb
22
- lib/nmatrix/lapack.rb
23
- lib/nmatrix/math.rb
24
- lib/nmatrix/monkeys.rb
25
- lib/nmatrix/nmatrix.rb
26
- lib/nmatrix/rspec.rb
27
- lib/nmatrix/shortcuts.rb
28
- lib/nmatrix/version.rb
29
- lib/nmatrix/yale_functions.rb
30
- ext/nmatrix/data/complex.h
31
- ext/nmatrix/data/data.cpp
32
- ext/nmatrix/data/data.h
33
- ext/nmatrix/data/meta.h
34
- ext/nmatrix/data/rational.h
35
- ext/nmatrix/data/ruby_object.h
36
- ext/nmatrix/storage/common.cpp
37
- ext/nmatrix/storage/common.h
38
- ext/nmatrix/storage/storage.cpp
39
- ext/nmatrix/storage/storage.h
40
- ext/nmatrix/storage/dense/dense.cpp
41
- ext/nmatrix/storage/dense/dense.h
42
- ext/nmatrix/storage/list/list.cpp
43
- ext/nmatrix/storage/list/list.h
44
- ext/nmatrix/storage/yale/yale.cpp
45
- ext/nmatrix/storage/yale/yale.h
46
- ext/nmatrix/storage/yale/class.h
47
- ext/nmatrix/storage/yale/iterators/base.h
48
- ext/nmatrix/storage/yale/iterators/iterator.h
49
- ext/nmatrix/storage/yale/iterators/row.h
50
- ext/nmatrix/storage/yale/iterators/row_stored.h
51
- ext/nmatrix/storage/yale/iterators/row_stored_nd.h
52
- ext/nmatrix/storage/yale/iterators/stored_diagonal.h
53
- ext/nmatrix/storage/yale/math/transpose.h
54
- ext/nmatrix/util/io.cpp
55
- ext/nmatrix/util/io.h
56
- ext/nmatrix/util/sl_list.cpp
57
- ext/nmatrix/util/sl_list.h
58
- ext/nmatrix/util/util.h
59
- ext/nmatrix/math.cpp
60
- ext/nmatrix/math/asum.h
61
- ext/nmatrix/math/geev.h
62
- ext/nmatrix/math/gemm.h
63
- ext/nmatrix/math/gemv.h
64
- ext/nmatrix/math/ger.h
65
- ext/nmatrix/math/gesdd.h
66
- ext/nmatrix/math/gesvd.h
67
- ext/nmatrix/math/getf2.h
68
- ext/nmatrix/math/getrf.h
69
- ext/nmatrix/math/getri.h
70
- ext/nmatrix/math/getrs.h
71
- ext/nmatrix/math/imax.h
72
- ext/nmatrix/math/inc.h
73
- ext/nmatrix/math/laswp.h
74
- ext/nmatrix/math/long_dtype.h
75
- ext/nmatrix/math/math.h
76
- ext/nmatrix/math/nrm2.h
77
- ext/nmatrix/math/potrs.h
78
- ext/nmatrix/math/rot.h
79
- ext/nmatrix/math/rotg.h
80
- ext/nmatrix/math/scal.h
81
- ext/nmatrix/math/swap.h
82
- ext/nmatrix/math/trsm.h
83
- ext/nmatrix/nmatrix.cpp
84
- ext/nmatrix/nmatrix.h
85
- ext/nmatrix/ruby_constants.cpp
86
- ext/nmatrix/ruby_constants.h
87
- ext/nmatrix/ruby_nmatrix.c
88
- ext/nmatrix/types.h
89
- ext/nmatrix/nm_memory.h
90
- ext/nmatrix/extconf.rb
91
-
92
-
@@ -1,150 +0,0 @@
1
- = NMatrix
2
-
3
- Fast Numerical Linear Algebra Library for Ruby
4
-
5
- * {sciruby.com}[http://sciruby.com]
6
- * {Google+}[https://plus.google.com/109304769076178160953/posts]
7
- * {Google Group - Mailing List}[https://groups.google.com/forum/#!forum/sciruby-dev]
8
- * {NMatrix Installation wiki}[https://github.com/SciRuby/nmatrix/wiki/Installation]
9
- * {SciRuby Installation guide}[http://sciruby.com/docs#installation]
10
-
11
- {<img src=https://travis-ci.org/SciRuby/nmatrix.png>}[https://travis-ci.org/SciRuby/nmatrix]
12
-
13
- {<img src="https://codeclimate.com/github/SciRuby/nmatrix.png" />}[https://codeclimate.com/github/SciRuby/nmatrix]
14
-
15
- == Description
16
-
17
- NMatrix is a fast numerical linear algebra library for Ruby, with dense and sparse matrices, written mostly in C and
18
- C++. It is part of the SciRuby project.
19
-
20
- NMatrix was inspired by {NArray}[http://narray.rubyforge.org], by Masahiro Tanaka.
21
-
22
- == Installation
23
-
24
- To install the latest stable version:
25
-
26
- gem install nmatrix --pre
27
-
28
- However, you will need to install {ATLAS}[http://math-atlas.sourceforge.net/] with CBLAS (C interface to
29
- {BLAS}[http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms]) first. Detailed directions can be found
30
- {here}[https://github.com/SciRuby/nmatrix/wiki/Installation]. The requirements for NMatrix are:
31
-
32
- * ATLAS, preferably with CLAPACK ({see here for details}[https://github.com/SciRuby/nmatrix/wiki/Installation])
33
- * a version of GCC or clang which supports C++0x or C++11
34
- * Ruby 1.9.3+
35
- * {packable}[http://github.com/marcandre/packable] 1.3.5 (used for I/O)
36
-
37
- If you want to obtain the latest (development) code, you should generally do:
38
-
39
- git clone https://github.com/SciRuby/nmatrix.git
40
- cd nmatrix/
41
- bundle install
42
- bundle exec rake compile
43
- bundle exec rake repackage
44
- gem install pkg/nmatrix-0.1.0.rc5.gem
45
-
46
- Detailed instructions are available for {Mac}[https://github.com/SciRuby/nmatrix/wiki/Installation#mac-os-x] and {Linux}[https://github.com/SciRuby/nmatrix/wiki/Installation#linux].
47
- We are currently working on Mavericks (Mac OS X) installation instructions, but in general, you'll need Homebrew and should
48
- probably use +brew install gcc48+ instead of using the install script.
49
-
50
- == Documentation
51
-
52
- If you have a suggestion or want to add documentation for any class or method in NMatrix, please open an issue or send a pull request with the changes.
53
-
54
- You can find the complete API documentation {on our website}[http://sciruby.com/nmatrix/docs/].
55
-
56
- == Examples
57
-
58
- Create a new NMatrix from a ruby Array:
59
-
60
- >> require 'nmatrix'
61
- >> NMatrix.new([2, 3], [0, 1, 2, 3, 4, 5], dtype: :int64)
62
- => [
63
- [0, 1, 2],
64
- [3, 4, 5]
65
- ]
66
-
67
- Create a new NMatrix using the +N+ shortcut:
68
-
69
- >> m = N[ [2, 3, 4], [7, 8, 9] ]
70
- => [
71
- [2, 3, 4],
72
- [7, 8, 9]
73
- ]
74
- >> m.inspect
75
- => #<NMatrix:0x007f8e121b6cf8shape:[2,3] dtype:int32 stype:dense>
76
-
77
- The above output requires that you have a pretty-print-enabled console such as Pry; otherwise, you'll
78
- see the output given by +inspect+.
79
-
80
- If you want to learn more about how to create a
81
- matrix, {read the guide in our wiki}[https://github.com/SciRuby/nmatrix/wiki/How-to-create-a-NMatrix].
82
-
83
- Again, you can find the complete API documentation {on our website}[http://sciruby.com/nmatrix/docs/].
84
-
85
- == Developers
86
-
87
- Read the instructions in +CONTRIBUTING.md+ if you want to help NMatrix.
88
-
89
- == Features
90
-
91
- The following features exist in the current version of NMatrix (0.1.0.rc1):
92
-
93
- * Matrix and vector storage containers: dense, yale, list (more to come)
94
- * Data types: byte (uint8), int8, int16, int32, int64, float32, float64, complex64, complex128, rational64, rational128,
95
- Ruby object
96
- * Interconversion between storage and data types
97
- * Element-wise and right-hand-scalar operations and comparisons for all matrix types
98
- * Matrix-matrix multiplication for dense (with and without ATLAS) and yale
99
- * Matrix-vector multiplication for dense (with and without ATLAS)
100
- * Lots of enumerators (each, each_with_indices, each_row, each_column, each_rank, map, etc.)
101
- * Matrix slicing by copy and reference (for dense, yale, and list)
102
- * Native reading and writing of dense and yale matrices
103
- * Optional compression for dense matrices with symmetry or triangularity: symmetric, skew, hermitian, upper, lower
104
- * Input/output:
105
- * Matlab .MAT v5 file input
106
- * MatrixMarket file input/output
107
- * Harwell-Boeing and Fortran file input
108
- * Point Cloud Library PCD file input
109
- * C and C++ API
110
- * BLAS internal implementations (no library) and ATLAS (with library) access:
111
- * Level 1: xROT, xROTG (BLAS dtypes only), xASUM, xNRM2, IxAMAX
112
- * Level 2: xGEMV
113
- * Level 3: xGEMM, xTRSM
114
- * LAPACK ATLAS access:
115
- * xGETRF, xGETRI, xGETRS, xGESV (Gaussian elimination)
116
- * xPOTRF, xPOTRI, xPOTRS, xPOSV (Cholesky factorization)
117
- * xLASWP, xSCAL, xLAUUM
118
- * LAPACK-less internal implementations (no LAPACK needed and working on non-BLAS dtypes):
119
- * xGETRF
120
- * xLASWP, xSCAL
121
- * xLAUUM (no LAPACK needed, but BLAS dtypes only)
122
- * LAPACK (non-ATLAS) access:
123
- * xGESVD, xGESDD (singular value decomposition)
124
- * xGEEV (eigenvalue decomposition of a asymmetric square matrices)
125
- * LU decomposition
126
- * Matrix inversions
127
- * Determinant calculation for BLAS dtypes
128
- * Traces
129
- * Ruby/GSL interoperability (requires {SciRuby's fork of rb-gsl}[http://github.com/SciRuby/rb-gsl])
130
- * slice assignments, e.g.,
131
- x[1..3,0..4] = some_other_matrix
132
-
133
- === Planned Features (Short-to-Medium Term)
134
-
135
- See the issues tracker for a list of planned features or to request new ones.
136
-
137
- == License
138
-
139
- Copyright (c) 2012--15, John Woods and the Ruby Science Foundation.
140
-
141
- All rights reserved.
142
-
143
- NMatrix, along with SciRuby, is licensed under the BSD 2-clause license. See
144
- {LICENSE.txt}[https://github.com/SciRuby/sciruby/wiki/License] for details.
145
-
146
- == Donations
147
-
148
- Support a SciRuby Fellow:
149
-
150
- {<img src=http://pledgie.com/campaigns/15783.png?skin_name=chrome>}[http://www.pledgie.com/campaigns/15783]
data/Rakefile DELETED
@@ -1,216 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'rubygems'
4
- require 'rubygems/package_task'
5
- require 'bundler'
6
-
7
- Bundler::GemHelper.install_tasks
8
-
9
- begin
10
- Bundler.setup(:default, :development)
11
- rescue Bundler::BundlerError => e
12
- $stderr.puts e.message
13
- $stderr.puts "Run `bundle install` to install missing gems"
14
- exit e.status_code
15
- end
16
-
17
- require 'rake'
18
- require "rake/extensiontask"
19
- Rake::ExtensionTask.new do |ext|
20
- ext.name = 'nmatrix'
21
- ext.ext_dir = 'ext/nmatrix'
22
- ext.lib_dir = 'lib/'
23
- ext.source_pattern = "**/*.{c,cpp, h}"
24
- end
25
-
26
- gemspec = eval(IO.read("nmatrix.gemspec"))
27
-
28
- Gem::PackageTask.new(gemspec).define
29
-
30
- require 'rspec/core/rake_task'
31
- require 'rspec/core'
32
- require 'rspec/core/rake_task'
33
- RSpec::Core::RakeTask.new(:spec) do |spec|
34
- spec.pattern = FileList['spec/**/*_spec.rb'].uniq
35
- end
36
-
37
-
38
- BASEDIR = Pathname( __FILE__ ).dirname.relative_path_from( Pathname.pwd )
39
- SPECDIR = BASEDIR + 'spec'
40
-
41
- VALGRIND_OPTIONS = [
42
- "--tool=memcheck",
43
- #"--leak-check=yes",
44
- "--num-callers=15",
45
- #"--error-limit=no",
46
- "--partial-loads-ok=yes",
47
- "--undef-value-errors=no" #,
48
- #"--dsymutil=yes"
49
- ]
50
-
51
- CALLGRIND_OPTIONS = [
52
- "--tool=callgrind",
53
- "--dump-instr=yes",
54
- "--simulate-cache=yes",
55
- "--collect-jumps=yes"
56
- ]
57
-
58
- VALGRIND_MEMORYFILL_OPTIONS = [
59
- "--freelist-vol=100000000",
60
- "--malloc-fill=6D",
61
- "--free-fill=66 ",
62
- ]
63
-
64
- GDB_OPTIONS = []
65
-
66
-
67
- task :console do |task|
68
- cmd = [ 'irb', "-r './lib/nmatrix.rb'" ]
69
- run *cmd
70
- end
71
-
72
- task :pry do |task|
73
- cmd = [ 'pry', "-r './lib/nmatrix.rb'" ]
74
- run *cmd
75
- end
76
-
77
- namespace :pry do
78
- task :valgrind => [ :compile ] do |task|
79
- cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
80
- cmd += ['ruby', '-Ilib:ext', "-r './lib/nmatrix.rb'", "-r 'pry'", "-e 'binding.pry'"]
81
- run *cmd
82
- end
83
- end
84
-
85
- namespace :console do
86
- CONSOLE_CMD = ['irb', "-r './lib/nmatrix.rb'"]
87
- desc "Run console under GDB."
88
- task :gdb => [ :compile ] do |task|
89
- cmd = [ 'gdb' ] + GDB_OPTIONS
90
- cmd += [ '--args' ]
91
- cmd += CONSOLE_CMD
92
- run( *cmd )
93
- end
94
-
95
- desc "Run console under Valgrind."
96
- task :valgrind => [ :compile ] do |task|
97
- cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
98
- cmd += CONSOLE_CMD
99
- run( *cmd )
100
- end
101
- end
102
-
103
- task :default => :spec
104
-
105
- def run *cmd
106
- sh(cmd.join(" "))
107
- end
108
-
109
- namespace :spec do
110
- # partial-loads-ok and undef-value-errors necessary to ignore
111
- # spurious (and eminently ignorable) warnings from the ruby
112
- # interpreter
113
-
114
- RSPEC_CMD = [ 'ruby', '-S', 'rspec', '-Ilib:ext', SPECDIR.to_s ]
115
-
116
- #desc "Run the spec for generator.rb"
117
- #task :generator do |task|
118
- # run 'rspec spec/generator_spec.rb'
119
- #end
120
-
121
- desc "Run specs under GDB."
122
- task :gdb => [ :compile ] do |task|
123
- cmd = [ 'gdb' ] + GDB_OPTIONS
124
- cmd += [ '--args' ]
125
- cmd += RSPEC_CMD
126
- run( *cmd )
127
- end
128
-
129
- desc "Run specs under cgdb."
130
- task :cgdb => [ :compile ] do |task|
131
- cmd = [ 'cgdb' ] + GDB_OPTIONS
132
- cmd += [ '--args' ]
133
- cmd += RSPEC_CMD
134
- run( *cmd )
135
- end
136
-
137
- desc "Run specs under Valgrind."
138
- task :valgrind => [ :compile ] do |task|
139
- cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
140
- cmd += RSPEC_CMD
141
- run( *cmd )
142
- end
143
-
144
- desc "Run specs under Callgrind."
145
- task :callgrind => [ :compile ] do |task|
146
- cmd = [ 'valgrind' ] + CALLGRIND_OPTIONS
147
- cmd += RSPEC_CMD
148
- run( *cmd )
149
- end
150
-
151
- end
152
-
153
-
154
- LEAKCHECK_CMD = [ 'ruby', '-Ilib:ext', "#{SPECDIR}/leakcheck.rb" ]
155
-
156
-
157
- desc "Run leakcheck script."
158
- task :leakcheck => [ :compile ] do |task|
159
- cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
160
- cmd += LEAKCHECK_CMD
161
- run( *cmd )
162
- end
163
-
164
- namespace :clean do
165
- task :so do |task|
166
- tmp_path = "tmp/#{RUBY_PLATFORM}/nmatrix/#{RUBY_VERSION}"
167
- chdir tmp_path do
168
- if RUBY_PLATFORM =~ /mswin/
169
- `nmake soclean`
170
- else
171
- mkcmd = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v >> /dev/null 2>&1") }
172
- `#{mkcmd} soclean`
173
- end
174
- end
175
- end
176
- end
177
-
178
-
179
- desc "Check the manifest for correctness"
180
- task :check_manifest do |task|
181
- manifest_files = File.read("Manifest.txt").split
182
-
183
- git_files = `git ls-files |grep -v 'spec/'`.split
184
- ignore_files = %w{.gitignore .rspec ext/nmatrix/binary_format.txt ext/nmatrix/ttable_helper.rb scripts/mac-brew-gcc.sh}
185
-
186
- possible_files = git_files - ignore_files
187
-
188
- missing_files = possible_files - manifest_files
189
- extra_files = manifest_files - possible_files
190
-
191
- unless missing_files.empty?
192
- STDERR.puts "The following files are in the git repo but not the Manifest:"
193
- missing_files.each { |f| STDERR.puts " -- #{f}"}
194
- end
195
-
196
- unless extra_files.empty?
197
- STDERR.puts "The following files are in the Manifest but may not be necessary:"
198
- extra_files.each { |f| STDERR.puts " -- #{f}"}
199
- end
200
-
201
- if extra_files.empty? && missing_files.empty?
202
- STDERR.puts "Manifest looks good!"
203
- end
204
-
205
- end
206
-
207
- require "rdoc/task"
208
- RDoc::Task.new do |rdoc|
209
- rdoc.main = "README.rdoc"
210
- rdoc.rdoc_files.include(%w{README.rdoc History.txt LICENSE.txt CONTRIBUTING.md lib ext})
211
- rdoc.options << "--exclude=ext/nmatrix/extconf.rb"
212
- rdoc.options << "--exclude=ext/nmatrix/ttable_helper.rb"
213
- rdoc.options << "--exclude=lib/nmatrix/rspec.rb"
214
- end
215
-
216
- # vim: syntax=ruby