Skip to content

Commit cc94322

Browse files
committed
Move tutorial pages into a mdbook
1 parent cef7538 commit cc94322

23 files changed

+1987
-164
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ exclude = [
1515
"arrayfire/*",
1616
]
1717

18+
[package.metadata.docs.rs]
19+
rustdoc-args = [ "--html-in-header", "./scripts/mathjax.script", ]
20+
1821
[features]
1922
algorithm = []
2023
arithmetic = []

doc/external_docs.css

Lines changed: 0 additions & 19 deletions
This file was deleted.

generate_docs.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

scripts/generate_documentation.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# this script meant to be run from the root of arrayfire-rust
4+
5+
cargo rustdoc -- --html-in-header ./scripts/mathjax.script
6+
7+
mdbook build tutorials-book && cp -r tutorials-book/book ./target/doc/arrayfire/
File renamed without changes.

src/lib.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,25 @@
77
//! not be concerned about low-level optimizations that are frequently required to
88
//! achieve high throughput on most parallel architectures.
99
10-
//! This crate provides Rust bindings for the ArrayFire library. Given below table shows the rust bindings compatability with ArrayFire upstream. If you find any bugs, please report them on [github](https://github.com/arrayfire/arrayfire-rust/issues).
10+
//! This crate provides Rust bindings for the ArrayFire library. Given below table shows
11+
//! the rust bindings compatability with ArrayFire upstream. If you find any bugs,
12+
//! please report them on [github](https://github.com/arrayfire/arrayfire-rust/issues).
1113
//!
1214
//! | arrayfire-rust crate | ArrayFire Upstream |
13-
//! |:--------------|:---------|
14-
//! | M.m.p1 | M.m.p2 |
15+
//! |:--------------------:|:------------------:|
16+
//! | M.m.p1 | M.m.p2 |
1517
//!
1618
//! Only, Major(M) & Minor(m) version numbers need to match. *p1* and *p2*
1719
//! are patch/fix updates for `arrayfire-rust` & `ArrayFire` respectively,
1820
//! and they don't need to match.
1921
//!
20-
//! ## Tutorials
21-
//!
22-
//! - [Getting Started with ArrayFire](./getting_started.html)
23-
//! - [Introduction to Vectorization](./vectorization.html)
24-
//! - [Array and Matrix Manipulation](./array_and_matrix_manipulation.html)
25-
//! - [Indexing](./indexing.html)
26-
//! - [Configure ArrayFire Environment](./configuring_arrayfire_environment.html)
22+
//! Please go through our [tutorials](./book/index.html) book for more explanations on how to
23+
//! use ArrayFire to speedup your code.
2724
2825
#![doc(
2926
html_logo_url = "http://www.arrayfire.com/logos/arrayfire_logo_symbol.png",
3027
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
31-
html_root_url = "http://arrayfire.com/docs/rust"
28+
html_root_url = "http://arrayfire.org/arrayfire-rust/arrayfire/index.html"
3229
)]
3330
#![warn(missing_docs)]
3431
#![allow(non_camel_case_types)]

tutorials-book/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

tutorials-book/book.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[book]
2+
authors = ["Pradeep Garigipati"]
3+
language = "en"
4+
multilingual = false
5+
src = "src"
6+
title = "Rust Wrapper for ArrayFire HPC Library"
7+
8+
[output.html]
9+
theme = "src/theme"
10+
mathjax-support = true
11+
default-theme = "ayu"

tutorials-book/src/SUMMARY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Summary
2+
3+
- [Getting Started](./getting_started.md)
4+
- [Introduction to Vectorization](./vectorization.md)
5+
- [Array and Matrix Manipulation](./array_and_matrix_manipulation.md)
6+
- [Indexing](./indexing.md)
7+
- [Configuring ArrayFire Runtime Environment](./configuring_arrayfire_environment.md)

doc/array_and_matrix_manipulation.md renamed to tutorials-book/src/array_and_matrix_manipulation.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% Array and Matrix Manipulation
1+
# Array and Matrix Manipulation
22

33
ArrayFire provides several different methods for manipulating arrays and matrices.
44
The functionality includes:
@@ -16,13 +16,13 @@ Below we provide several examples of these functions and their use.
1616

