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