arrayfire 3.5.0

ArrayFire is a high performance software library for parallel computing with an easy-to-use API. Its array based function set makes parallel programming simple. ArrayFire's multiple backends (CUDA, OpenCL and native CPU) make it platform independent and highly portable. A few lines of code in ArrayFire can replace dozens of lines of parallel computing code, saving you valuable time and lowering development costs. This crate provides Rust bindings for ArrayFire library.
Documentation
extern crate libc;

use std::fmt;
use std::default::Default;
use num::{One, Zero};

/// Sequences are used for indexing Arrays
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Seq<T> {
    begin: T,
    end: T,
    step: T,
}

/// Default `Seq` spans all the elements along a dimension
impl<T: One+Zero> Default for Seq<T> {
    fn default() -> Self {
        Seq { begin: One::one(), end: One::one(), step: Zero::zero() }
    }
}

/// Enables use of `Seq` with `{}` format in print statements
impl<T: fmt::Display> fmt::Display for Seq<T> {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "[begin: {}, end: {}, step: {}]", self.begin, self.end, self.step)
    }
}

impl<T: Copy> Seq<T> {
    /// Create a `Seq` that goes from `begin` to `end` at a step size of `step`
    pub fn new(begin: T, end: T, step: T) -> Self {
        Seq { begin: begin, end: end, step: step, }
    }

    /// Get begin index of Seq
    pub fn begin(&self) -> T {
        self.begin
    }

    /// Get end index of Seq
    pub fn end(&self) -> T {
        self.end
    }

    /// Get step size of Seq
    pub fn step(&self) -> T {
        self.step
    }
}