00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 template<typename T1>
00022 struct get_pod_type
00023 { typedef T1 result; };
00024
00025 template<typename T2>
00026 struct get_pod_type< std::complex<T2> >
00027 { typedef T2 result; };
00028
00029
00030
00031 template<typename T>
00032 struct is_Mat_only
00033 { static const bool value = false; };
00034
00035 template<typename eT>
00036 struct is_Mat_only< Mat<eT> >
00037 { static const bool value = true; };
00038
00039
00040
00041 template<typename T>
00042 struct is_Mat
00043 { static const bool value = false; };
00044
00045 template<typename eT>
00046 struct is_Mat< Mat<eT> >
00047 { static const bool value = true; };
00048
00049 template<typename eT>
00050 struct is_Mat< Row<eT> >
00051 { static const bool value = true; };
00052
00053 template<typename eT>
00054 struct is_Mat< Col<eT> >
00055 { static const bool value = true; };
00056
00057
00058
00059 template<typename T>
00060 struct is_Row
00061 { static const bool value = false; };
00062
00063 template<typename eT>
00064 struct is_Row< Row<eT> >
00065 { static const bool value = true; };
00066
00067
00068
00069 template<typename T>
00070 struct is_Col
00071 { static const bool value = false; };
00072
00073 template<typename eT>
00074 struct is_Col< Col<eT> >
00075 { static const bool value = true; };
00076
00077
00078
00079
00080
00081
00082 template<typename T>
00083 struct is_subview
00084 { static const bool value = false; };
00085
00086 template<typename eT>
00087 struct is_subview< subview<eT> >
00088 { static const bool value = true; };
00089
00090
00091 template<typename T>
00092 struct is_diagview
00093 { static const bool value = false; };
00094
00095 template<typename eT>
00096 struct is_diagview< diagview<eT> >
00097 { static const bool value = true; };
00098
00099
00100
00101
00102
00103
00104
00105
00106 template<typename T>
00107 struct is_Cube
00108 { static const bool value = false; };
00109
00110 template<typename eT>
00111 struct is_Cube< Cube<eT> >
00112 { static const bool value = true; };
00113
00114 template<typename T>
00115 struct is_subview_cube
00116 { static const bool value = false; };
00117
00118 template<typename eT>
00119 struct is_subview_cube< subview_cube<eT> >
00120 { static const bool value = true; };
00121
00122
00123
00124
00125
00126
00127
00128
00129 template<typename T>
00130 struct is_Op
00131 { static const bool value = false; };
00132
00133 template<typename T1, typename op_type>
00134 struct is_Op< Op<T1,op_type> >
00135 { static const bool value = true; };
00136
00137
00138 template<typename T>
00139 struct is_OpCube
00140 { static const bool value = false; };
00141
00142 template<typename T1, typename op_type>
00143 struct is_OpCube< OpCube<T1,op_type> >
00144 { static const bool value = true; };
00145
00146
00147 template<typename T>
00148 struct is_Glue
00149 { static const bool value = false; };
00150
00151 template<typename T1, typename T2, typename glue_type>
00152 struct is_Glue< Glue<T1,T2,glue_type> >
00153 { static const bool value = true; };
00154
00155
00156 template<typename T>
00157 struct is_GlueCube
00158 { static const bool value = false; };
00159
00160 template<typename T1, typename T2, typename glue_type>
00161 struct is_GlueCube< GlueCube<T1,T2,glue_type> >
00162 { static const bool value = true; };
00163
00164
00165 template<typename T>
00166 struct is_glue_times
00167 { static const bool value = false; };
00168
00169 template<typename T1, typename T2>
00170 struct is_glue_times< Glue<T1,T2,glue_times> >
00171 { static const bool value = true; };
00172
00173
00174 template<typename T>
00175 struct is_glue_times_diag
00176 { static const bool value = false; };
00177
00178 template<typename T1, typename T2>
00179 struct is_glue_times_diag< Glue<T1,T2,glue_times_diag> >
00180 { static const bool value = true; };
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191 template<typename T>
00192 struct is_eOp
00193 { static const bool value = false; };
00194
00195 template<typename T1, typename eop_type>
00196 struct is_eOp< eOp<T1,eop_type> >
00197 { static const bool value = true; };
00198
00199
00200 template<typename T>
00201 struct is_eGlue
00202 { static const bool value = false; };
00203
00204 template<typename T1, typename T2, typename eglue_type>
00205 struct is_eGlue< eGlue<T1,T2,eglue_type> >
00206 { static const bool value = true; };
00207
00208
00209 template<typename T>
00210 struct is_op_diagmat
00211 { static const bool value = false; };
00212
00213 template<typename T1>
00214 struct is_op_diagmat< Op<T1,op_diagmat> >
00215 { static const bool value = true; };
00216
00217
00218
00219
00220
00221
00222 template<typename T>
00223 struct is_op_rel
00224 { static const bool value = false; };
00225
00226 template<typename out_eT, typename T1>
00227 struct is_op_rel< mtOp<out_eT, T1, op_rel_lt_pre> >
00228 { static const bool value = true; };
00229
00230 template<typename out_eT, typename T1>
00231 struct is_op_rel< mtOp<out_eT, T1, op_rel_lt_post> >
00232 { static const bool value = true; };
00233
00234 template<typename out_eT, typename T1>
00235 struct is_op_rel< mtOp<out_eT, T1, op_rel_gt_pre> >
00236 { static const bool value = true; };
00237
00238 template<typename out_eT, typename T1>
00239 struct is_op_rel< mtOp<out_eT, T1, op_rel_gt_post> >
00240 { static const bool value = true; };
00241
00242 template<typename out_eT, typename T1>
00243 struct is_op_rel< mtOp<out_eT, T1, op_rel_lteq_pre> >
00244 { static const bool value = true; };
00245
00246 template<typename out_eT, typename T1>
00247 struct is_op_rel< mtOp<out_eT, T1, op_rel_lteq_post> >
00248 { static const bool value = true; };
00249
00250 template<typename out_eT, typename T1>
00251 struct is_op_rel< mtOp<out_eT, T1, op_rel_gteq_pre> >
00252 { static const bool value = true; };
00253
00254 template<typename out_eT, typename T1>
00255 struct is_op_rel< mtOp<out_eT, T1, op_rel_gteq_post> >
00256 { static const bool value = true; };
00257
00258 template<typename out_eT, typename T1>
00259 struct is_op_rel< mtOp<out_eT, T1, op_rel_eq> >
00260 { static const bool value = true; };
00261
00262 template<typename out_eT, typename T1>
00263 struct is_op_rel< mtOp<out_eT, T1, op_rel_noteq> >
00264 { static const bool value = true; };
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 template<typename T1>
00275 struct is_arma_type
00276 {
00277 static const bool value
00278 = is_Mat<T1>::value
00279 || is_Op<T1>::value
00280 || is_Glue<T1>::value
00281 || is_subview<T1>::value
00282 || is_diagview<T1>::value
00283 || is_eOp<T1>::value
00284 || is_eGlue<T1>::value
00285 ;
00286 };
00287
00288
00289
00290 template<typename T1>
00291 struct is_arma_cube_type
00292 {
00293 static const bool value
00294 = is_Cube<T1>::value
00295 || is_OpCube<T1>::value
00296 || is_GlueCube<T1>::value
00297 || is_subview_cube<T1>::value
00298 ;
00299 };
00300
00301
00302
00303
00304
00305
00306
00307
00308 template<typename T1, typename T2>
00309 struct is_same_type
00310 { static const bool value = false; };
00311
00312
00313 template<typename T1>
00314 struct is_same_type<T1,T1>
00315 { static const bool value = true; };
00316
00317
00318
00319 template<typename T1, typename T2>
00320 struct isnt_same_type
00321 {
00322 static const bool value = true;
00323
00324 inline static void check()
00325 {
00326 arma_static_assert<false> ERROR___TYPE_MISMATCH;
00327 ERROR___TYPE_MISMATCH = ERROR___TYPE_MISMATCH;
00328 }
00329 };
00330
00331
00332 template<typename T1>
00333 struct isnt_same_type<T1,T1>
00334 {
00335 static const bool value = false;
00336
00337 arma_inline static void check() {}
00338 };
00339
00340
00341
00342
00343
00344
00345
00346 template<typename T1>
00347 struct isnt_fltpt
00348 {
00349 static const bool value = true;
00350
00351 inline static void check()
00352 {
00353 arma_static_assert<false> ERROR___TYPE_MISMATCH;
00354 ERROR___TYPE_MISMATCH = ERROR___TYPE_MISMATCH;
00355 }
00356 };
00357
00358
00359
00360 struct isnt_fltpt_false
00361 {
00362 static const bool value = false;
00363
00364 arma_inline static void check() {}
00365 };
00366
00367
00368
00369 template<> struct isnt_fltpt< float > : public isnt_fltpt_false {};
00370 template<> struct isnt_fltpt< double > : public isnt_fltpt_false {};
00371 template<> struct isnt_fltpt< long double > : public isnt_fltpt_false {};
00372 template<> struct isnt_fltpt< std::complex<float> > : public isnt_fltpt_false {};
00373 template<> struct isnt_fltpt< std::complex<double> > : public isnt_fltpt_false {};
00374
00375
00376
00377 template<typename T1>
00378 struct is_u8
00379 { static const bool value = false; };
00380
00381 template<>
00382 struct is_u8<u8>
00383 { static const bool value = true; };
00384
00385
00386
00387 template<typename T1>
00388 struct is_s8
00389 { static const bool value = false; };
00390
00391 template<>
00392 struct is_s8<s8>
00393 { static const bool value = true; };
00394
00395
00396
00397 template<typename T1>
00398 struct is_u16
00399 { static const bool value = false; };
00400
00401 template<>
00402 struct is_u16<u16>
00403 { static const bool value = true; };
00404
00405
00406
00407 template<typename T1>
00408 struct is_s16
00409 { static const bool value = false; };
00410
00411 template<>
00412 struct is_s16<s16>
00413 { static const bool value = true; };
00414
00415
00416
00417 template<typename T1>
00418 struct is_u32
00419 { static const bool value = false; };
00420
00421 template<>
00422 struct is_u32<u32>
00423 { static const bool value = true; };
00424
00425
00426
00427 template<typename T1>
00428 struct is_s32
00429 { static const bool value = false; };
00430
00431 template<>
00432 struct is_s32<s32>
00433 { static const bool value = true; };
00434
00435
00436
00437
00438 template<typename T1>
00439 struct is_float
00440 { static const bool value = false; };
00441
00442 template<>
00443 struct is_float<float>
00444 { static const bool value = true; };
00445
00446
00447
00448 template<typename T1>
00449 struct is_double
00450 { static const bool value = false; };
00451
00452 template<>
00453 struct is_double<double>
00454 { static const bool value = true; };
00455
00456
00457
00458 template<typename T1>
00459 struct is_complex
00460 { static const bool value = false; };
00461
00462
00463 template<typename eT>
00464 struct is_complex< std::complex<eT> >
00465 { static const bool value = true; };
00466
00467
00468
00469 template<typename T1>
00470 struct is_complex_float
00471 { static const bool value = false; };
00472
00473 template<>
00474 struct is_complex_float< std::complex<float> >
00475 { static const bool value = true; };
00476
00477
00478
00479 template<typename T1>
00480 struct is_complex_double
00481 { static const bool value = false; };
00482
00483 template<>
00484 struct is_complex_double< std::complex<double> >
00485 { static const bool value = true; };
00486
00487
00488
00489
00490
00491 template<typename T1>
00492 struct is_supported_complex
00493 { static const bool value = false; };
00494
00495
00496 template<typename eT>
00497 struct is_supported_complex< std::complex<eT> >
00498 { static const bool value = ( sizeof(std::complex<eT>) == 2*sizeof(eT) ); };
00499
00500
00501
00502 template<typename T1>
00503 struct is_supported_complex_float
00504 { static const bool value = false; };
00505
00506 template<>
00507 struct is_supported_complex_float< std::complex<float> >
00508 { static const bool value = ( sizeof(std::complex<float>) == 2*sizeof(float) ); };
00509
00510
00511
00512 template<typename T1>
00513 struct is_supported_complex_double
00514 { static const bool value = false; };
00515
00516 template<>
00517 struct is_supported_complex_double< std::complex<double> >
00518 { static const bool value = ( sizeof(std::complex<double>) == 2*sizeof(double) ); };
00519
00520
00521
00522 template<typename T1>
00523 struct is_supported_elem_type
00524 {
00525 static const bool value = \
00526 is_u8<T1>::value ||
00527 is_s8<T1>::value ||
00528 is_u16<T1>::value ||
00529 is_s16<T1>::value ||
00530 is_u32<T1>::value ||
00531 is_s32<T1>::value ||
00532 is_float<T1>::value ||
00533 is_double<T1>::value ||
00534 is_supported_complex_float<T1>::value ||
00535 is_supported_complex_double<T1>::value;
00536 };
00537
00538
00539
00540 template<typename T1>
00541 struct isnt_supported_elem_type
00542 {
00543 static const bool value = true;
00544
00545 inline static void check()
00546 {
00547 arma_static_assert<false> ERROR___UNSUPPORTED_ELEMENT_TYPE;
00548 ERROR___UNSUPPORTED_ELEMENT_TYPE = ERROR___UNSUPPORTED_ELEMENT_TYPE;
00549 }
00550 };
00551
00552
00553
00554 struct isnt_supported_elem_type_false
00555 {
00556 static const bool value = false;
00557
00558 arma_inline static void check() {}
00559 };
00560
00561
00562
00563 template<> struct isnt_supported_elem_type< u8 > : public isnt_supported_elem_type_false {};
00564 template<> struct isnt_supported_elem_type< s8 > : public isnt_supported_elem_type_false {};
00565 template<> struct isnt_supported_elem_type< u16 > : public isnt_supported_elem_type_false {};
00566 template<> struct isnt_supported_elem_type< s16 > : public isnt_supported_elem_type_false {};
00567 template<> struct isnt_supported_elem_type< u32 > : public isnt_supported_elem_type_false {};
00568 template<> struct isnt_supported_elem_type< s32 > : public isnt_supported_elem_type_false {};
00569 template<> struct isnt_supported_elem_type< float > : public isnt_supported_elem_type_false {};
00570 template<> struct isnt_supported_elem_type< double > : public isnt_supported_elem_type_false {};
00571 template<> struct isnt_supported_elem_type< std::complex<float> > : public isnt_supported_elem_type_false {};
00572 template<> struct isnt_supported_elem_type< std::complex<double> > : public isnt_supported_elem_type_false {};
00573
00574
00575
00576 template<typename T1>
00577 struct is_supported_blas_type
00578 {
00579 static const bool value = \
00580 is_float<T1>::value ||
00581 is_double<T1>::value ||
00582 is_supported_complex_float<T1>::value ||
00583 is_supported_complex_double<T1>::value;
00584 };
00585
00586
00587
00588 template<typename T>
00589 struct is_signed
00590 {
00591 static const bool value = (T(-1) < T(0));
00592 };
00593
00594
00595
00596 template<typename T>
00597 struct is_non_integral
00598 {
00599 static const bool value = (T(1.0) != T(1.1));
00600 };
00601
00602
00603
00604
00605
00606 class arma_junk_class;
00607
00608 template<typename T1, typename T2>
00609 struct force_different_type
00610 {
00611 typedef T1 T1_result;
00612 typedef T2 T2_result;
00613 };
00614
00615
00616 template<typename T1>
00617 struct force_different_type<T1,T1>
00618 {
00619 typedef T1 T1_result;
00620 typedef arma_junk_class T2_result;
00621 };
00622
00623
00624
00625