Skip to content

Commit 078ef60

Browse files
committed
Show the example in the readme
1 parent e493d7e commit 078ef60

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
The package provides wrappers for [LAPACKE].
44

5+
## Example
6+
7+
```rust
8+
use lapacke::*;
9+
10+
let n = 3;
11+
let mut a = vec![3.0, 1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0, 3.0];
12+
let mut w = vec![0.0; n as usize];
13+
let info;
14+
15+
unsafe {
16+
info = dsyev(Layout::ColumnMajor, b'V', b'U', n, &mut a, n, &mut w);
17+
}
18+
19+
assert!(info == 0);
20+
for (one, another) in w.iter().zip(&[2.0, 2.0, 5.0]) {
21+
assert!((one - another).abs() < 1e-14);
22+
}
23+
```
24+
525
## Contribution
626

727
Your contribution is highly appreciated. Do not hesitate to open an issue or a

0 commit comments

Comments
 (0)