Qualia  0.2
log_add.h
Go to the documentation of this file.
1 /*
2  * log_add.h
3  *
4  * This file is part of Qualia https://github.com/sofian/qualia
5  *
6  * (c) 2011 Sofian Audry -- info(@)sofianaudry(.)com
7  *
8  * Adapted from Torch 3.1 library
9  * Copyright (C) 2003--2004 Samy Bengio (bengio@idiap.ch)
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 #ifndef LOG_ADD_INC
25 #define LOG_ADD_INC
26 
27 #include <qualia/core/common.h>
28 
29 #include <math.h>
30 
31 #ifndef log1p
32 #warning "log1p is not defined in this environment which might result in problems on your system"
33 #define log1p(x) log(1+(x))
34 #endif
35 
41 #define LOG_2_PI 1.83787706640934548355
42 #define LOG_ZERO -INF
43 #define LOG_ONE 0
44 
49 real logAdd(real log_a,real log_b);
50 
52 real logSub(real log_a,real log_b);
54 
55 #endif