fn_diagmat.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 template<typename eT, typename T1>
00022 inline
00023 const Op<T1, op_diagmat>
00024 diagmat(const Base<eT,T1>& X)
00025 {
00026 arma_extra_debug_sigprint();
00027
00028 return Op<T1, op_diagmat>(X.get_ref());
00029 }
00030
00031
00032
00033
00034 template<typename eT>
00035 inline
00036 const Op<Mat<eT>, op_diagmat_vec>
00037 diagmat(const Col<eT>& X)
00038 {
00039 arma_extra_debug_sigprint();
00040
00041 return Op<Mat<eT>, op_diagmat_vec>(X);
00042 }
00043
00044
00045
00046
00047 template<typename eT>
00048 inline
00049 const Op<Mat<eT>, op_diagmat_vec>
00050 diagmat(const Row<eT>& X)
00051 {
00052 arma_extra_debug_sigprint();
00053
00054 return Op<Mat<eT>, op_diagmat_vec>(X);
00055 }
00056
00057
00058
00059
00060 template<typename eT>
00061 inline
00062 Mat<eT>
00063 diagmat(const subview_col<eT>& X)
00064 {
00065 arma_extra_debug_sigprint();
00066
00067 Mat<eT> out;
00068 out.zeros(X.n_elem, X.n_elem);
00069
00070 for(u32 i=0; i<X.n_elem; ++i)
00071 {
00072 out.at(i,i) = X[i];
00073 }
00074
00075 return out;
00076 }
00077
00078
00079
00080
00081 template<typename eT>
00082 inline
00083 Mat<eT>
00084 diagmat(const subview_row<eT>& X)
00085 {
00086 arma_extra_debug_sigprint();
00087
00088 Mat<eT> out;
00089 out.zeros(X.n_elem, X.n_elem);
00090
00091 for(u32 i=0; i<X.n_elem; ++i)
00092 {
00093 out.at(i,i) = X[i];
00094 }
00095
00096 return out;
00097 }
00098
00099
00100
00101
00102 template<typename eT>
00103 inline
00104 Mat<eT>
00105 diagmat(const diagview<eT>& X)
00106 {
00107 arma_extra_debug_sigprint();
00108
00109 Mat<eT> out;
00110 out.zeros(X.n_elem, X.n_elem);
00111
00112 for(u32 i=0; i<X.n_elem; ++i)
00113 {
00114 out.at(i,i) = X[i];
00115 }
00116
00117 return out;
00118 }
00119
00120
00121
00122
00123 template<typename T1>
00124 inline
00125 const Op<T1, op_diagmat>&
00126 diagmat(const Op<T1, op_diagmat>& X)
00127 {
00128 arma_extra_debug_sigprint();
00129 arma_extra_debug_print("diagmat(): two consecutive diagmat() operations detected");
00130
00131 return X;
00132 }
00133
00134
00135
00136