fn_ones.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
00022
00023 inline
00024 const Op<mat,op_ones_full>
00025 ones(const u32 n_rows, const u32 n_cols)
00026 {
00027 arma_extra_debug_sigprint();
00028
00029 return Op<mat,op_ones_full>(n_rows, n_cols, 'j');
00030 }
00031
00032
00033
00034 template<typename mat_type>
00035 inline
00036 const Op<mat_type,op_ones_full>
00037 ones(const u32 n_rows, const u32 n_cols)
00038 {
00039 arma_extra_debug_sigprint();
00040
00041 arma_type_check<is_Mat<mat_type>::value == false>::apply();
00042
00043 return Op<mat_type,op_ones_full>(n_rows, n_cols, 'j');
00044 }
00045
00046
00047
00048
00049 inline
00050 const Op<colvec, op_ones_full>
00051 ones(const u32 n_elem)
00052 {
00053 arma_extra_debug_sigprint();
00054
00055 return Op<colvec, op_ones_full>(n_elem, 1, 'j');
00056 }
00057
00058
00059
00060 template<typename vec_type>
00061 inline
00062 const Op<vec_type, op_ones_full>
00063 ones(const u32 n_elem)
00064 {
00065 arma_extra_debug_sigprint();
00066
00067 arma_type_check< (is_Col<vec_type>::value == false) && (is_Row<vec_type>::value == false) >::apply();
00068
00069 if(is_Row<vec_type>::value == true)
00070 {
00071 return Op<vec_type, op_ones_full>(1, n_elem, 'j');
00072 }
00073 else
00074 {
00075 return Op<vec_type, op_ones_full>(n_elem, 1, 'j');
00076 }
00077 }
00078
00079
00080
00081
00082 inline
00083 const Op<mat,op_ones_diag>
00084 eye(const u32 n_rows, const u32 n_cols)
00085 {
00086 arma_extra_debug_sigprint();
00087
00088 return Op<mat,op_ones_diag>(n_rows, n_cols, 'j');
00089 }
00090
00091
00092
00093 template<typename mat_type>
00094 inline
00095 const Op<mat_type,op_ones_diag>
00096 eye(const u32 n_rows, const u32 n_cols)
00097 {
00098 arma_extra_debug_sigprint();
00099
00100 arma_type_check<is_Mat_only<mat_type>::value == false>::apply();
00101
00102 return Op<mat_type,op_ones_diag>(n_rows, n_cols, 'j');
00103 }
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 inline
00117 const OpCube<cube,op_ones_full>
00118 ones(const u32 n_rows, const u32 n_cols, const u32 n_slices)
00119 {
00120 arma_extra_debug_sigprint();
00121
00122 return OpCube<cube,op_ones_full>(n_rows, n_cols, n_slices);
00123 }
00124
00125
00126
00127 template<typename cube_type>
00128 inline
00129 const OpCube<cube_type,op_ones_full>
00130 ones(const u32 n_rows, const u32 n_cols, const u32 n_slices)
00131 {
00132 arma_extra_debug_sigprint();
00133
00134 arma_type_check<is_Cube<cube_type>::value == false>::apply();
00135
00136 return OpCube<cube_type,op_ones_full>(n_rows, n_cols, n_slices);
00137 }
00138
00139
00140
00141