1 /* Copyright (C) 2006-2008 Joris Mooij [j dot mooij at science dot ru dot nl]
2 Radboud University Nijmegen, The Netherlands
4 This file is part of libDAI.
6 libDAI is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 libDAI is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with libDAI; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef __defined_libdai_x2x_h
23 #define __defined_libdai_x2x_h
32 // Probability tables store -1 first, then +1
34 /// Convert moments to cumulants upto order k
35 void m2c (int N
, double *x
, int k
);
37 /// Convert cumulants to moments upto order k
38 void c2m (int N
, double *x
, int k
);
40 /// Convert (generalized) weights to log probability or energy
41 void w2logp (int N
, double *x
);
43 /// Convert log probability or energy to (generalized) weights
44 void logp2w (int N
, double *x
);
46 /// Convert probability to moments
47 void p2m (int N
, double *x
);
49 /// Convert moments to probability
50 void m2p (int N
, double *x
);
52 /// Convert log probability to probability
53 void logp2p (int N
, double *x
);
55 /// Convert probability to log probability
56 void p2logp (int N
, double *x
);
58 /// Normalize a log probability table
59 void logpnorm (int N
, double *x
);
61 /// Normalize a probability table, use logpnorm whenever possible
62 void pnorm (int N
, double *x
);
64 /// Fills table with v for all entries with more than k indices
65 /// used for example when cumulants or moments are converted upto some order
66 void fill (int N
, double *x
, int k
, double v
);
68 } // end of namespace x2x