34 #ifndef __INCLUDE_MIST_CONF_H__
35 #define __INCLUDE_MIST_CONF_H__
50 #define _MIST_BEGIN namespace mist{
65 #if defined( _MSC_VER )
68 #define __MIST_MSVC__ 6
71 #define __MIST_MSVC__ 7
74 #define __MIST_MSVC__ 8
79 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ >= 8
86 #pragma warning( disable : 4996 )
96 #if defined( WIN64 ) || defined( _WIN64 )
98 #define __MIST_WINDOWS__ 2
99 #elif defined( WIN32 ) || defined( _WIN32 )
101 #define __MIST_WINDOWS__ 1
104 #if defined( _WIN64 ) || defined( __x86_64__ ) || defined( __AMD64__ )
106 #define __MIST64__ 64
109 #define __MIST32__ 32
115 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ <= 6
116 #define _MIST_CONST( type, name, value ) enum{ name = value }
118 #define _MIST_CONST( type, name, value ) static const type name = value
123 #if defined(__MIST_MSVC__) || defined(__INTEL_COMPILER)
126 #define _MIST_PACKED __attribute__( ( packed ) )
132 #define _MIST_ALLOCATE_TEST_ 0
140 #define _MIST_ALLOCATOR_MEMORY_TRIM_ 0
142 #define _MIST_UNUSED_( arg ) ( void )( arg )
144 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ <= 6
153 #define STD_CMATH_FUNC1( name, func, value ) inline value name ( value v ){ return( ::func( v ) ); }
154 #define STD_CMATH_FUNC2( name, func, value ) inline value name ( value v1, value v2 ){ return( ::func( v1, v2 ) ); }
157 STD_CMATH_FUNC1( abs, abs,
int )
158 STD_CMATH_FUNC1( abs, labs,
long )
159 STD_CMATH_FUNC1( abs, fabs,
double )
160 STD_CMATH_FUNC1( sqrt, sqrt,
double )
161 STD_CMATH_FUNC1( sin, sin,
double )
162 STD_CMATH_FUNC1( cos, cos,
double )
163 STD_CMATH_FUNC1( log, log,
double )
164 STD_CMATH_FUNC1( log10, log10,
double )
165 STD_CMATH_FUNC1( exp, exp,
double )
166 STD_CMATH_FUNC2( pow, pow,
double )
168 #undef STD_CMATH_FUNC1
169 #undef STD_CMATH_FUNC2
186 #ifndef _MIST_USER_CONFIG_
188 #if !defined( NDEBUG ) || defined( DEBUG )
191 #define _CHECK_ACCESS_VIOLATION_ 1
192 #define _CHECK_ARRAY_OPERATION_ 1
193 #define _CHECK_ARRAY1_OPERATION_ 1
194 #define _CHECK_ARRAY2_OPERATION_ 1
195 #define _CHECK_ARRAY3_OPERATION_ 1
197 #define _CHECK_MATRIX_OPERATION_ 1
202 #define _CHECK_ACCESS_VIOLATION_ 0
203 #define _CHECK_ARRAY_OPERATION_ 0
204 #define _CHECK_ARRAY1_OPERATION_ 0
205 #define _CHECK_ARRAY2_OPERATION_ 0
206 #define _CHECK_ARRAY3_OPERATION_ 0
208 #define _CHECK_MATRIX_OPERATION_ 0
213 #define __CHECK_HARD_CASE__ 0
215 #define _ARRAY_BIND_OPERATION_SUPPORT_ 1
216 #define _ARRAY1_BIND_OPERATION_SUPPORT_ 1
217 #define _ARRAY2_BIND_OPERATION_SUPPORT_ 1
218 #define _ARRAY3_BIND_OPERATION_SUPPORT_ 1
221 #define _MIST_THREAD_SUPPORT_ 1
223 #define _MIST_VECTOR_SUPPORT_ 0
225 #define _LZW_COMPRESSION_SUPPORT_ false
227 #define _COMPRESSED_CSV_SUPPORT_ 0
231 #define _USE_INTEL_MATH_KERNEL_LIBRARY_ 0
232 #define _DESCENDING_ORDER_EIGEN_VALUE_ 0
233 #define _USE_BALANCING_MATRIX_EIGEN_ 1
234 #define _USE_DIVIDE_AND_CONQUER_SVD_ 1
251 template <
class Object1,
class Object2 >
254 return( reinterpret_cast< const void * >( &o1 ) == reinterpret_cast< const void * >( &o2 ) );
263 inline const std::string
wstr2str(
const std::wstring &src )
265 static bool is_initialized =
false;
266 if( !is_initialized )
268 is_initialized =
true;
269 setlocale( LC_CTYPE,
"" );
272 size_t nbytes = wcstombs( NULL, src.c_str( ), 0 );
273 char *buff =
new char[ nbytes + 1 ];
274 wcstombs( buff, src.c_str( ), nbytes + 1 );
275 std::string
dst( buff );
316 template <
class Functor >
330 bool operator()(
long double percent )
332 percent = lower_ + percent / 100.0 * ( upper_ - lower_ );
333 return( f_( percent ) );
337 __mist_convert_callback__( Functor f,
double l = 0.0,
double u = 100.0 ) : f_( f ), lower_( l ), upper_( u ){ }
365 bool operator()(
long double percent )
367 int ppp =
static_cast< int >( percent );
368 if( __percent__ != ppp )
372 int k3 =
static_cast< int >( percent / 100.0 );
373 percent -= k3 * 100.0;
374 int k2 =
static_cast< int >( percent / 10.0 );
375 percent -= k2 * 10.0;
376 int k1 =
static_cast< int >( percent );
378 std::cerr <<
"busy... ";
384 std::cerr <<
" " << k1;
388 std::cerr << k2 << k1;
393 std::cerr << 1 << k2 << k1;
395 if( percent > 100.0 )
397 std::cerr <<
"%" << std::endl;
425 std::cerr <<
"0% 10 20 30 40 50 60 70 80 90 100%" << std::endl;
426 std::cerr <<
"|----|----|----|----|----|----|----|----|----|----|" << std::endl;
436 bool operator()(
long double percent )
const
438 if( percent > 100.0 )
440 std::cerr <<
"***************************************************" << std::endl;
444 int i, p =
static_cast< int >( percent / 2.0 );
446 for( i = 0 ; i < p ; i++ )
450 for( ; i < 51 ; i++ )
469 #if _CHECK_ACCESS_VIOLATION_
477 ::std::cerr <<
"Access Violation at ( " <<
static_cast< int >( index ) <<
" )" << ::std::endl;
488 ::std::cerr <<
"Access Violation at ( " <<
static_cast< int >( index1 ) <<
", " << static_cast< int >( index2 ) <<
" )" << ::std::endl;
500 ::std::cerr <<
"Access Violation at ( " <<
static_cast< int >( index1 ) <<
", " << static_cast< int >( index2 ) <<
", " <<
static_cast< int >( index3 ) <<
" )" << ::std::endl;
504 #define _CHECK_ACCESS_VIOLATION1U_( index ) \
505 if( index >= size( ) )\
507 static value_type dmy;\
508 mist_debug_assertion( index );\
512 #define _CHECK_ACCESS_VIOLATION1S_( index ) \
513 if( index < 0 || index >= size( ) )\
515 static value_type dmy;\
516 mist_debug_assertion( index );\
520 #define _CHECK_ACCESS_VIOLATION2U_( index1, index2 ) \
521 if( index1 >= size1( ) || index2 >= size2( ) )\
523 static value_type dmy;\
524 mist_debug_assertion( index1, index2 );\
528 #define _CHECK_ACCESS_VIOLATION2S_( index1, index2 ) \
529 if( index1 < 0 || index1 >= size1( ) || index2 < 0 || index2 >= size2( ) )\
531 static value_type dmy;\
532 mist_debug_assertion( index1, index2 );\
536 #define _CHECK_ACCESS_VIOLATION3U_( index1, index2, index3 ) \
537 if( index1 >= size1( ) || index2 >= size2( ) || index3 >= size3( ) )\
539 static value_type dmy;\
540 mist_debug_assertion( index1, index2, index3 );\
544 #define _CHECK_ACCESS_VIOLATION3S_( index1, index2, index3 ) \
545 if( index1 < 0 || index1 >= size1( ) || index2 < 0 || index2 >= size2( ) || index3 < 0 || index3 >= size3( ) )\
547 static value_type dmy;\
548 mist_debug_assertion( index1, index2, index3 );\
554 #define _CHECK_ACCESS_VIOLATION1U_( index )
555 #define _CHECK_ACCESS_VIOLATION1S_( index )
556 #define _CHECK_ACCESS_VIOLATION2U_( index1, index2 )
557 #define _CHECK_ACCESS_VIOLATION2S_( index1, index2 )
558 #define _CHECK_ACCESS_VIOLATION3U_( index1, index2, index3 )
559 #define _CHECK_ACCESS_VIOLATION3S_( index1, index2, index3 )