Skip to content

Commit 6c53edf

Browse files
committed
Moved examples to examples folder and modified README to reflect it
1 parent 7d07769 commit 6c53edf

File tree

3 files changed

+74
-12
lines changed

3 files changed

+74
-12
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ rustc-serialize = "*"
1515
name = "arrayfire"
1616
path = "src/lib.rs"
1717

18-
[[test]]
18+
[[example]]
1919
name = "helloworld"
20-
path = "tests/hello_world.rs"
20+
path = "examples/helloworld.rs"

README.md

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ Edit [build.conf](build.conf) to modify the build flags. The structure is a simp
1010
Currently Rust does not allow key:value pairs to be passed from the CLI.
1111
To use an existing arrayfire installation modify the first three JSON values.
1212

13-
To build:
13+
To build arrayfire:
1414

1515
```bash
1616
git submodule update --init --recursive
1717
cargo build
1818
```
1919

20-
To test:
20+
To run hello world example:
2121

2222
```bash
23-
~/p/arrayfire_rust> cargo test
23+
~/p/arrayfire_rust> cargo run --example helloworld
2424
...
2525
running 1 test
2626
ArrayFire v3.0.0 (CUDA, 64-bit Mac OSX, build d8d4b38)
@@ -35,12 +35,75 @@ Create a 5-by-3 matrix of random floats on the GPU
3535
0.9251 0.5132 0.6814
3636

3737
Element-wise arithmetic
38+
sin(a) + 1.5 =>
3839
[5 3 1 1]
39-
0.6744 0.4317 0.7006
40-
0.7962 0.6189 0.2905
41-
0.0390 0.1097 0.6549
42-
0.8243 0.4531 0.3509
43-
0.7987 0.4910 0.6299
40+
2.1744 1.9317 2.2006
41+
2.2962 2.1189 1.7905
42+
1.5390 1.6097 2.1549
43+
2.3243 1.9531 1.8509
44+
2.2987 1.9910 2.1299
45+
46+
sin(a) + cos(a) =>
47+
[5 3 1 1]
48+
1.4128 1.3337 1.4142
49+
1.4012 1.4044 1.2474
50+
1.0382 1.1037 1.4106
51+
1.3905 1.3446 1.2873
52+
1.4004 1.3621 1.4066
53+
54+
!a =>
55+
[5 3 1 1]
56+
1 1 1
57+
1 1 1
58+
1 1 1
59+
1 1 1
60+
1 1 1
61+
62+
a + b
63+
[5 3 1 1]
64+
2.9147 2.3780 2.9767
65+
3.2172 2.7862 2.0853
66+
1.5780 1.7196 2.8689
67+
3.2933 2.4233 2.2094
68+
3.2238 2.5042 2.8113
69+
70+
Fourier transform the result
71+
[5 3 1 1]
72+
(10.6327,0.0000) (9.6043,0.0000) (10.1267,0.0000)
73+
(0.4689,0.4640) (0.3193,0.0802) (0.1713,0.1441)
74+
(-0.3491,-0.7454) (-0.2923,-0.4018) (0.2667,0.4886)
75+
(-0.3491,0.7454) (-0.2923,0.4018) (0.2667,-0.4886)
76+
(0.4689,-0.4640) (0.3193,-0.0802) (0.1713,-0.1441)
77+
78+
Create 2-by-3 matrix from host data
79+
[2 3 1 1]
80+
1 3 5
81+
2 4 6
82+
83+
Sort A and print sorted array and corresponding indices
84+
[5 3 1 1]
85+
0.0390 0.1099 0.2948
86+
0.7402 0.4464 0.3585
87+
0.9210 0.4702 0.6814
88+
0.9251 0.5132 0.7140
89+
0.9690 0.6673 0.7762
90+
91+
[5 3 1 1]
92+
2 2 1
93+
0 0 3
94+
1 3 4
95+
4 4 2
96+
3 1 0
97+
98+
u8 constant array
99+
[5 3 1 1]
100+
1 1 1
101+
1 1 1
102+
1 1 1
103+
1 1 1
104+
1 1 1
105+
106+
Is u8_cnst array float precision type ? false
44107
```
45108

46109
## Issues
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ extern crate arrayfire as af;
44
use af::Dim4;
55
use af::Array;
66

7-
#[test]
87
fn main() {
98
af::set_device(0);
109
af::info();
@@ -24,7 +23,7 @@ fn main() {
2423
println!("!a => "); af::print(&b3);
2524

2625
let test = &a + &b;
27-
af::print(&test);
26+
println!("a + b"); af::print(&test);
2827

2928
// printf("Negate the first three elements of second column\n");
3029
// B(seq(0, 2), 1) = B(seq(0, 2), 1) * -1;

0 commit comments

Comments
 (0)