root/projects/AsynCluster/trunk/svpmc/sample.c

Revision 168, 1.2 kB (checked in by edsuom, 7 months ago)

Got model unit testing working again; more complete unit testing of params; general cleanup

Line 
1 /* svPMC: Stochastic Volatility Inference via Population Monte Carlo
2   
3    Copyright (C) 2007-2008 by Edwin A. Suominen, http://www.eepatents.com
4   
5    This program is free software; you can redistribute it and/or modify it under
6    the terms of the GNU General Public License as published by the Free Software
7    Foundation; either version 2 of the License, or (at your option) any later
8    version.
9   
10    This program is distributed in the hope that it will be useful, but WITHOUT
11    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12    FOR A PARTICULAR PURPOSE.  See the file COPYING for more details.
13   
14    You should have received a copy of the GNU General Public License along with
15    this program; if not, write to the Free Software Foundation, Inc., 51
16    Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19
20 // Resampler.__call__
21 //
22 // Supplied variables
23 // ----------------------------------------------------------------------------
24 // 'x', 'a', 'b'
25
26 int ja = Na[0] - 1;
27 int jb = Nb[0] - 1;
28 int ka, kb;
29 while (ja >= 0 && jb >= 0) {
30   ka = A1(ja);
31   kb = B1(jb);
32   X2(ka,1) = kb;
33   X2(kb,0) = X2(kb,0) + X2(ka,0) - 1.0;
34   if (X2(kb,0) < 1) {
35     A1(ja) = kb;
36     jb--;
37   } else {
38     ja--;
39   }
40 }
Note: See TracBrowser for help on using the browser.