forked from M-Labs/nalgebra
Do not mantion the double-dispatch on the doc.
This commit is contained in:
parent
b7af46377d
commit
9d5d3f49f9
18
README.md
18
README.md
@ -51,20 +51,4 @@ an optimized set of tools for computer graphics and physics. Those features incl
|
|||||||
* Dynamically sized (square or rectangular) matrix: `DMat`.
|
* Dynamically sized (square or rectangular) matrix: `DMat`.
|
||||||
* A few methods for data analysis: `Cov`, `Mean`.
|
* A few methods for data analysis: `Cov`, `Mean`.
|
||||||
* Almost one trait per functionality: useful for generic programming.
|
* Almost one trait per functionality: useful for generic programming.
|
||||||
* Operator overloading using the double trait dispatch
|
* Operator overloading using multidispatch.
|
||||||
[trick](http://smallcultfollowing.com/babysteps/blog/2012/10/04/refining-traits-slash-impls/).
|
|
||||||
For example, the following works:
|
|
||||||
|
|
||||||
```rust
|
|
||||||
extern crate "nalgebra" as na;
|
|
||||||
use na::{Vec3, Mat3};
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let v: Vec3<f64> = na::zero();
|
|
||||||
let m: Mat3<f64> = na::one();
|
|
||||||
|
|
||||||
let _ = m * v; // matrix-vector multiplication.
|
|
||||||
let _ = v * m; // vector-matrix multiplication.
|
|
||||||
let _ = m * m; // matrix-matrix multiplication.
|
|
||||||
let _ = v * 2.0f64; // vector-scalar multiplication.
|
|
||||||
}
|
|
||||||
|
19
src/lib.rs
19
src/lib.rs
@ -52,24 +52,7 @@ an optimized set of tools for computer graphics and physics. Those features incl
|
|||||||
* Dynamically sized (square or rectangular) matrix: `DMat`.
|
* Dynamically sized (square or rectangular) matrix: `DMat`.
|
||||||
* A few methods for data analysis: `Cov`, `Mean`.
|
* A few methods for data analysis: `Cov`, `Mean`.
|
||||||
* Almost one trait per functionality: useful for generic programming.
|
* Almost one trait per functionality: useful for generic programming.
|
||||||
* Operator overloading using the double trait dispatch
|
* Operator overloading using multidispatch.
|
||||||
[trick](http://smallcultfollowing.com/babysteps/blog/2012/10/04/refining-traits-slash-impls/).
|
|
||||||
For example, the following works:
|
|
||||||
|
|
||||||
```rust
|
|
||||||
extern crate "nalgebra" as na;
|
|
||||||
use na::{Vec3, Mat3};
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let v: Vec3<f64> = na::zero();
|
|
||||||
let m: Mat3<f64> = na::one();
|
|
||||||
|
|
||||||
let _ = m * v; // matrix-vector multiplication.
|
|
||||||
let _ = v * m; // vector-matrix multiplication.
|
|
||||||
let _ = m * m; // matrix-matrix multiplication.
|
|
||||||
let _ = v * 2.0f64; // vector-scalar multiplication.
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Compilation
|
## Compilation
|
||||||
You will need the last nightly build of the [rust compiler](http://www.rust-lang.org)
|
You will need the last nightly build of the [rust compiler](http://www.rust-lang.org)
|
||||||
|
Loading…
Reference in New Issue
Block a user