📄 gaus_06.cc
字号:
// file: $isip/class/stat/GaussianModel/gaus_06.cc// version: $Id: gaus_06.cc,v 1.6 2001/12/26 22:32:34 alphonso Exp $//// system include files//#include <typeinfo>// isip include files//#include "GaussianModel.h"// method: eq//// arguments:// const GaussianModel& arg: (input) dat ato copy//// return: a boolean value - true if objects are equivalent, false otherwise//// check whether the gaussian models are equal. this is a pure equality// method so the means and covariances must be exactly equal.//boolean GaussianModel::eq(const GaussianModel& arg_a) const { // check the mean vectors // if (!mean_d.eq(arg_a.mean_d)) { return false; } // if the objects are in the same initialization state, // we can compare them directly // if ((mode_d == NONE) && (arg_a.mode_d == NONE)) { return covariance_d.eq(arg_a.covariance_d); } if ((mode_d == PRECOMPUTE) && (arg_a.mode_d == PRECOMPUTE) && (is_valid_d == arg_a.is_valid_d)) { return covariance_d.eq(arg_a.covariance_d); } // if the covariance matrices have not been inverted, invert them. // it is better to compare inverted matrices in this case, // since restoring an inverted matrix is prone to numerical error. // MatrixFloat tmp_0(covariance_d); if ((mode_d == NONE) || (!is_valid_d)) { tmp_0.inverse(); } MatrixFloat tmp_1(arg_a.covariance_d); if ((arg_a.mode_d == NONE) || (!arg_a.is_valid_d)) { tmp_1.inverse(); } // now we can check the matrices // return tmp_0.eq(tmp_1);}// method: eq//// arguments:// const StatisticalModelBase& arg: (input) object to test//// return: a boolean value indicating equality//// this method is part of the StatisticalModelBase interface contract// which compares two virtual model types//boolean GaussianModel::eq(const StatisticalModelBase& arg_a) const { if (typeid(arg_a) == typeid(GaussianModel)) { return eq((GaussianModel&)arg_a); } else { return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -