📄 mvec_08.cc
字号:
// file: $isip/class/math/vector/MVector/mvec_08.cc// version: $Id: mvec_08.cc,v 1.5 2000/10/09 01:02:02 duncan Exp $//// isip include files//#include "MVectorMethods.h"#include "MVector.h"// method: rand//// arguments:// MVector<TScalar, TIntegral>& this: (output) class operand// Random& generator: (input) random number generator//// return: a boolean value indicating status//// this method initializes each element of the vector with a uniformly// distributed random value//template<class TScalar, class TIntegral>boolean MVectorMethods::rand(MVector<TScalar, TIntegral>& this_a, Random& generator_a) { // loop over all elements // long last_index = (long)this_a.length_d; for (long index = 0; index < last_index; index++) { this_a.v_d[index].rand(generator_a); } // return the value // return true;}// explicit instantiations//template booleanMVectorMethods::rand<ISIP_TEMPLATE_TARGET>(MVector<ISIP_TEMPLATE_TARGET>&, Random&);// method: rand//// arguments:// MVector<TScalar, TIntegral>& this: (output) class operand// TIntegral min: (input) min value// TIntegral max: (input) max value// Random& generator: (input) random number generator//// return: a boolean value indicating status//// this method initializes each element of the vector with a uniformly// distributed random value between min_a and max_a//template<class TScalar, class TIntegral>boolean MVectorMethods::rand(MVector<TScalar, TIntegral>& this_a, TIntegral min_a, TIntegral max_a, Random& generator_a) { long last_index = (long)this_a.length_d; // process vector piecewise // for (long index = 0; index < last_index; index++) { this_a.v_d[index].rand(min_a, max_a, generator_a); } // exit gracefully // return true;}// explicit instantiations//template boolean MVectorMethods::rand<ISIP_TEMPLATE_TARGET>(MVector<ISIP_TEMPLATE_TARGET>&, ISIP_TEMPLATE_T1, ISIP_TEMPLATE_T1, Random&);// method: grand//// arguments:// MVector<TScalar, TIntegral>& this: (output) class operand// TIntegral mean: (input) mean value// TIntegral stdev: (input) standard deviation// Random& generator: (input) random number generator//// return: a boolean value indicating status//// this method initializes each element of the vector with a uniformly// distributed gaussian random value between min_a and max_a//template<class TScalar, class TIntegral>boolean MVectorMethods::grand(MVector<TScalar, TIntegral>& this_a, TIntegral mean_a, TIntegral stdev_a, Random& generator_a) { long last_index = (long)this_a.length_d; // process vector piecewise // for (long index = 0; index < last_index; index++) { this_a.v_d[index].grand(mean_a, stdev_a, generator_a); } // exit gracefully // return true;}// explicit instantiations//template boolean MVectorMethods::grand<ISIP_TEMPLATE_TARGET>(MVector<ISIP_TEMPLATE_TARGET>&, ISIP_TEMPLATE_T1, ISIP_TEMPLATE_T1, Random&);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -