$search
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-2011 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00018 #if UCHAR_MAX >= 0xff 00019 00020 typedef unsigned char u8; 00021 typedef char s8; 00022 #else 00023 #error "don't know how to typedef 'u8' on this system" 00024 #endif 00025 00026 // NOTE: 00027 // "signed char" is not the same as "char". 00028 // http://www.embedded.com/columns/programmingpointers/206107018 00029 // http://en.wikipedia.org/wiki/C_variable_types_and_declarations 00030 00031 00032 #if USHRT_MAX >= 0xffff 00033 00034 typedef unsigned short u16; 00035 typedef short s16; 00036 #else 00037 #error "don't know how to typedef 'u16' on this system" 00038 #endif 00039 00040 00041 #if UINT_MAX >= 0xffffffff 00042 typedef unsigned int u32; 00043 typedef int s32; 00044 #elif ULONG_MAX >= 0xffffffff 00045 typedef unsigned long u32; 00046 typedef long s32; 00047 #else 00048 #error "don't know how to typedef 'u32' on this system" 00049 #endif 00050 00051 00052 #if defined(ARMA_64BIT_WORD) 00053 #if ULONG_MAX >= 0xffffffffffffffff 00054 typedef unsigned long u64; 00055 typedef long s64; 00056 #else 00057 #if ULLONG_MAX >= 0xffffffffffffffff 00058 typedef unsigned long long u64; 00059 typedef long long s64; 00060 #else 00061 #error "don't know how to typedef 'u64' on this system" 00062 #endif 00063 #endif 00064 #endif 00065 00066 00067 00068 // // only supported by C++11, via #include <cstdint>, or by C99, via #include <stdint.h> 00069 // 00070 // typedef uint8_t u8; 00071 // typedef int8_t s8; 00072 // 00073 // typedef uint16_t u16; 00074 // typedef int16_t s16; 00075 // 00076 // typedef uint32_t u32; 00077 // typedef int32_t s32; 00078 // 00079 // typedef uint64_t u64; 00080 // typedef int64_t s64; 00081 00082 00083 00084 #if !defined(ARMA_64BIT_WORD) 00085 typedef u32 uword; 00086 typedef s32 sword; 00087 00088 typedef u16 uhword; 00089 typedef s16 shword; 00090 00091 #define ARMA_MAX_UWORD 0xffffffff 00092 #define ARMA_MAX_UHWORD 0xffff 00093 #else 00094 typedef u64 uword; 00095 typedef s64 sword; 00096 00097 typedef u32 uhword; 00098 typedef s32 shword; 00099 00100 #define ARMA_MAX_UWORD 0xffffffffffffffff 00101 #define ARMA_MAX_UHWORD 0xffffffff 00102 #endif 00103 00104 00105 00106 typedef std::complex<float> cx_float; 00107 typedef std::complex<double> cx_double; 00108 00109 typedef Mat <unsigned char> uchar_mat; 00110 typedef Col <unsigned char> uchar_vec; 00111 typedef Col <unsigned char> uchar_colvec; 00112 typedef Row <unsigned char> uchar_rowvec; 00113 typedef Cube<unsigned char> uchar_cube; 00114 00115 typedef Mat <u32> u32_mat; 00116 typedef Col <u32> u32_vec; 00117 typedef Col <u32> u32_colvec; 00118 typedef Row <u32> u32_rowvec; 00119 typedef Cube<u32> u32_cube; 00120 00121 typedef Mat <s32> s32_mat; 00122 typedef Col <s32> s32_vec; 00123 typedef Col <s32> s32_colvec; 00124 typedef Row <s32> s32_rowvec; 00125 typedef Cube<s32> s32_cube; 00126 00127 typedef Mat <uword> umat; 00128 typedef Col <uword> uvec; 00129 typedef Col <uword> ucolvec; 00130 typedef Row <uword> urowvec; 00131 typedef Cube<uword> ucube; 00132 00133 typedef Mat <sword> imat; 00134 typedef Col <sword> ivec; 00135 typedef Col <sword> icolvec; 00136 typedef Row <sword> irowvec; 00137 typedef Cube<sword> icube; 00138 00139 typedef Mat <float> fmat; 00140 typedef Col <float> fvec; 00141 typedef Col <float> fcolvec; 00142 typedef Row <float> frowvec; 00143 typedef Cube<float> fcube; 00144 00145 typedef Mat <double> mat; 00146 typedef Col <double> vec; 00147 typedef Col <double> colvec; 00148 typedef Row <double> rowvec; 00149 typedef Cube<double> cube; 00150 00151 typedef Mat <cx_float> cx_fmat; 00152 typedef Col <cx_float> cx_fvec; 00153 typedef Col <cx_float> cx_fcolvec; 00154 typedef Row <cx_float> cx_frowvec; 00155 typedef Cube<cx_float> cx_fcube; 00156 00157 typedef Mat <cx_double> cx_mat; 00158 typedef Col <cx_double> cx_vec; 00159 typedef Col <cx_double> cx_colvec; 00160 typedef Row <cx_double> cx_rowvec; 00161 typedef Cube<cx_double> cx_cube; 00162 00163 00164 00165 typedef void* void_ptr; 00166 00167 00168 00169 namespace junk 00170 { 00171 struct arma_elem_size_test 00172 { 00173 00174 arma_static_check( (sizeof(u8) != 1), ERROR___TYPE_U8_HAS_UNSUPPORTED_SIZE ); 00175 arma_static_check( (sizeof(s8) != 1), ERROR___TYPE_S8_HAS_UNSUPPORTED_SIZE ); 00176 00177 arma_static_check( (sizeof(u16) != 2), ERROR___TYPE_U16_HAS_UNSUPPORTED_SIZE ); 00178 arma_static_check( (sizeof(s16) != 2), ERROR___TYPE_S16_HAS_UNSUPPORTED_SIZE ); 00179 00180 arma_static_check( (sizeof(u32) != 4), ERROR___TYPE_U32_HAS_UNSUPPORTED_SIZE ); 00181 arma_static_check( (sizeof(s32) != 4), ERROR___TYPE_S32_HAS_UNSUPPORTED_SIZE ); 00182 00183 #if defined(ARMA_64BIT_WORD) 00184 arma_static_check( (sizeof(u64) != 8), ERROR___TYPE_U64_HAS_UNSUPPORTED_SIZE ); 00185 arma_static_check( (sizeof(s64) != 8), ERROR___TYPE_S64_HAS_UNSUPPORTED_SIZE ); 00186 #endif 00187 00188 arma_static_check( (sizeof(float) != 4), ERROR___TYPE_FLOAT_HAS_UNSUPPORTED_SIZE ); 00189 arma_static_check( (sizeof(double) != 8), ERROR___TYPE_DOUBLE_HAS_UNSUPPORTED_SIZE ); 00190 00191 arma_static_check( (sizeof(std::complex<float>) != 8), ERROR___TYPE_COMPLEX_FLOAT_HAS_UNSUPPORTED_SIZE ); 00192 arma_static_check( (sizeof(std::complex<double>) != 16), ERROR___TYPE_COMPLEX_DOUBLE_HAS_UNSUPPORTED_SIZE ); 00193 00194 }; 00195 } 00196 00197