nmatrix 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/.gitignore +3 -0
  2. data/CONTRIBUTING.md +66 -0
  3. data/Gemfile +1 -1
  4. data/History.txt +68 -10
  5. data/LICENSE.txt +2 -2
  6. data/Manifest.txt +2 -0
  7. data/README.rdoc +90 -69
  8. data/Rakefile +18 -9
  9. data/ext/nmatrix/data/complex.h +7 -7
  10. data/ext/nmatrix/data/data.cpp +2 -7
  11. data/ext/nmatrix/data/data.h +7 -4
  12. data/ext/nmatrix/data/rational.h +2 -2
  13. data/ext/nmatrix/data/ruby_object.h +3 -10
  14. data/ext/nmatrix/extconf.rb +79 -54
  15. data/ext/nmatrix/new_extconf.rb +11 -12
  16. data/ext/nmatrix/nmatrix.cpp +94 -125
  17. data/ext/nmatrix/nmatrix.h +38 -17
  18. data/ext/nmatrix/ruby_constants.cpp +2 -15
  19. data/ext/nmatrix/ruby_constants.h +2 -14
  20. data/ext/nmatrix/storage/common.cpp +2 -2
  21. data/ext/nmatrix/storage/common.h +2 -2
  22. data/ext/nmatrix/storage/dense.cpp +206 -31
  23. data/ext/nmatrix/storage/dense.h +5 -2
  24. data/ext/nmatrix/storage/list.cpp +52 -4
  25. data/ext/nmatrix/storage/list.h +3 -2
  26. data/ext/nmatrix/storage/storage.cpp +6 -6
  27. data/ext/nmatrix/storage/storage.h +2 -2
  28. data/ext/nmatrix/storage/yale.cpp +202 -49
  29. data/ext/nmatrix/storage/yale.h +5 -4
  30. data/ext/nmatrix/ttable_helper.rb +108 -108
  31. data/ext/nmatrix/types.h +2 -15
  32. data/ext/nmatrix/util/io.cpp +2 -2
  33. data/ext/nmatrix/util/io.h +2 -2
  34. data/ext/nmatrix/util/lapack.h +2 -2
  35. data/ext/nmatrix/util/math.cpp +14 -14
  36. data/ext/nmatrix/util/math.h +2 -2
  37. data/ext/nmatrix/util/sl_list.cpp +2 -2
  38. data/ext/nmatrix/util/sl_list.h +2 -2
  39. data/ext/nmatrix/util/util.h +2 -2
  40. data/lib/nmatrix.rb +13 -35
  41. data/lib/nmatrix/blas.rb +182 -56
  42. data/lib/nmatrix/io/market.rb +38 -14
  43. data/lib/nmatrix/io/mat5_reader.rb +393 -278
  44. data/lib/nmatrix/io/mat_reader.rb +121 -107
  45. data/lib/nmatrix/lapack.rb +59 -14
  46. data/lib/nmatrix/monkeys.rb +32 -30
  47. data/lib/nmatrix/nmatrix.rb +204 -100
  48. data/lib/nmatrix/nvector.rb +166 -57
  49. data/lib/nmatrix/shortcuts.rb +364 -231
  50. data/lib/nmatrix/version.rb +8 -4
  51. data/nmatrix.gemspec +5 -3
  52. data/scripts/mac-brew-gcc.sh +1 -1
  53. data/spec/blas_spec.rb +80 -2
  54. data/spec/math_spec.rb +78 -32
  55. data/spec/nmatrix_list_spec.rb +55 -55
  56. data/spec/nmatrix_spec.rb +60 -117
  57. data/spec/nmatrix_yale_resize_test_associations.yaml +2802 -0
  58. data/spec/nmatrix_yale_spec.rb +214 -198
  59. data/spec/nvector_spec.rb +58 -2
  60. data/spec/shortcuts_spec.rb +156 -32
  61. data/spec/slice_spec.rb +229 -178
  62. data/spec/spec_helper.rb +2 -2
  63. metadata +71 -21
