hal-ml 0.2.0

HAL: a machine learning library that is able to run on Nvidia, OpenCL or CPU BLAS based compute backends. It currently provides stackable classical neural networks, RNN's and soon to be LSTM's. A differentiation of this package is that we are looking to implement RTRL (instead of just BPTT) for the recurrent layers in order to provide a solid framework for online learning. We will also (in the future) be implementing various layers such as unitary RNN's, NTM's and Adaptive Computation time based LSTM's. HAL also comes with the ability to plot and do many basic math operations on arrays.
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::fmt::Error as FmtError;

#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug)]
pub enum HALError {
  ///
  /// The function returned successfully
  ///
  SUCCESS            =   0,
  ///
  /// Gradient check error
  ///
  GRADIENT_ERROR     =   1,
  ///
  /// Unknown Error
  ///
  UNKNOWN            =   999
}

impl Display for HALError {
  fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
    write!(f, "{}", self.description())
  }
}

impl Error for HALError {
  fn description(&self) -> &str {
    match *self {
      HALError::SUCCESS        => "Function returned successfully",
      HALError::GRADIENT_ERROR => "Gradient check error",
      HALError::UNKNOWN        => "Unkown Error",
    }
  }
}