///////////////////////////////////////////////////////////////////// // = NMatrix // // A linear algebra library for scientific computation in Ruby. // NMatrix is part of SciRuby. // // NMatrix was originally inspired by and derived from NArray, by // Masahiro Tanaka: http://narray.rubyforge.org // // == Copyright Information // // SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation // NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation // // Please see LICENSE.txt for additional copyright notices. // // == Contributing // // By contributing source code to SciRuby, you agree to be bound by // our Contributor Agreement: // // * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement // // == meta.h // // Header file for dealing with template metaprogramming. #ifndef META_H # define META_H namespace nm { /* * Template Metaprogramming */ template struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::BYTE; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::BYTE; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::INT8; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::INT16; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::INT32; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::INT64; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::FLOAT32; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::FLOAT64; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::COMPLEX64; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::COMPLEX128; }; template <> struct ctype_to_dtype_enum { static const nm::dtype_t value_type = nm::RUBYOBJ; }; template struct dtype_enum_T; template <> struct dtype_enum_T { typedef uint8_t type; }; template <> struct dtype_enum_T { typedef int8_t type; }; template <> struct dtype_enum_T { typedef int16_t type; }; template <> struct dtype_enum_T { typedef int32_t type; }; template <> struct dtype_enum_T { typedef int64_t type; }; template <> struct dtype_enum_T { typedef float type; }; template <> struct dtype_enum_T { typedef double type; }; template <> struct dtype_enum_T { typedef nm::Complex64 type; }; template <> struct dtype_enum_T { typedef nm::Complex128 type; }; template <> struct dtype_enum_T { typedef nm::RubyObject type; }; } // end namespace nm #endif