00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 template<typename out_eT, typename in_eT>
00025 inline
00026 void
00027 copy_complex_elem(out_eT& out, const in_eT& in)
00028 {
00029
00030
00031 out = out_eT(in);
00032 }
00033
00034
00035
00036 template<typename out_eT, typename in_T>
00037 inline
00038 void
00039 copy_complex_elem(out_eT& out, const std::complex<in_T>& in)
00040 {
00041
00042
00043 out = out_eT( in.real() );
00044 }
00045
00046
00047
00048 template<typename out_T, typename in_T>
00049 inline
00050 void
00051 copy_complex_elem(std::complex<out_T>& out, const std::complex<in_T>& in)
00052 {
00053
00054
00055 typedef std::complex<out_T> out_eT;
00056 out = out_eT(in);
00057 }
00058
00059
00060
00061
00062
00063
00064
00065 template<typename out_eT>
00066 class conv_to
00067 {
00068 public:
00069
00070 inline static out_eT from(const Mat< out_eT >& in);
00071
00072 template<typename in_eT>
00073 inline static out_eT from(const Mat< in_eT >& in);
00074
00075 template<typename in_eT, typename T1>
00076 inline static out_eT from(const Base<in_eT,T1>& in);
00077
00078 };
00079
00080
00081 template<typename out_eT>
00082 inline
00083 out_eT
00084 conv_to<out_eT>::from(const Mat<out_eT>& in)
00085 {
00086 arma_extra_debug_sigprint();
00087
00088 arma_debug_check( (in.n_elem != 1), "conv_to<>: matrix doesn't have exactly one element" );
00089
00090 return in.mem[0];
00091 }
00092
00093
00094
00095 template<typename out_eT>
00096 template<typename in_eT>
00097 inline
00098 out_eT
00099 conv_to<out_eT>::from(const Mat<in_eT>& in)
00100 {
00101 arma_extra_debug_sigprint();
00102
00103 arma_type_check< is_supported_elem_type<out_eT>::value == false >::apply();
00104
00105 arma_debug_check( (in.n_elem != 1), "conv_to<>: matrix doesn't have exactly one element" );
00106
00107 out_eT out;
00108 copy_complex_elem(out, in.mem[0]);
00109
00110 return out;
00111 }
00112
00113
00114
00115 template<typename out_eT>
00116 template<typename in_eT, typename T1>
00117 inline
00118 out_eT
00119 conv_to<out_eT>::from(const Base<in_eT,T1>& in)
00120 {
00121 arma_extra_debug_sigprint();
00122
00123 arma_type_check< is_supported_elem_type<out_eT>::value == false >::apply();
00124
00125 const unwrap<T1> tmp(in.get_ref());
00126
00127 return conv_to<out_eT>::from( tmp.M );
00128 }
00129
00130
00131
00132
00133
00134
00135
00136 template<typename out_eT>
00137 class conv_to< Mat<out_eT> >
00138 {
00139 public:
00140
00141 template<typename in_eT>
00142 inline static Mat<out_eT> from(const Mat< in_eT >& in);
00143
00144 template<typename in_T>
00145 inline static Mat<out_eT> from(const Mat< std::complex<in_T> >& in);
00146
00147 template<typename in_eT, typename T1>
00148 inline static Mat<out_eT> from(const Base<in_eT,T1>& in);
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 template<typename in_eT>
00160 inline static Mat<out_eT> from(const itpp::Mat< in_eT >& in);
00161
00162 template<typename in_T>
00163 inline static Mat<out_eT> from(const itpp::Mat< std::complex<in_T> >& in);
00164 };
00165
00166
00167
00168 template<typename out_eT>
00169 template<typename in_eT>
00170 inline
00171 Mat<out_eT>
00172 conv_to< Mat<out_eT> >::from(const Mat<in_eT>& in)
00173 {
00174 arma_extra_debug_sigprint();
00175
00176 Mat<out_eT> out(in.n_rows, in.n_cols);
00177
00178 const in_eT* in_mem = in.mem;
00179 out_eT* out_mem = out.memptr();
00180
00181 for(u32 i=0; i<out.n_elem; ++i)
00182 {
00183 out_mem[i] = out_eT( in_mem[i] );
00184 }
00185
00186 return out;
00187 }
00188
00189
00190
00191 template<typename out_eT>
00192 template<typename in_T>
00193 inline
00194 Mat<out_eT>
00195 conv_to< Mat<out_eT> >::from(const Mat< std::complex<in_T> >& in)
00196 {
00197 arma_extra_debug_sigprint();
00198
00199 typedef std::complex<in_T> in_eT;
00200
00201 Mat<out_eT> out(in.n_rows, in.n_cols);
00202
00203 const in_eT* in_mem = in.mem;
00204 out_eT* out_mem = out.memptr();
00205
00206 for(u32 i=0; i<out.n_elem; ++i)
00207 {
00208 copy_complex_elem(out_mem[i], in_mem[i]);
00209 }
00210
00211 return out;
00212 }
00213
00214
00215
00216 template<typename out_eT>
00217 template<typename in_eT, typename T1>
00218 inline
00219 Mat<out_eT>
00220 conv_to< Mat<out_eT> >::from(const Base<in_eT,T1>& in)
00221 {
00222 arma_extra_debug_sigprint();
00223
00224 const unwrap<T1> tmp(in.get_ref());
00225
00226 return conv_to< Mat<out_eT> >::from( tmp.M );
00227 }
00228
00229
00230
00231 template<typename out_eT>
00232 template<typename in_eT>
00233 inline
00234 Mat<out_eT>
00235 conv_to< Mat<out_eT> >::from(const itpp::Mat<in_eT>& in)
00236 {
00237 arma_extra_debug_sigprint();
00238
00239 Mat<out_eT> out(in.rows(), in.cols());
00240
00241 const in_eT* in_mem = in._data();
00242 out_eT* out_mem = out.memptr();
00243
00244 for(u32 i=0; i<out.n_elem; ++i)
00245 {
00246 out_mem[i] = out_eT( in_mem[i] );
00247 }
00248
00249 return out;
00250 }
00251
00252
00253
00254 template<typename out_eT>
00255 template<typename in_T>
00256 inline
00257 Mat<out_eT>
00258 conv_to< Mat<out_eT> >::from(const itpp::Mat< std::complex<in_T> >& in)
00259 {
00260 arma_extra_debug_sigprint();
00261
00262 typedef std::complex<in_T> in_eT;
00263
00264 Mat<out_eT> out(in.rows(), in.cols());
00265
00266 const in_eT* in_mem = in._data();
00267 out_eT* out_mem = out.memptr();
00268
00269 for(u32 i=0; i<out.n_elem; ++i)
00270 {
00271 copy_complex_elem(out_mem[i], in_mem[i]);
00272 }
00273
00274 return out;
00275 }
00276
00277
00278
00279
00280
00281
00282
00283 template<typename out_eT>
00284 class conv_to< Row<out_eT> >
00285 {
00286 public:
00287
00288 inline static Row<out_eT> from(const Mat< out_eT >& in);
00289
00290 template<typename in_eT>
00291 inline static Row<out_eT> from(const Mat< in_eT >& in);
00292
00293 template<typename in_T>
00294 inline static Row<out_eT> from(const Mat< std::complex<in_T> >& in);
00295
00296 template<typename in_eT, typename T1>
00297 inline static Row<out_eT> from(const Base<in_eT,T1>& in);
00298
00299
00300
00301 template<typename in_eT>
00302 inline static Row<out_eT> from(const itpp::Vec< in_eT >& in);
00303
00304 template<typename in_T>
00305 inline static Row<out_eT> from(const itpp::Vec< std::complex<in_T> >& in);
00306
00307
00308
00309
00310
00311 };
00312
00313
00314
00315 template<typename out_eT>
00316 inline
00317 Row<out_eT>
00318 conv_to< Row<out_eT> >::from(const Mat<out_eT>& in)
00319 {
00320 arma_extra_debug_sigprint();
00321
00322 arma_debug_check( (in.n_rows > 1), "conv_to<>: given matrix has more than one row");
00323 Row<out_eT> out(in.n_cols);
00324
00325 syslib::copy_elem(out.memptr(), in.mem, out.n_elem);
00326
00327
00328 return out;
00329 }
00330
00331
00332
00333 template<typename out_eT>
00334 template<typename in_eT>
00335 inline
00336 Row<out_eT>
00337 conv_to< Row<out_eT> >::from(const Mat<in_eT>& in)
00338 {
00339 arma_extra_debug_sigprint();
00340
00341 arma_debug_check( (in.n_rows > 1), "conv_to<>: given matrix has more than one row");
00342 Row<out_eT> out(in.n_cols);
00343
00344 const in_eT* in_mem = in.mem;
00345 out_eT* out_mem = out.memptr();
00346
00347 for(u32 i=0; i<out.n_elem; ++i)
00348 {
00349 out_mem[i] = out_eT( in_mem[i] );
00350 }
00351
00352 return out;
00353 }
00354
00355
00356
00357 template<typename out_eT>
00358 template<typename in_T>
00359 inline
00360 Row<out_eT>
00361 conv_to< Row<out_eT> >::from(const Mat< std::complex<in_T> >& in)
00362 {
00363 arma_extra_debug_sigprint();
00364
00365 typedef std::complex<in_T> in_eT;
00366
00367 arma_debug_check( (in.n_rows > 1), "conv_to<>: given matrix has more than one row");
00368 Row<out_eT> out(in.n_cols);
00369
00370 const in_eT* in_mem = in.mem;
00371 out_eT* out_mem = out.memptr();
00372
00373 for(u32 i=0; i<out.n_elem; ++i)
00374 {
00375 copy_complex_elem(out_mem[i], in_mem[i]);
00376 }
00377
00378 return out;
00379 }
00380
00381
00382
00383 template<typename out_eT>
00384 template<typename in_eT, typename T1>
00385 inline
00386 Row<out_eT>
00387 conv_to< Row<out_eT> >::from(const Base<in_eT,T1>& in)
00388 {
00389 arma_extra_debug_sigprint();
00390
00391 const unwrap<T1> tmp(in.get_ref());
00392
00393 return conv_to< Row<out_eT> >::from( tmp.M );
00394 }
00395
00396
00397
00398 template<typename out_eT>
00399 template<typename in_eT>
00400 inline
00401 Row<out_eT>
00402 conv_to< Row<out_eT> >::from(const itpp::Vec<in_eT>& in)
00403 {
00404 arma_extra_debug_sigprint();
00405
00406 Row<out_eT> out(in.length());
00407
00408 const in_eT* in_mem = in._data();
00409 out_eT* out_mem = out.memptr();
00410
00411 for(u32 i=0; i<out.n_elem; ++i)
00412 {
00413 out_mem[i] = out_eT( in_mem[i] );
00414 }
00415
00416 return out;
00417 }
00418
00419
00420
00421 template<typename out_eT>
00422 template<typename in_T>
00423 inline
00424 Row<out_eT>
00425 conv_to< Row<out_eT> >::from(const itpp::Vec< std::complex<in_T> >& in)
00426 {
00427 arma_extra_debug_sigprint();
00428
00429 typedef std::complex<in_T> in_eT;
00430
00431 Row<out_eT> out(in.length());
00432
00433 const in_eT* in_mem = in._data();
00434 out_eT* out_mem = out.memptr();
00435
00436 for(u32 i=0; i<out.n_elem; ++i)
00437 {
00438 copy_complex_elem(out_mem[i], in_mem[i]);
00439 }
00440
00441 return out;
00442 }
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510 template<typename out_eT>
00511 class conv_to< Col<out_eT> >
00512 {
00513 public:
00514
00515 inline static Col<out_eT> from(const Mat< out_eT >& in);
00516
00517 template<typename in_eT>
00518 inline static Col<out_eT> from(const Mat< in_eT >& in);
00519
00520 template<typename in_T>
00521 inline static Col<out_eT> from(const Mat< std::complex<in_T> >& in);
00522
00523 template<typename in_eT, typename T1>
00524 inline static Col<out_eT> from(const Base<in_eT,T1>& in);
00525
00526
00527
00528 template<typename in_eT>
00529 inline static Col<out_eT> from(const itpp::Vec< in_eT >& in);
00530
00531 template<typename in_T>
00532 inline static Col<out_eT> from(const itpp::Vec< std::complex<in_T> >& in);
00533
00534
00535
00536
00537
00538 };
00539
00540
00541
00542 template<typename out_eT>
00543 inline
00544 Col<out_eT>
00545 conv_to< Col<out_eT> >::from(const Mat<out_eT>& in)
00546 {
00547 arma_extra_debug_sigprint();
00548
00549 arma_debug_check( (in.n_cols > 1), "conv_to<>: given matrix has more than one column");
00550 Col<out_eT> out(in.n_rows);
00551
00552 syslib::copy_elem(out.memptr(), in.mem, out.n_elem);
00553
00554 return out;
00555 }
00556
00557
00558
00559 template<typename out_eT>
00560 template<typename in_eT>
00561 inline
00562 Col<out_eT>
00563 conv_to< Col<out_eT> >::from(const Mat<in_eT>& in)
00564 {
00565 arma_extra_debug_sigprint();
00566
00567 arma_debug_check( (in.n_cols > 1), "conv_to<>: given matrix has more than one column");
00568 Col<out_eT> out(in.n_rows);
00569
00570 const in_eT* in_mem = in.mem;
00571 out_eT* out_mem = out.memptr();
00572
00573 for(u32 i=0; i<out.n_elem; ++i)
00574 {
00575 out_mem[i] = out_eT( in_mem[i] );
00576 }
00577
00578 return out;
00579 }
00580
00581
00582
00583 template<typename out_eT>
00584 template<typename in_T>
00585 inline
00586 Col<out_eT>
00587 conv_to< Col<out_eT> >::from(const Mat< std::complex<in_T> >& in)
00588 {
00589 arma_extra_debug_sigprint();
00590
00591 typedef std::complex<in_T> in_eT;
00592
00593 arma_debug_check( (in.n_cols > 1), "conv_to<>: given matrix has more than one column");
00594 Col<out_eT> out(in.n_rows);
00595
00596 const in_eT* in_mem = in.mem;
00597 out_eT* out_mem = out.memptr();
00598
00599 for(u32 i=0; i<out.n_elem; ++i)
00600 {
00601 copy_complex_elem(out_mem[i], in_mem[i]);
00602 }
00603
00604 return out;
00605 }
00606
00607
00608
00609 template<typename out_eT>
00610 template<typename in_eT, typename T1>
00611 inline
00612 Col<out_eT>
00613 conv_to< Col<out_eT> >::from(const Base<in_eT,T1>& in)
00614 {
00615 arma_extra_debug_sigprint();
00616
00617 const unwrap<T1> tmp(in.get_ref());
00618
00619 return conv_to< Col<out_eT> >::from( tmp.M );
00620 }
00621
00622
00623
00624 template<typename out_eT>
00625 template<typename in_eT>
00626 inline
00627 Col<out_eT>
00628 conv_to< Col<out_eT> >::from(const itpp::Vec<in_eT>& in)
00629 {
00630 arma_extra_debug_sigprint();
00631
00632 Col<out_eT> out(in.length());
00633
00634 const in_eT* in_mem = in._data();
00635 out_eT* out_mem = out.memptr();
00636
00637 for(u32 i=0; i<out.n_elem; ++i)
00638 {
00639 out_mem[i] = out_eT( in_mem[i] );
00640 }
00641
00642 return out;
00643 }
00644
00645
00646
00647 template<typename out_eT>
00648 template<typename in_T>
00649 inline
00650 Col<out_eT>
00651 conv_to< Col<out_eT> >::from(const itpp::Vec< std::complex<in_T> >& in)
00652 {
00653 arma_extra_debug_sigprint();
00654
00655 typedef std::complex<in_T> in_eT;
00656
00657 Col<out_eT> out(in.length());
00658
00659 const in_eT* in_mem = in._data();
00660 out_eT* out_mem = out.memptr();
00661
00662 for(u32 i=0; i<out.n_elem; ++i)
00663 {
00664 copy_complex_elem(out_mem[i], in_mem[i]);
00665 }
00666
00667 return out;
00668 }
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735 template<typename out_eT>
00736 class conv_to< itpp::Mat<out_eT> >
00737 {
00738 public:
00739
00740 inline static itpp::Mat<out_eT> from(const Mat< out_eT >& in);
00741
00742 inline static itpp::Mat<out_eT> from(const Col< out_eT >& in);
00743
00744 inline static itpp::Mat<out_eT> from(const Row< out_eT >& in);
00745
00746
00747
00748 template<typename in_eT>
00749 inline static itpp::Mat<out_eT> from(const Mat< in_eT >& in);
00750
00751 template<typename in_eT>
00752 inline static itpp::Mat<out_eT> from(const Col< in_eT >& in);
00753
00754 template<typename in_eT>
00755 inline static itpp::Mat<out_eT> from(const Row< in_eT >& in);
00756
00757
00758 template<typename in_T>
00759 inline static itpp::Mat<out_eT> from(const Mat< std::complex<in_T> >& in);
00760
00761 template<typename in_T>
00762 inline static itpp::Mat<out_eT> from(const Col< std::complex<in_T> >& in);
00763
00764 template<typename in_T>
00765 inline static itpp::Mat<out_eT> from(const Row< std::complex<in_T> >& in);
00766
00767
00768
00769 template<typename in_eT, typename T1>
00770 inline static itpp::Mat<out_eT> from(const Base<in_eT,T1>& in);
00771
00772 };
00773
00774
00775
00776 template<typename out_eT>
00777 inline
00778 itpp::Mat<out_eT>
00779 conv_to< itpp::Mat<out_eT> >::from(const Mat<out_eT>& in)
00780 {
00781 arma_extra_debug_sigprint();
00782
00783 itpp::Mat<out_eT> out(in.n_rows, in.n_cols);
00784
00785 syslib::copy_elem(out._data(), in.mem, in.n_elem);
00786
00787 return out;
00788 }
00789
00790
00791
00792 template<typename out_eT>
00793 inline
00794 itpp::Mat<out_eT>
00795 conv_to< itpp::Mat<out_eT> >::from(const Col<out_eT>& in)
00796 {
00797 arma_extra_debug_sigprint();
00798
00799 return conv_to< itpp::Mat<out_eT> >::from( reinterpret_cast<const Mat<out_eT>& >(in) );
00800 }
00801
00802
00803
00804 template<typename out_eT>
00805 inline
00806 itpp::Mat<out_eT>
00807 conv_to< itpp::Mat<out_eT> >::from(const Row<out_eT>& in)
00808 {
00809 arma_extra_debug_sigprint();
00810
00811 return conv_to< itpp::Mat<out_eT> >::from( reinterpret_cast<const Mat<out_eT>& >(in) );
00812 }
00813
00814
00815
00816 template<typename out_eT>
00817 template<typename in_eT>
00818 inline
00819 itpp::Mat<out_eT>
00820 conv_to< itpp::Mat<out_eT> >::from(const Mat<in_eT>& in)
00821 {
00822 arma_extra_debug_sigprint();
00823
00824 itpp::Mat<out_eT> out(in.n_rows, in.n_cols);
00825
00826 const in_eT* in_mem = in.memptr();
00827 out_eT* out_mem = out._data();
00828
00829 for(u32 i=0; i<in.n_elem; ++i)
00830 {
00831 out_mem[i] = out_eT( in_mem[i] );
00832 }
00833
00834 return out;
00835 }
00836
00837
00838
00839 template<typename out_eT>
00840 template<typename in_eT>
00841 inline
00842 itpp::Mat<out_eT>
00843 conv_to< itpp::Mat<out_eT> >::from(const Col<in_eT>& in)
00844 {
00845 arma_extra_debug_sigprint();
00846
00847 return conv_to< itpp::Mat<out_eT> >::from( reinterpret_cast<const Mat<in_eT>& >(in) );
00848 }
00849
00850
00851
00852 template<typename out_eT>
00853 template<typename in_eT>
00854 inline
00855 itpp::Mat<out_eT>
00856 conv_to< itpp::Mat<out_eT> >::from(const Row<in_eT>& in)
00857 {
00858 arma_extra_debug_sigprint();
00859
00860 return conv_to< itpp::Mat<out_eT> >::from( reinterpret_cast<const Mat<in_eT>& >(in) );
00861 }
00862
00863
00864
00865 template<typename out_eT>
00866 template<typename in_T>
00867 inline
00868 itpp::Mat<out_eT>
00869 conv_to< itpp::Mat<out_eT> >::from(const Mat< std::complex<in_T> >& in)
00870 {
00871 arma_extra_debug_sigprint();
00872
00873 typedef std::complex<in_T> in_eT;
00874
00875 itpp::Mat<out_eT> out(in.n_rows, in.n_cols);
00876
00877 const in_eT* in_mem = in.memptr();
00878 out_eT* out_mem = out._data();
00879
00880 for(u32 i=0; i<in.n_elem; ++i)
00881 {
00882 copy_complex_elem(out_mem[i], in_mem[i]);
00883 }
00884
00885 return out;
00886 }
00887
00888
00889
00890 template<typename out_eT>
00891 template<typename in_T>
00892 inline
00893 itpp::Mat<out_eT>
00894 conv_to< itpp::Mat<out_eT> >::from(const Col< std::complex<in_T> >& in)
00895 {
00896 arma_extra_debug_sigprint();
00897
00898 return conv_to< itpp::Mat<out_eT> >::from( reinterpret_cast<const Mat< std::complex<in_T> >& >(in) );
00899 }
00900
00901
00902
00903 template<typename out_eT>
00904 template<typename in_T>
00905 inline
00906 itpp::Mat<out_eT>
00907 conv_to< itpp::Mat<out_eT> >::from(const Row< std::complex<in_T> >& in)
00908 {
00909 arma_extra_debug_sigprint();
00910
00911 return conv_to< itpp::Mat<out_eT> >::from( reinterpret_cast<const Mat< std::complex<in_T> >& >(in) );
00912 }
00913
00914
00915
00916 template<typename out_eT>
00917 template<typename in_eT, typename T1>
00918 inline
00919 itpp::Mat<out_eT>
00920 conv_to< itpp::Mat<out_eT> >::from(const Base<in_eT,T1>& in)
00921 {
00922 arma_extra_debug_sigprint();
00923
00924 const unwrap<T1> tmp(in.get_ref());
00925
00926 return conv_to< itpp::Mat<out_eT> >::from( tmp.M );
00927 }
00928
00929
00930
00931
00932
00933
00934
00935 template<typename out_eT>
00936 class conv_to< itpp::Vec<out_eT> >
00937 {
00938 public:
00939
00940 inline static itpp::Vec<out_eT> from(const Mat< out_eT >& in);
00941
00942 template<typename in_eT>
00943 inline static itpp::Vec<out_eT> from(const Mat< in_eT >& in);
00944
00945 template<typename in_T>
00946 inline static itpp::Vec<out_eT> from(const Mat< std::complex<in_T> >& in);
00947
00948
00949
00950 template<typename in_eT>
00951 inline static itpp::Vec<out_eT> from(const Col< in_eT >& in);
00952
00953 template<typename in_eT>
00954 inline static itpp::Vec<out_eT> from(const Row< in_eT >& in);
00955
00956
00957
00958 template<typename in_T>
00959 inline static itpp::Vec<out_eT> from(const Col< std::complex<in_T> >& in);
00960
00961 template<typename in_T>
00962 inline static itpp::Vec<out_eT> from(const Row< std::complex<in_T> >& in);
00963
00964
00965
00966 template<typename in_eT, typename T1>
00967 inline static itpp::Vec<out_eT> from(const Base<in_eT,T1>& in);
00968 };
00969
00970
00971
00972 template<typename out_eT>
00973 inline
00974 itpp::Vec<out_eT>
00975 conv_to< itpp::Vec<out_eT> >::from(const Mat<out_eT>& in)
00976 {
00977 arma_extra_debug_sigprint();
00978
00979 arma_debug_check( ( (in.n_cols != 1) && (in.n_rows != 1) ), "conv_to<>: given matrix can't be interpreted as a vector");
00980
00981 itpp::Vec<out_eT> out(in.n_elem);
00982
00983 syslib::copy_elem(out._data(), in.mem, in.n_elem);
00984
00985 return out;
00986 }
00987
00988
00989
00990 template<typename out_eT>
00991 template<typename in_eT>
00992 inline
00993 itpp::Vec<out_eT>
00994 conv_to< itpp::Vec<out_eT> >::from(const Mat<in_eT>& in)
00995 {
00996 arma_extra_debug_sigprint();
00997
00998 arma_debug_check( ( (in.n_cols != 1) && (in.n_rows != 1) ), "conv_to<>: given matrix can't be interpreted as a vector");
00999 itpp::Vec<out_eT> out(in.n_elem);
01000
01001 const in_eT* in_mem = in.memptr();
01002 out_eT* out_mem = out._data();
01003
01004 for(u32 i=0; i<in.n_elem; ++i)
01005 {
01006 out_mem[i] = out_eT( in_mem[i] );
01007 }
01008
01009 return out;
01010 }
01011
01012
01013
01014 template<typename out_eT>
01015 template<typename in_T>
01016 inline
01017 itpp::Vec<out_eT>
01018 conv_to< itpp::Vec<out_eT> >::from(const Mat< std::complex<in_T> >& in)
01019 {
01020 arma_extra_debug_sigprint();
01021
01022 typedef std::complex<in_T> in_eT;
01023
01024 arma_debug_check( ( (in.n_cols != 1) && (in.n_rows != 1) ), "conv_to<>: given matrix can't be interpreted as a vector");
01025
01026 itpp::Vec<out_eT> out(in.n_elem);
01027
01028 const in_eT* in_mem = in.memptr();
01029 out_eT* out_mem = out._data();
01030
01031 for(u32 i=0; i<in.n_elem; ++i)
01032 {
01033 copy_complex_elem(out_mem[i], in_mem[i]);
01034 }
01035
01036 return out;
01037 }
01038
01039
01040
01041 template<typename out_eT>
01042 template<typename in_eT>
01043 inline
01044 itpp::Vec<out_eT>
01045 conv_to< itpp::Vec<out_eT> >::from(const Col<in_eT>& in)
01046 {
01047 arma_extra_debug_sigprint();
01048
01049 itpp::Vec<out_eT> out(in.n_elem);
01050
01051 const in_eT* in_mem = in.memptr();
01052 out_eT* out_mem = out._data();
01053
01054 for(u32 i=0; i<in.n_elem; ++i)
01055 {
01056 out_mem[i] = out_eT( in_mem[i] );
01057 }
01058
01059 return out;
01060 }
01061
01062
01063
01064 template<typename out_eT>
01065 template<typename in_T>
01066 inline
01067 itpp::Vec<out_eT>
01068 conv_to< itpp::Vec<out_eT> >::from(const Col< std::complex<in_T> >& in)
01069 {
01070 arma_extra_debug_sigprint();
01071
01072 typedef std::complex<in_T> in_eT;
01073
01074 itpp::Vec<out_eT> out(in.n_elem);
01075
01076 const in_eT* in_mem = in.memptr();
01077 out_eT* out_mem = out._data();
01078
01079 for(u32 i=0; i<in.n_elem; ++i)
01080 {
01081 copy_complex_elem(out_mem[i], in_mem[i]);
01082 }
01083
01084 return out;
01085 }
01086
01087
01088
01089 template<typename out_eT>
01090 template<typename in_eT>
01091 inline
01092 itpp::Vec<out_eT>
01093 conv_to< itpp::Vec<out_eT> >::from(const Row<in_eT>& in)
01094 {
01095 arma_extra_debug_sigprint();
01096
01097 itpp::Vec<out_eT> out(in.n_elem);
01098
01099 const in_eT* in_mem = in.memptr();
01100 out_eT* out_mem = out._data();
01101
01102 for(u32 i=0; i<in.n_elem; ++i)
01103 {
01104 out_mem[i] = out_eT( in_mem[i] );
01105 }
01106
01107 return out;
01108 }
01109
01110
01111
01112 template<typename out_eT>
01113 template<typename in_T>
01114 inline
01115 itpp::Vec<out_eT>
01116 conv_to< itpp::Vec<out_eT> >::from(const Row< std::complex<in_T> >& in)
01117 {
01118 arma_extra_debug_sigprint();
01119
01120 typedef std::complex<in_T> in_eT;
01121
01122 itpp::Vec<out_eT> out(in.n_elem);
01123
01124 const in_eT* in_mem = in.memptr();
01125 out_eT* out_mem = out._data();
01126
01127 for(u32 i=0; i<in.n_elem; ++i)
01128 {
01129 copy_complex_elem(out_mem[i], in_mem[i]);
01130 }
01131
01132 return out;
01133 }
01134
01135
01136
01137 template<typename out_eT>
01138 template<typename in_eT, typename T1>
01139 inline
01140 itpp::Vec<out_eT>
01141 conv_to< itpp::Vec<out_eT> >::from(const Base<in_eT,T1>& in)
01142 {
01143 arma_extra_debug_sigprint();
01144
01145 const unwrap<T1> tmp(in.get_ref());
01146
01147 return conv_to< itpp::Vec<out_eT> >::from( tmp.M );
01148 }
01149
01150
01151