// file: $isip/class/stats/MixtureModel/mm_06.cc // version: $Id: mm_06.cc 6113 2000-12-29 18:40:28Z peng $ // // system include files // #include // isip include files // #include "MixtureModel.h" // method: eq // // arguments: // const MixtureModel& arg: (input) object to compare // // return: true if objects are equal, false otherwise // // check the equality of input model to current model // bool8 MixtureModel::eq(const MixtureModel& arg_a) const { // check models // if (!models_d.eq(arg_a.models_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 weights_d.eq(arg_a.weights_d); } if ((mode_d == PRECOMPUTE) && (arg_a.mode_d == PRECOMPUTE) && (is_valid_d == arg_a.is_valid_d)) { return weights_d.eq(arg_a.weights_d); } // otherwise, compare the weights on a log scale // VectorFloat tmp_0(weights_d); if ((mode_d == NONE) || (!is_valid_d)) { tmp_0.log(); } VectorFloat tmp_1(arg_a.weights_d); if ((arg_a.mode_d == NONE) || (!arg_a.is_valid_d)) { tmp_1.log(); } // exit gracefully // return tmp_0.eq(tmp_1); } // method: eq // // arguments: // const StatisticalModelBase& arg: (input) object to compare // // return: true if objects are equal, false otherwise // // this method fulfills the StatisticalModelBase interface contract // bool8 MixtureModel::eq(const StatisticalModelBase& arg_a) const { if (typeid(arg_a) == typeid(MixtureModel)) { return eq((MixtureModel&)arg_a); } else { return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__); } }