Classes | |
class | op_rand |
'generate matrix with random values' operation More... | |
Functions | |
template<typename eT > | |
static void | op_rand::direct_rand (eT *x, const u32 n_elem) |
TODO: optionally use the Marsenne-Twister random number generator (see Boost). | |
template<typename T > | |
static void | op_rand::direct_rand (std::complex< T > *x, const u32 n_elem) |
template<typename eT > | |
static void | op_rand::apply (Mat< eT > &out, const Op< Mat< eT >, op_rand > &in) |
template<typename eT > | |
static void | op_rand::apply (Mat< eT > &out, const Op< Col< eT >, op_rand > &in) |
template<typename eT > | |
static void | op_rand::apply (Mat< eT > &out, const Op< Row< eT >, op_rand > &in) |
template<typename eT > | |
static void | op_rand::apply (Col< eT > &out, const Op< Col< eT >, op_rand > &in) |
template<typename eT > | |
static void | op_rand::apply (Row< eT > &out, const Op< Row< eT >, op_rand > &in) |
void op_rand::direct_rand | ( | eT * | x, | |
const u32 | n_elem | |||
) | [inline, static, private, inherited] |
TODO: optionally use the Marsenne-Twister random number generator (see Boost).
Definition at line 24 of file op_rand_meat.hpp.
References rand().
Referenced by apply().
00025 { 00026 arma_extra_debug_sigprint(); 00027 00028 for(u32 i=0; i<n_elem; ++i) 00029 { 00030 x[i] = eT(std::rand()) / eT(RAND_MAX); 00031 } 00032 00033 00034 }
void op_rand::direct_rand | ( | std::complex< T > * | x, | |
const u32 | n_elem | |||
) | [inline, static, private, inherited] |
Definition at line 41 of file op_rand_meat.hpp.
References rand().
00042 { 00043 arma_extra_debug_sigprint(); 00044 00045 for(u32 i=0; i<n_elem; ++i) 00046 { 00047 const T a = T(std::rand()) / T(RAND_MAX); 00048 const T b = T(std::rand()) / T(RAND_MAX); 00049 00050 x[i] = std::complex<T>(a,b); 00051 } 00052 00053 00054 }
void op_rand::apply | ( | Mat< eT > & | out, | |
const Op< Mat< eT >, op_rand > & | in | |||
) | [inline, static, inherited] |
Definition at line 61 of file op_rand_meat.hpp.
References direct_rand(), Mat< eT >::memptr(), Mat< eT >::n_elem, and Mat< eT >::set_size().
00062 { 00063 arma_extra_debug_sigprint(); 00064 00065 const u32 n_rows = in.aux_u32_a; 00066 const u32 n_cols = (in.aux_u32_b > 0) ? in.aux_u32_b : 1; 00067 00068 out.set_size(n_rows, n_cols); 00069 00070 op_rand::direct_rand(out.memptr(), out.n_elem); 00071 }
void op_rand::apply | ( | Mat< eT > & | out, | |
const Op< Col< eT >, op_rand > & | in | |||
) | [inline, static, inherited] |
Definition at line 78 of file op_rand_meat.hpp.
References direct_rand(), Mat< eT >::memptr(), Mat< eT >::n_elem, and Mat< eT >::set_size().
00079 { 00080 arma_extra_debug_sigprint(); 00081 00082 out.set_size(in.aux_u32_a, 1); 00083 00084 op_rand::direct_rand(out.memptr(), out.n_elem); 00085 }
void op_rand::apply | ( | Mat< eT > & | out, | |
const Op< Row< eT >, op_rand > & | in | |||
) | [inline, static, inherited] |
Definition at line 92 of file op_rand_meat.hpp.
References direct_rand(), Mat< eT >::memptr(), Mat< eT >::n_elem, and Mat< eT >::set_size().
00093 { 00094 arma_extra_debug_sigprint(); 00095 00096 out.set_size(1, in.aux_u32_a); 00097 00098 op_rand::direct_rand(out.memptr(), out.n_elem); 00099 }
void op_rand::apply | ( | Col< eT > & | out, | |
const Op< Col< eT >, op_rand > & | in | |||
) | [inline, static, inherited] |
Definition at line 106 of file op_rand_meat.hpp.
References direct_rand(), Mat< eT >::memptr(), Mat< eT >::n_elem, and Col< eT >::set_size().
00107 { 00108 arma_extra_debug_sigprint(); 00109 00110 out.set_size(in.aux_u32_a); 00111 00112 op_rand::direct_rand(out.memptr(), out.n_elem); 00113 }
void op_rand::apply | ( | Row< eT > & | out, | |
const Op< Row< eT >, op_rand > & | in | |||
) | [inline, static, inherited] |
Definition at line 120 of file op_rand_meat.hpp.
References direct_rand(), Mat< eT >::memptr(), Mat< eT >::n_elem, and Row< eT >::set_size().
00121 { 00122 arma_extra_debug_sigprint(); 00123 00124 out.set_size(in.aux_u32_a); 00125 00126 op_rand::direct_rand(out.memptr(), out.n_elem); 00127 }