1717
### moddims()
1818

19-
The [moddims](./fn.moddims.html) function changes the dimensions of an array without
19+
The [moddims](../fn.moddims.html) function changes the dimensions of an array without
2020
changing its data or order. Note that this function modifies only the _metadata_
2121
associated with the array. It does not modify the content of the array.
2222
Here is an example of moddims() converting an 8x1 array into a 2x4 and then
2323
back to a 8x1:
2424

25-
```rust
25+
```rust,noplaypen
2626
a [8 1 1 1]
2727
1.0000
2828
2.0000
@@ -53,7 +53,7 @@ let out = moddims(&a, a.elements(), 1, 1, 1);
5353

5454
### flat()
5555

56-
The [flat](./fn.flat.html) function flattens an array to one dimension:
56+
The [flat](../fn.flat.html) function flattens an array to one dimension:
5757

5858
```
5959
a [3 3 1 1]
@@ -76,11 +76,11 @@ flat(&a)
7676

7777
### flip()
7878

79-
The [flip](./fn.flip.html) function flips the contents of an array along a
79+
The [flip](../fn.flip.html) function flips the contents of an array along a
8080
chosen dimension. In the example below, we show the 5x2 array flipped
8181
along the zeroth (i.e. within a column) and first (e.g. across rows) axes:
8282

83-
```rust
83+
```rust,noplaypen
8484
a [5 2 1 1]
8585
1.0000 6.0000
8686
2.0000 7.0000
@@ -105,12 +105,12 @@ flip(a, 1) [5 2 1 1]
105105

106106
### join()
107107

108-
The [join](./fn.join.html), [join_many](./fn.join_many.html) functions can be
108+
The [join](../fn.join.html), [join_many](../fn.join_many.html) functions can be
109109
used to join arrays along a specific dimension.
110110

111111
Here is an example of how to use join an array to itself:
112112

113-
```rust
113+
```rust,noplaypen
114114
a [5 1 1 1]
115115
1.0000
116116
2.0000
@@ -140,11 +140,11 @@ join(1, a, a) [5 2 1 1]
140140

141141
### reorder()
142142

143-
The [reorder](./fn.reorder.html) function modifies the order of data within an array by
143+
The [reorder](../fn.reorder.html) function modifies the order of data within an array by
144144
exchanging data according to the change in dimensionality. The linear ordering
145145
of data within the array is preserved.
146146

147-
```rust
147+
```rust,noplaypen
148148
a [2 2 3 1]
149149
1.0000 3.0000
150150
2.0000 4.0000
@@ -181,10 +181,10 @@ reorder(&a, 2, 0, 1)
181181

182182
### shift()
183183

184-
The [shift](./fn.shift.html) function shifts data in a circular buffer fashion along a
184+
The [shift](../fn.shift.html) function shifts data in a circular buffer fashion along a
185185
chosen dimension. Consider the following example:
186186

187-
```rust
187+
```rust,noplaypen
188188
a [3 5 1 1]
189189
0.0000 0.0000 0.0000 0.0000 0.0000
190190
3.0000 4.0000 5.0000 1.0000 2.0000
@@ -205,11 +205,11 @@ shift(&a, -1, 2 )
205205

206206
### tile()
207207

208-
The [tile](./fn.tile.html) function repeats an array along the specified dimension.
208+
The [tile](../fn.tile.html) function repeats an array along the specified dimension.
209209
For example below we show how to tile an array along the zeroth and first
210210
dimensions of an array:
211211

212-
```rust
212+
```rust,noplaypen
213213
a [3 1 1 1]
214214
1.0000
215215
2.0000
@@ -254,10 +254,10 @@ tile(a, tile_dims) [3 2 3 1]
254254

255255
### transpose()
256256

257-
The [transpose](./fn.transpose.html) function performs a standard matrix transpose. The input
257+
The [transpose](../fn.transpose.html) function performs a standard matrix transpose. The input
258258
array must have the dimensions of a 2D-matrix.
259259

260-
```rust
260+
```rust,noplaypen
261261
a [3 3 1 1]
262262
1.0000 3.0000 3.0000
263263
2.0000 1.0000 3.0000

0 commit comments

Comments
 (0)