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
Copy file name to clipboardExpand all lines: README.md
+15-18Lines changed: 15 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@
7
7
8
8
**ra-ra** implements [expression templates](https://en.wikipedia.org/wiki/Expression_templates). This is a C++ technique (pioneered by [Blitz++](http://blitz.sourceforge.net)) to delay the execution of expressions involving array operands, and in this way avoid the unnecessary creation of large temporary array objects.
9
9
10
-
**ra-ra** is compact (≈4k loc), easy to extend, and generic. There are no arbitrary type restrictions or limits on rank or argument count.
10
+
**ra-ra** is compact, generic, and easy to extend.
11
11
12
-
In this example ([examples/read-me.cc](examples/read-me.cc)), we create some arrays, do operations on them, and print the result.
12
+
In this example ([examples/read-me.cc](examples/read-me.cc)), we create some arrays, operate on them, and print the result.
13
13
14
14
```c++
15
15
#include"ra/ra.hh"
@@ -38,7 +38,7 @@ B:
38
38
{215.00, 218.00, -221.00, -224.00}}
39
39
```
40
40
41
-
Please check the manual online at [lloda.github.io/ra-ra](https://lloda.github.io/ra-ra), or have a look at the [examples/](examples/) folder.
41
+
Check the manual at [lloda.github.io/ra-ra](https://lloda.github.io/ra-ra), or have a look at the [examples/](examples/).
42
42
43
43
**ra-ra** offers:
44
44
@@ -50,48 +50,45 @@ Please check the manual online at [lloda.github.io/ra-ra](https://lloda.github.i
50
50
* iterators over subarrays (cells) of any rank
51
51
* rank conjunction as in J (compile time rank only), outer product operation
52
52
* short-circuiting logical operators
53
-
* operators to select from argument list using either bool or integer (`where`, `pick`)
53
+
* operators to select from argument list (`where`, `pick`)
* arbitrary types as array elements, or as scalar operands
56
-
* many predefined array operations, adding yours is trivial
56
+
* many predefined array operations; adding yours is trivial
57
57
* configurable error handling
58
58
* as much `constexpr` as possible.
59
59
60
-
Performance is competitive with hand written scalar (element by element) loops, but probably not with cache-tuned code such as your platform BLAS, or with code using SIMD. Please have a look at the benchmarks in [bench/](bench/).
60
+
Performance is competitive with hand written scalar (element by element) loops, but probably not with cache-tuned code such as your platform BLAS, or with code using SIMD. Have a look at the benchmarks in [bench/](bench/).
61
61
62
62
#### Building the tests and the benchmarks
63
63
64
-
**ra-ra** is header-only and has no dependencies other than a C++23 compiler and the standard library. At the moment I test with gcc 14.2. If you can test with Clang, please let me know.
64
+
**ra-ra** is header-only and only depends on the standard library. A C++23 compiler is required. At the moment I test with gcc 14. If you can test with Clang, please let me know.
65
65
66
-
The test suite in [test/](test/) runs under either SCons (`CXXFLAGS=-O3 scons`) or CMake (`CXXFLAGS=-O3 cmake . && make && make test`). Running the test suite will also build and run the [examples](examples/) and the [benchmarks](bench/). Please check the manual for options.
66
+
The test suite in [test/](test/) runs under either SCons (`CXXFLAGS=-O3 scons`) or CMake (`CXXFLAGS=-O3 cmake . && make && make test`). Running the test suite will also build and run the [examples](examples/) and the [benchmarks](bench/). Check the manual for options.
67
67
68
68
#### Notes
69
69
70
70
* Both index and size types are signed. Index base is 0.
71
-
* The default array order is C or row-major (last dimension changes fastest). You can make array views with other orders, but newly created arrays use C order.
71
+
* The default array order is C or row-major (last dimension changes fastest). You can make array views with other orders.
72
72
* The subscripting operator is `()` or `[]`, indistinctly.
73
-
* Indices are checked by default. This can be disabled with a compilation flag.
73
+
* Indices are checked by default. Checks can be disabled with a compilation flag.
74
74
75
75
#### Bugs & defects
76
76
77
77
* Operations that require allocation, such as concatenation or search, are mostly absent.
78
78
* No good abstraction for reductions. You can write reductions abusing rank extension, but it's awkward.
79
-
* Traversal of arrays is basic, just unrolling of inner dimensions.
79
+
* Basic array traversal, just unrolling of inner dimensions.
80
80
* Handling of nested / ragged arrays is inconsistent.
81
-
* No support for parallel operations or GPU.
82
-
* No SIMD to speak of.
83
-
84
-
Please see the TODO file for a concrete list of known issues.
81
+
* No parallel operations, GPU, or SIMD (but should be thread safe).
85
82
86
83
#### Motivation
87
84
88
-
I do numerical work in C++, and I need support for array operations. The built-in array types that C++ inherits from C are very insufficient, so at the time of C++11 when I started writing **ra-ra**, a number of libraries were already available. However, most of these libraries seemed to support only vectors and matrices, or small objects for vector algebra.
85
+
I do numerical work in C++, and I need support for array operations. The built-in array types that C++ inherits from C are insufficient, so at the time of C++11 when I started writing **ra-ra**, a number of libraries were already available. However, most of these libraries seemed to support only vectors and matrices, or small objects for vector algebra.
89
86
90
87
Blitz++ was a major inspiration as an early *generic* library. But it was a heroic feat to write such a library in C++ in the late 90s. Variadic templates, lambdas, perfect forwarding, etc. make things much easier, for the library writer as well as for the user.
91
88
92
-
From APL and J I've taken the rank extension mechanism, and perhaps an inclination for carrying each feature to its logical end.
89
+
From APL and J I've taken the rank extension mechanism, as well as an inclination for carrying each feature to its logical end.
93
90
94
-
**ra-ra** wants to remain simple. I try not to second-guess the compiler and I don't stress performance as much as Blitz++ did. However, I'm wary of adding features that could become an obstacle if I ever tried to make things fast(er). I believe that implementating new traversal methods, or perhaps optimizing specific expression patterns, should be possible without having to turn the library inside out.
91
+
I want **ra-ra** to remain simple. I try not to second-guess the compiler and I don't fret over performance as much as Blitz++ did. However, I'll avoid features that could become an obstacle if I ever tried to make things fast(er). It should be possible to implement new traversal methods, or perhaps optimize specific expression patterns, without having to turn the library inside out.
0 commit comments