Skip to content

Commit 67c3f98

Browse files
author
Jason Ramapuram
committed
more cleanup, pull out index member functions and add col and row helpers
1 parent 6b45f71 commit 67c3f98

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

examples/helloworld.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ fn main() {
77
set_device(0);
88
info();
99

10-
let dims = Dim4::new(&[5, 3, 1, 1]);
10+
let num_rows: u64 = 5;
11+
let num_columns: u64 = 3;
12+
13+
let dims = Dim4::new(&[num_rows, num_columns, 1, 1]);
1114

1215
println!("Create a 5-by-3 matrix of random floats on the GPU");
1316
let a = match randu(dims, Aftype::F32) {
@@ -43,8 +46,10 @@ fn main() {
4346
println!("Fourier transform the result");
4447
fft(&b, 1.0, 0).map(|x| print(&x));
4548

46-
// printf("Grab last row\n");
47-
// array c = C.row(end);
49+
println!("Grab last row");
50+
let c = row(&a, 4).unwrap();
51+
print(&c);
52+
//array c = C.row(end);
4853
// af_print(c);
4954

5055
println!("Create 2-by-3 matrix from host data");

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ mod defines;
4444
pub use dim4::Dim4;
4545
mod dim4;
4646

47-
pub use index::Index;
47+
pub use index::{Index, index, row, col, lookup, assign_seq, index_gen, assign_gen};
4848
mod index;
4949

5050
pub use seq::Seq;

src/seq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern crate libc;
33
use std::fmt;
44
use std::ops::Index;
55
use std::default::Default;
6-
use self::libc::{uint8_t, c_void, c_int, c_uint, c_longlong, c_double};
6+
use self::libc::{c_double};
77

88
#[derive(Copy, Clone)]
99
#[repr(C)]

0 commit comments

Comments
 (0)