You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
or our [issue tracker][2]. If you find something that you want to work
15
+
on, post it in the issue or on our [mailing list][1].
13
16
14
-
You need to send tests together with your code. No exceptions. You can ask for our opinion, but we won't accept patches
15
-
without good spec coverage.
17
+
You need to send tests together with your code. No exceptions. You can
18
+
ask for our opinion, but we won't accept patches without good spec
19
+
coverage.
16
20
17
-
We use RSpec for testing. If you aren't familiar with it, there's a good
18
-
[guide to better specs with RSpec](http://betterspecs.org/) that shows a bit of the syntax and how to use it properly.
19
-
However, the best resource is probably the specs that already exist -- so just read them.
21
+
We use RSpec for testing. If you aren't familiar with it, there's a
22
+
good [guide to better specs with RSpec](http://betterspecs.org/) that
23
+
shows a bit of the syntax and how to use it properly. However, the
24
+
best resource is probably the specs that already exist -- so just read
25
+
them.
20
26
21
-
And don't forget to write documentation (we use RDoc). It's necessary to allow others to know what's available in the
22
-
library. There's a section on it later in this guide.
27
+
And don't forget to write documentation (we use rdoc). It's necessary
28
+
to allow others to know what's available in the library. There's a
29
+
section on it later in this guide.
23
30
24
-
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
25
-
already. To learn how to create a pull request, please see
31
+
We only accept bug reports and pull requests in GitHub. You'll need to
32
+
create a new (free) account if you don't have one already. To learn
33
+
how to create a pull request, please see
26
34
[this guide on collaborating](https://help.github.com/categories/63/articles).
27
35
28
-
If you have a question about how to use NMatrix or SciRuby in general or a feature/change in mind, please ask the
36
+
If you have a question about how to use NMatrix or SciRuby in general
37
+
or a feature/change in mind, please ask the
29
38
[sciruby-dev mailing list][1].
30
39
31
40
Thanks!
@@ -34,11 +43,11 @@ Thanks!
34
43
35
44
To start helping with the code, you need to have all the dependencies in place:
36
45
37
-
- ATLAS and LAPACK
38
46
- GCC 4.3+
39
47
- git
40
48
- Ruby 1.9+
41
49
-`bundler` gem
50
+
- ATLAS/LAPACKE/FFTW dependending on the plugin you want to change.
42
51
43
52
Now, you need to clone the git repository:
44
53
@@ -50,9 +59,11 @@ $ rake compile
50
59
$ rake spec
51
60
```
52
61
53
-
This will install all dependencies, compile the extension and run the specs.
62
+
This will install all dependencies, compile the extension and run the
63
+
specs.
54
64
55
-
If everything's fine until now, you can create a new branch to work on your feature:
65
+
If everything's fine until now, you can create a new branch to work on
66
+
your feature:
56
67
57
68
```bash
58
69
$ git branch new-feature
@@ -64,46 +75,62 @@ Before commiting any code, please read our
64
75
65
76
### Guidelines for interfacing with C/C++
66
77
67
-
NMatrix uses a lot of C/C++ to speed up execution of processes and give more control over data types, storage types, etc. Since we are interfacing between two very different languages, things can get out of hand pretty fast.
78
+
NMatrix uses a lot of C/C++ to speed up execution of processes and
79
+
give more control over data types, storage types, etc. Since we are
80
+
interfacing between two very different languages, things can get out
81
+
of hand pretty fast.
68
82
69
83
Please go thorough this before you create any C accessors:
70
84
71
-
* Perform all pre-computation error checking in Ruby.
72
-
- Since this is (mostly) a trivial computation, doing this in Ruby before calling the actual C code will save immensely on time needed to read and write code. Plus, one won't need to write obscure code for accessing NMatrix attributes in C code (`NM_SHAPE0(obj)` for example), saving both the readers' and writers' time.
85
+
* Perform all pre-computation error checking in Ruby.
73
86
* Curate any extra data (cloned objects, trivial computations, etc.) in Ruby.
74
-
* The corresponding extern "C" exposed function should have a name format `nm_#{function_name}`, this function should call a C++ function which should follow a convention `nm_#{sub_namespace}_#{function_name}` and the C++ templated function that is called by this function should be inside a namespace `nm::#{sub_namespace}`.
75
-
* Do _NOT_ resolve VALUE into constituent elements unless they reach the function where the elements are needed or it is absolutely necessary. Passing around a VALUE in the C/C++ core is much more convienient than passing around `void*` pointers which point to an array of matrix elements.
76
-
- If you'll look at [this line](https://github.com/v0dro/nmatrix/commit/b957c5fdbcef0bf1ebe78922f84f9ea37938b247#diff-55f2ba27400bce950282e78db97bfbcfR1791), you'll notice that matrix elements aren't resolved until the final step i.e. passing the elements into the `nm::math::solve` function for the actual computation.
87
+
* Do _NOT_ resolve VALUE into constituent elements unless they reach
88
+
the function where the elements are needed or it is absolutely
89
+
necessary. Passing around a VALUE in the C/C++ core is much more
90
+
convienient than passing around `void*` pointers which point to an
91
+
array of matrix elements.
77
92
78
93
Basically, follow a practice of 'once you enter C, never look back!'.
79
94
80
-
If you have something more in mind, discuss it in the issue tracker or on [this](https://groups.google.com/forum/#!topic/sciruby-dev/OJxhrGG309o) thread.
95
+
If you have something more in mind, discuss it in the issue tracker or
* Single statements following a `if`/`while`/`for` etc. should be preferably on the same line and _enclosed within braces_.
87
104
* Use camel_case notation for arguments. No upper case.
88
-
* Write a brief description of the arguments that your function receives in the comments directly above the function.
89
-
* Explicitly state in the comments any anomalies that your function might have. For example, that it does not work with a certain storage or data type.
105
+
* Write a brief description of the arguments that your function
106
+
receives in the comments directly above the function.
107
+
* Explicitly state in the comments any anomalies that your function
108
+
might have. For example, that it does not work with a certain
109
+
storage or data type.
90
110
91
111
## Documentation
92
112
93
-
There are two ways in which NMatrix is being documented: guides and comments, which are converted with RDoc into the
94
-
documentation seen in [sciruby.com](http://sciruby.com).
113
+
There are two ways in which NMatrix is being documented: guides and
114
+
comments, which are converted with RDoc into the documentation seen in
115
+
[sciruby.com](http://sciruby.com).
95
116
96
-
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
97
-
features, write it as a wiki page and send an e-mail on the [mailing list][1]. We're working to improve this process.
117
+
If you want to write a guide on how to use NMatrix to solve some
118
+
problem or simply showing how to use one of its features, write it as
119
+
a wiki page and send an e-mail on the [mailing list][1]. We're working
120
+
to improve this process.
98
121
99
122
If you aren't familiar with RDoc syntax,
100
123
[this is the official documentation](http://docs.seattlerb.org/rdoc/RDoc/Markup.html).
101
124
102
125
## Making new nmatrix extensions
103
126
104
-
From version 0.2, nmatrix supports extensions, all of which can be hosted from the main nmatrix repo.
127
+
From version 0.2, NMatrix supports extensions, all of which can be
128
+
hosted from the main nmatrix repo.
105
129
106
-
Refer to [this blog post ](http://wlevine.github.io/2015/06/15/releasing-multiple-gems-with-c-extensions-from-the-same-repository.html) to see how to do that in case you want to write your own extension for nmatrix.
130
+
Refer to
131
+
[this blog post ](http://wlevine.github.io/2015/06/15/releasing-multiple-gems-with-c-extensions-from-the-same-repository.html)
132
+
to see how to do that in case you want to write your own extension for
0 commit comments