data/.gitignore CHANGED
@@ -15,6 +15,9 @@ tmp/
15
15
  test.c
16
16
  spec/*.mtx
17
17
  *.so
18
+ *.bundle
19
+ *.bundle.dSYM
20
+ *.log
18
21
  /tags
19
22
  *.gem
20
23
 
@@ -0,0 +1,66 @@
1
+ NMatrix is part of SciRuby, a collaborative effort to bring scientific computation to Ruby. If you want to help, please do so!
2
+
3
+ This guide covers ways in which you can contribute to the development of SciRuby and, more specifically, NMatrix.
4
+
5
+ ## How to help
6
+
7
+ There are various ways to help NMatrix: bug reports, coding and documentation. All of them are important.
8
+
9
+ First, you can help implement new features or bug fixes. To do that, visit our [roadmap](https://github.com/SciRuby/nmatrix/wiki/Roadmap) or our [issue tracker][2]. If you find something that you can tackle, post it in the issue or on our [mailing list][1].
10
+
11
+ You need to send tests together with your code. No exceptions. You can ask what's our opinion, but we won't accept patches without a good spec coverage.
12
+
13
+ We use RSpec for testing. If you aren't familiar with it, there's a good [guide to better specs with RSpec](http://betterspecs.org/) that shows a bit of the syntax and how to use it properly. However, the best resource is probably the specs that already exist - so just read them.
14
+
15
+ And don't forget to write documentation. It's necessary to allow others to know what's available in the library. There's a section on it later in this guide. Ah, we use RDoc.
16
+
17
+ We only accept bug reports and pull requests in GitHub. You'll need to create a new (free) account if you don't have one already. To learn how to create a pull request, please see the [this guide on collaborating](https://help.github.com/categories/63/articles).
18
+
19
+ If you have a question about how to use NMatrix or SciRuby in general or a feature/change in mind, please ask the [sciruby-dev mailing list][1].
20
+
21
+ Thanks!
22
+
23
+ ## Coding
24
+
25
+ To start helping with the code, you need to have all the dependencies in place:
26
+
27
+ - ATLAS and LAPACK
28
+ - GCC 4.3+
29
+ - git
30
+ - Ruby 1.9+
31
+ - `bundler` gem
32
+
33
+ Now, you need to clone the git repository:
34
+
35
+ git clone git://github.com/SciRuby/nmatrix.git
36
+ cd nmatrix
37
+ bundle install
38
+ rake compile
39
+ rake spec
40
+
41
+ This will install all dependencies, compile the extension and run the specs.
42
+
43
+ As of now (12/31/2012), there should be 25 specs failing, in elementwise\_spec, lapack\_spec and math\_spec. If you see more than 25 or from different specs, please report on the [mailing list][1] or on the [issue tracker][2].
44
+
45
+ If everything's fine until now, you can create a new branch to work on your feature:
46
+
47
+ git branch new-feature
48
+ git checkout new-feature
49
+
50
+ Before commiting any code, please read our
51
+ [Contributor Agreement](http://github.com/SciRuby/sciruby/wiki/Contributor-Agreement).
52
+
53
+ ## Documentation
54
+
55
+ There are two ways in which NMatrix is being documented: guides and comments, which are converted with RDoc into the documentation seen in [sciruby.com](http://sciruby.com).
56
+
57
+ If you want to write a guide on how to use NMatrix to solve some problem or simply showing how to use one of its features, write it as a wiki page and send an e-mail on the [mailing list][1]. We're working to improve this process.
58
+
59
+ If you aren't familiar with RDoc syntax, [this is the official documentation](http://docs.seattlerb.org/rdoc/RDoc/Markup.html).
60
+
61
+ ## Conclusion
62
+
63
+ This guide was heavily based on the [Contributing to Ruby on Rails guide](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html).
64
+
65
+ [1]: https://groups.google.com/forum/?fromgroups#!forum/sciruby-dev
66
+ [2]: https://github.com/sciruby/nmatrix/issues?sort=created&state=open
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # Gemfile
2
- source "http://rubygems.org"
2
+ source 'http://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'packable', ">= 1.3.5" # for Matlab IO
@@ -10,19 +10,23 @@
10
10
 
11
11
  * Second alpha release
12
12
 
13
- * Rewrote NMatrix in C++0x and C++11 using templates, namespaces; removed Ruby generators and CAST parser
13
+ * Rewrote NMatrix in C++0x and C++11 using templates, namespaces;
14
+ removed Ruby generators and CAST parser
14
15
 
15
16
  * Added preliminary C API
16
17
 
17
- * Slicing and referencing support for dense and list matrices (by @flipback)
18
+ * Slicing and referencing support for dense and list matrices (by
19
+ @flipback)
18
20
 
19
21
  * BLAS level-3 xTRSM algorithm added for rationals and BLAS types
20
22
 
21
- * LAPACK support added, including partially working xGETRF subroutine
23
+ * LAPACK support added, including partially working xGETRF
24
+ subroutine
22
25
 
23
26
  * Element-wise comparisons now return byte-matrices
24
27
 
25
- * Element-wise operations on list matrices may alter the default value of the return matrix
28
+ * Element-wise operations on list matrices may alter the default
29
+ value of the return matrix
26
30
 
27
31
  * Element-wise division behaves like Ruby division
28
32
 
@@ -30,7 +34,8 @@
30
34
 
31
35
  * clang support
32
36
 
33
- * `==` operator now used for matrix equality, `=~` and `!~` for element-wise comparisons
37
+ * `==` operator now used for matrix equality, `=~` and `!~` for
38
+ element-wise comparisons
34
39
 
35
40
  * Dense `each` returns an Enumerator when called without a block
36
41
 
@@ -48,20 +53,73 @@
48
53
 
49
54
  * Shortcuts for matrix creation (by @agarie)
50
55
 
51
- * Access to most ATLAS-implemented LAPACK functions for those with ATLAS' CLAPACK interface: xGETRF, xGETRI, xGETRS, xGESV, xPOTRF, xPOTRI, xPOTRS, xPOSV, xLASWP, xSCAL, xLAUUM
56
+ * Access to most ATLAS-implemented LAPACK functions for those
57
+ with ATLAS' CLAPACK interface: xGETRF, xGETRI, xGETRS, xGESV,
58
+ xPOTRF, xPOTRI, xPOTRS, xPOSV, xLASWP, xSCAL, xLAUUM
52
59
 
53
- * Access to additional ATLAS-implemented BLAS functions: xTRMM, xSYRK, xHERK, xROT, xROTG
60
+ * Access to additional ATLAS-implemented BLAS functions: xTRMM,
61
+ xSYRK, xHERK, xROT, xROTG
54
62
 
55
- * Non-ATLAS versions of CLAPACK functions: xLASWP, xSCAL, xLAUUM, xROT
63
+ * Non-ATLAS versions of CLAPACK functions: xLASWP, xSCAL, xLAUUM,
64
+ xROT
56
65
 
57
66
  * Matrix inversion (LU and Cholesky; requires CLAPACK)
58
67
 
59
68
  * LU factoring with and without CLAPACK
60
69
 
61
- * Native matrix I/O for dense (supporting upper, lower, hermitian, skew, symmetric, and general) and yale (general only); excludes Ruby objects currently
70
+ * Native matrix I/O for dense (supporting upper, lower, hermitian,
71
+ skew, symmetric, and general) and yale (general only); excludes
72
+ Ruby objects currently
62
73
 
63
74
  * 2 bug fixes:
64
75
 
65
76
  * Yale-to-list casting
66
77
 
67
- * Now requires packable-1.3.5 or higher, fixing a problem with MATLAB .mat v5 file I/O (specific to doubles)
78
+ * Now requires packable-1.3.5 or higher, fixing a problem with MATLAB
79
+ .mat v5 file I/O (specific to doubles)
80
+
81
+ === 0.0.4 / 2013-??-??
82
+
83
+ * 3 major enhancements
84
+
85
+ * Added a more user-friendly interface for cblas_rot in the form of
86
+ NMatrix::BLAS::rot
87
+
88
+ * Added to_hash for Yale matrices
89
+
90
+ * Improved source code documentation (by @agarie)
91
+
92
+ * 4 minor enhancements
93
+
94
+ * Spec clean-up (by @masaomi)
95
+
96
+ * Made it possible to request a different itype internally for Yale
97
+ matrices
98
+
99
+ * Improved space usage of Yale slice-by-copying, which was requesting
100
+ more space than needed
101
+
102
+ * Improved compile-time Mac OS X and Ubuntu library searching
103
+
104
+ * 8 bug fixes:
105
+
106
+ * NMatrix::BLAS::gemv segfaults
107
+
108
+ * Fixed Yale matrix slice-by-copy write error where default itypes
109
+ (which are based on shape) differ, and a separate problem where
110
+ incorrect IJA and A entries were written.
111
+
112
+ * NVector-scalar operations and NVector-NVector element-wise options
113
+ now return an NVector instead of an NMatrix
114
+
115
+ * Addressed problems with segmentation faults during iteration (by
116
+ @cjfuller)
117
+
118
+ * Addressed Ubuntu/Debian installation problems (incompatibility with
119
+ apt-supplied atlas)
120
+
121
+ * Fixed transpose behavior following slice-by-reference (by @cjfuller)
122
+
123
+ * Fixed gem install command in Rakefile (by @jpmckinney)
124
+
125
+ * Fixed Spanish language compile issue (by @imcsk8 and @agarie)
@@ -7,9 +7,9 @@ You *must* read the Contributor Agreement before contributing code to the SciRub
7
7
 
8
8
  * http://github.com/sciruby/sciruby/wiki/Contributor-Agreement
9
9
 
10
- --
10
+ -----
11
11
 
12
- Copyright (c) 2010 - 2011, Ruby Science Foundation
12
+ Copyright (c) 2010 - 2013, Ruby Science Foundation
13
13
  All rights reserved.
14
14
 
15
15
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -2,9 +2,11 @@ History.txt
2
2
  Manifest.txt
3
3
  README.rdoc
4
4
  LICENSE.txt
5
+ CONTRIBUTING.md
5
6
  Rakefile
6
7
  Gemfile
7
8
  Guardfile
9
+ nmatrix.gemspec
8
10
  spec/io_spec.rb
9
11
  spec/math_spec.rb
10
12
  spec/nmatrix_spec.rb
@@ -1,33 +1,93 @@
1
1
  = NMatrix
2
2
 
3
- http://sciruby.com
3
+ Fast Numerical Linear Algebra Library for Ruby
4
4
 
5
- * {Project homepage: sciruby.com}[http://sciruby.com]
6
- * {SciRuby on Google+}[https://plus.google.com/109304769076178160953/posts]
5
+ * {sciruby.com}[http://sciruby.com]
6
+ * {Google+}[https://plus.google.com/109304769076178160953/posts]
7
7
  * {Installation guide}[http://sciruby.com/docs#installation]
8
8
 
9
9
  == Description
10
10
 
11
- NMatrix is an experimental linear algebra library for Ruby, written mostly in C and C++. It can be used with or without
12
- SciRuby, but is part of the SciRuby project.
11
+ NMatrix is a fast numerical linear algebra library for Ruby, with dense and sparse matrices, written mostly in C and
12
+ C++. It is part of the SciRuby project.
13
13
 
14
- NMatrix was inspired by and based heavily upon {NArray}[http://narray.rubyforge.org], by Masahiro Tanaka.
14
+ NMatrix was inspired by {NArray}[http://narray.rubyforge.org], by Masahiro Tanaka.
15
15
 
16
- {<img src=https://www.pledgie.com/campaigns/15783.png?skin_name=chrome>}[http://www.pledgie.com/campaigns/15783]
16
+ == Installation
17
17
 
18
- === WARNING:
18
+ To install the latest stable version:
19
19
 
20
- Please be aware that SciRuby and NMatrix are *ALPHA* status. If you're thinking of using SciRuby/NMatrix to write
21
- mission-critical code, such as for driving a car or flying a space shuttle, you may wish to choose other software (for
22
- now).
20
+ gem install nmatrix
23
21
 
24
- You should also be aware that NMatrix and NArray are incompatible with one another; you should not try to require both
25
- at the same time. Unfortunately, that causes problems with Ruby/GSL, which currently depends upon NArray. As such, we
26
- are working on a {patch for Ruby/GSL}[https://github.com/SciRuby/rb-gsl].
22
+ However, you will need to install {ATLAS}[http://math-atlas.sourceforge.net/] with CBLAS (C interface
23
+ to {BLAS}[http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms]) first. Those directions can be
24
+ found {here}[https://github.com/SciRuby/nmatrix/wiki/Installation]. The requirements for NMatrix are:
25
+
26
+ * ATLAS
27
+ * LAPACK, probably
28
+ * a version of GCC or clang which supports C++0x or C++11
29
+ * Ruby 1.9+
30
+ * {packable}[http://github.com/marcandre/packable] 1.3.5 (used for I/O)
31
+
32
+ If you want to obtain the latest (development)code, you should do:
33
+
34
+ git clone https://github.com/SciRuby/nmatrix.git
35
+ cd nmatrix/
36
+ rake compile
37
+ rake repackage
38
+ gem install pkg/nmatrix-0.0.5.gem
39
+
40
+ If you get errors about clapack.h or cblas.h, determine where your ATLAS headers are using:
41
+
42
+ locate clapack.h
43
+
44
+ If you're a Mac user, we recommend you search for cblas.h instead.
45
+
46
+ Then, tell your system:
47
+
48
+ export C_INCLUDE_PATH=/usr/local/atlas/include
49
+ export CPLUS_INCLUDE_PATH=/usr/local/atlas/include
50
+
51
+ Finally, try compiling again.
52
+
53
+ == Documentation
54
+
55
+ Carlos Agarie (@agarie) is currently working to improve the documentation. The best way to get help is by
56
+ posting {issues}[https://github.com/SciRuby/nmatrix/issues] or sending e-mails to
57
+ our {mailing list}[https://groups.google.com/forum/?fromgroups#!forum/sciruby-dev]. You may also email @agarie, or look
58
+ for `agarie` on #sciruby at chat.freenode.net if you want to ask questions or offer suggestions.
59
+
60
+ You can find the complete API documentation {on our website}[http://sciruby.com/nmatrix/docs/].
61
+
62
+ == EXAMPLES
63
+
64
+ Create a new NMatrix from a ruby array:
65
+
66
+ >> NMatrix.new([2, 3], [0, 1, 2, 3, 4, 5], :int64).pp
67
+ [0, 1, 2]
68
+ [3, 4, 5]
69
+ => nil
70
+
71
+ Create a new NMatrix using the +N+ shortcut:
72
+
73
+ >> m = N[ [2, 3, 4], [7, 8, 9] ]
74
+ => #<NMatrix:0x007f8e121b6cf8shape:[2,3] dtype:int32 stype:dense>
75
+ >> m.pp
76
+ [2, 3, 4]
77
+ [7, 8, 9]
78
+
79
+ If you want to learn more about how to create a
80
+ matrix, {read the guide in our wiki}[https://github.com/SciRuby/nmatrix/wiki/How-to-create-a-NMatrix].
81
+
82
+ Again, you can find the complete API documentation {on our website}[http://sciruby.com/nmatrix/docs/].
83
+
84
+ == Developers
85
+
86
+ Read the instructions in +CONTRIBUTING.md+ if you want to help NMatrix.
27
87
 
28
88
  == Features
29
89
 
30
- The following features exist in the current version of NMatrix (0.0.2):
90
+ The following features exist in the current version of NMatrix (0.0.4):
31
91
 
32
92
  * Matrix storage containers: dense, yale, list (more to come)
33
93
  * Data types: uint8, int8, int16, int32, int64, float32, float64, complex64, complex128, rational64, rational128
@@ -56,12 +116,13 @@ The following features exist in the current version of NMatrix (0.0.2):
56
116
  * LU decomposition
57
117
  * Matrix inversions (requires LAPACK; BLAS dtypes only)
58
118
  * Determinant calculation for BLAS dtypes
119
+ * Ruby/GSL interoperability (requires [SciRuby's fork of rb-gsl](http://github.com/SciRuby/rb-gsl))
59
120
 
60
121
  === Planned Features (Short-to-Medium Term)
61
122
 
62
123
  These are features planned for NMatrix 0.1.0, our first beta.
63
124
 
64
- * calculation of determinant (LAPACK-free), trace, and eigenvalues (characteristic polynomial) (0.1.0)
125
+ * calculation of determinant (LAPACK-free), trace, and eigenvalues (characteristic polynomial)
65
126
  * exponentials and square roots
66
127
  * matrix inversions (LAPACK-free)
67
128
  * matrix decomposition/factorization
@@ -73,70 +134,30 @@ These are features planned for NMatrix 0.1.0, our first beta.
73
134
  * operation scheduling
74
135
  * parallelization of some types of operations
75
136
  * optimization of non-BLAS data types on BLAS-like operations (e.g., matrix multiplication for rational numbers)
76
- * Ruby/GSL interoperability
77
-
78
- == SYNOPSIS:
79
137
 
80
- For full instructions, please see sciruby.com/nmatrix. Generally, you should be able to do
81
-
82
- gem install nmatrix
138
+ === Warning
83
139
 
84
- However, you will need to install ATLAS with CBLAS first. Those directions can be found at our website.
140
+ Please be aware that SciRuby and NMatrix are *alpha* status. If you're thinking of using SciRuby/NMatrix to write
141
+ mission-critical code, such as for driving a car or flying a space shuttle, you may wish to choose other software for
142
+ now.
85
143
 
86
- You can typically get the developer's build using the following sequence of commands:
87
-
88
- git clone https://github.com/SciRuby/nmatrix.git
89
- cd nmatrix/
90
- rake compile
91
- rake repackage
92
- gem install pkg/nmatrix-0.0.4.gem
93
-
94
- If you get errors about clapack.h or cblas.h, figure out where your ATLAS headers are using:
95
-
96
- locate clapack.h # If you're a Mac user, we recommend you search for cblas.h instead.
97
-
98
- Then, tell your system:
99
-
100
- export C_INCLUDE_PATH=/usr/local/atlas/include
101
- export CPLUS_INCLUDE_PATH=/usr/local/atlas/include
102
-
103
- Finally, try compiling again.
104
-
105
- == REQUIREMENTS:
106
-
107
- * ATLAS
108
- * LAPACK, probably
109
- * GCC 4.3
110
- * Ruby 1.9
111
- * {packable}[http://github.com/marcandre/packable] 1.3.5 (used for I/O)
112
-
113
- == INSTALLATION:
114
-
115
- See Synopsis (above) for now. Gem coming later.
116
-
117
- More detailed installation instructions are available at {here}[http://sciruby.com/docs#installation]
118
-
119
- == DEVELOPERS:
120
-
121
- Code in the master branch of SciRuby/nmatrix on github should compile and link, but is not necessarily stable. You might
122
- also check out the dev branch if master hasn't been updated in some time.
123
-
124
- git clone https://github.com/mohawkjohn/nmatrix.git
125
-
126
- Before commiting any code, you *MUST* read our
127
- {Contributor Agreement}[http://github.com/SciRuby/sciruby/wiki/Contributor-Agreement].
144
+ You should also be aware that NMatrix and NArray are incompatible with one another; you should not try to require both
145
+ at the same time. Unfortunately, that causes problems with Ruby/GSL, which currently depends upon NArray. As such, we
146
+ are working on a {patch for Ruby/GSL}[https://github.com/SciRuby/rb-gsl]. You can find the most recent version in
147
+ {the work branch of Masaomi's fork}[https://github.com/masaomi/rb-gsl/tree/work] (not currently compiling as of this
148
+ writing).
128
149
 
129
- == LICENSE:
150
+ == License
130
151
 
131
- Copyright (c) 2012--13, The Ruby Science Foundation.
152
+ Copyright (c) 2010--13, The Ruby Science Foundation.
132
153
 
133
154
  All rights reserved.
134
155
 
135
156
  NMatrix, along with SciRuby, is licensed under the BSD 2-clause license. See
136
157
  {LICENSE.txt}[https://github.com/SciRuby/sciruby/wiki/License] for details.
137
158
 
138
- == DONATIONS:
159
+ == Donations
139
160
 
140
161
  Support a SciRuby Fellow:
141
162
 
142
- {<img src=https://www.pledgie.com/campaigns/15783.png?skin_name=chrome>}[http://www.pledgie.com/campaigns/15783]
163
+ {<img src=http://pledgie.com/campaigns/15783.png?skin_name=chrome>}[http://www.pledgie.com/campaigns/15783]
data/Rakefile CHANGED
@@ -26,7 +26,7 @@ Rake::GemPackageTask.new(gemspec).define
26
26
 
27
27
  desc "install the gem locally"
28
28
  task :install => [:package] do
29
- sh %{gem install pkg/nmatrix-#{NMatrix::VERSION}}
29
+ sh %{gem install pkg/nmatrix-#{NMatrix::VERSION}.gem}
30
30
  end
31
31
 
32
32
  require 'rspec/core/rake_task'
@@ -43,7 +43,8 @@ VALGRIND_OPTIONS = [
43
43
  "--num-callers=50",
44
44
  "--error-limit=no",
45
45
  "--partial-loads-ok=yes",
46
- "--undef-value-errors=no",
46
+ "--undef-value-errors=no" #,
47
+ #"--dsymutil=yes"
47
48
  ]
48
49
  VALGRIND_MEMORYFILL_OPTIONS = [
49
50
  "--freelist-vol=100000000",
@@ -104,17 +105,25 @@ namespace :spec do
104
105
 
105
106
  desc "Run specs under GDB."
106
107
  task :gdb => [ :compile ] do |task|
107
- cmd = [ 'gdb' ] + GDB_OPTIONS
108
- cmd += [ '--args' ]
109
- cmd += RSPEC_CMD
110
- run( *cmd )
108
+ cmd = [ 'gdb' ] + GDB_OPTIONS
109
+ cmd += [ '--args' ]
110
+ cmd += RSPEC_CMD
111
+ run( *cmd )
112
+ end
113
+
114
+ desc "Run specs under cgdb."
115
+ task :cgdb => [ :compile ] do |task|
116
+ cmd = [ 'cgdb' ] + GDB_OPTIONS
117
+ cmd += [ '--args' ]
118
+ cmd += RSPEC_CMD
119
+ run( *cmd )
111
120
  end
112
121
 
113
122
  desc "Run specs under Valgrind."
114
123
  task :valgrind => [ :compile ] do |task|
115
- cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
116
- cmd += RSPEC_CMD
117
- run( *cmd )
124
+ cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
125
+ cmd += RSPEC_CMD
126
+ run( *cmd )
118
127
  end
119
128
  end
120
129