@@ -98,6 +98,40 @@ behavior is the same as NumPy except when `step < -1`. See the docs for the
98
98
</tr >
99
99
</table >
100
100
101
+ ## Other Rust array/matrix crates
102
+
103
+ Of the array/matrix types in Rust crates, the ` ndarray ` array type is probably
104
+ the most similar to NumPy's arrays and is the most flexible. However, if your
105
+ use-case is constrained to linear algebra on 1-D and 2-D vectors and matrices,
106
+ it might be worth considering other crates:
107
+
108
+ * [ ` nalgebra ` ] ( https://crates.io/crates/nalgebra ) provides 1-D and 2-D
109
+ column-major vector and matrix types for linear algebra. Vectors and matrices
110
+ can have constant or dynamic shapes, and ` nalgebra ` uses the type system to
111
+ provide compile-time checking of shapes, not just the number of dimensions.
112
+ ` nalgebra ` provides convenient functionality for geometry (e.g. coordinate
113
+ transformations) and linear algebra.
114
+ * [ ` cgmath ` ] ( https://crates.io/crates/cgmath ) provides 1-D and 2-D column-major
115
+ types of shape 4×4 or smaller. It's primarily designed for computer graphics
116
+ and provides convenient functionality for geometry (e.g. coordinate
117
+ transformations). Similar to ` nalgebra ` , ` cgmath ` uses the type system to
118
+ provide compile-time checking of shapes.
119
+ * [ ` rulinalg ` ] ( https://crates.io/crates/rulinalg ) provides 1-D and 2-D
120
+ row-major vector and matrix types with dynamic shapes. Similar to ` ndarray ` ,
121
+ ` rulinalg ` provides compile-time checking of the number of dimensions, but
122
+ not shapes. ` rulinalg ` provides pure-Rust implementations of linear algebra
123
+ operations.
124
+ * If there's another crate that should be listed here, please let us know.
125
+
126
+ In contrast to those crates, ` ndarray ` provides an * n* -dimensional array type,
127
+ so it's not restricted to 1-D and 2-D vectors and matrices. Also, operators
128
+ operate elementwise by default, so the multiplication operator ` * ` performs
129
+ elementwise multiplication instead of matrix multiplication. (You have to
130
+ specifically call ` .dot() ` if you want matrix multiplication.) Linear algebra
131
+ with ` ndarray ` is provided by other crates, e.g.
132
+ [ ` ndarray-linalg ` ] ( https://crates.io/crates/ndarray-linalg ) and
133
+ [ ` linxal ` ] ( https://crates.io/crates/linxal ) .
134
+
101
135
## Rough ` ndarray ` –NumPy equivalents
102
136
103
137
These tables provide some rough equivalents of NumPy operations in ` ndarray ` .
0 commit comments