/* Copyright (c) 2007 Takahiro Shinozaki Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // This is a demo program of CV-EM and Ag-EM algorithms and is written in // MaTX language. It trains GMM using the algorithms and evaluates it. The // details of the algorithms are found at // http://www.furui.cs.titech.ac.jp/~shinot // // To compile this program, MaTX is required. MaTX is a freeware whose // language syntax is somewhat similar to matlab. Assuming that MaTX is // installed, run the following command to make an executable binary: // % matc gmmcvagem.mm // where % is the command line prompt. // // If MaTX is not installed to the standard place, you might need to specify // matc library and include directories. For example, // % matc gmmcvagem.mm -LMaTX/lib/ -IMaTX/include/ // assuming that MaTX library and include directories are at MaTX/lib/ // and MaTX/include/. // // After the compilation, this program is run by // ./gmmcvagem // See the usage printed by the command for more details. Integer maxint; Integer warnlv; Matrix llresults; // Return Gaussian likelihood Func Real gcprob(m, v, x) Real m, v; Real x; { Real prob; prob = 1/sqrt(2*PI*v)*exp( -(x-m)^2/(2*v) ); if (0