logs.h
来自「EM算法的改进」· C头文件 代码 · 共 68 行
H
68 行
/* * $Id: logs.h 1339 2006-09-21 19:46:28Z tbailey $ * * $Log$ * Revision 1.2 2005/10/06 22:52:19 nadya * redefine cast because some SUN compilers cant reduce expression inside define * * Revision 1.1.1.1 2005/07/29 18:41:32 nadya * Importing from meme-3.0.14, and adding configure/make * *//************************************************************************ ** MEME++ ** Copyright 1994, The Regents of the University of California ** Author: Timothy L. Bailey ** ************************************************************************/#ifndef logs_h# define logs_h#include <macros.h>/* table of log(x) for 0 < x <= 2 */#define log_precision 1.0e5EXTERN double log_table[2*(int)log_precision+2]; /* leave room for n+1 *//* local variable to prevent enormous expansion of macros */EXTERN double _logl_x; /* log lookup function; use linear interpolation */#define LOGL_Y(x) ((x) * log_precision)#define LOGL_I(x) ((int) LOGL_Y(x))#define LOGL_LOW(x) (log_table[LOGL_I(x)])#define LOGL_HI(x) (log_table[LOGL_I(x) + 1])#define LOGL(x) (_logl_x = (x), LOGL_LOW(_logl_x) + \ (LOGL_Y(_logl_x) - LOGL_I(_logl_x)) * \ (LOGL_HI(_logl_x) - LOGL_LOW(_logl_x)))#define exp_precision 1.0e3EXTERN double exp_table[(int)BITS*(int)exp_precision+2]; /* leave room for n+1 *//* local variable to prevent enormous expansion of macros */EXTERN double _expl_x;/* exp lookup function; use linear interpolation */#define EXPL_Y(x) (-(x) * exp_precision)#define EXPL_I(x) ((int) EXPL_Y(x))#define EXPL_LOW(x) (exp_table[EXPL_I(x)])#define EXPL_HI(x) (exp_table[EXPL_I(x) + 1])#define EXPL(x) (_expl_x = (x), EXPL_LOW(_expl_x) + \ (EXPL_Y(_expl_x) - EXPL_I(_expl_x)) * \ (EXPL_HI(_expl_x) - EXPL_LOW(_expl_x)))/* used for summing logarithms: log(x + y) where log(x) and log(y) are avail.*/#define LOGL_SUM1(logx,logy) \ (((((logy)<=LOGZERO) || ((logx)-(logy))>BITS)) ? \ (logx) : (logx) + LOGL( 1 + EXPL((logy) - (logx) ) ) )#define LOGL_SUM(logx, logy) ( ( (logx) > (logy) ) ? \ LOGL_SUM1( (logx), (logy) ) : LOGL_SUM1( (logy), (logx) ) )/* function prototypes */extern void init_log(void);extern void init_exp(void);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?