⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genlogs.c

📁 一个简洁好用的SVM代码
💻 C
字号:
/*************************************************************************/

/*									 */

/*	Tabluate logs and log factorials (to improve speed)		 */

/*	--------------------------------				 */

/*									 */

/*************************************************************************/





#include "defns.i"

#include "types.i"

#include "extern.i"





float	*LogItemNo;

double	*LogFact;





/*************************************************************************/

/*									 */

/*  Set up the array LogItemNo to contain the logs of integers and	 */

/*  the array LogFact to contain logs of factorials (all to base 2)	 */

/*									 */

/*************************************************************************/





    GenerateLogs()

/*  ------------  */

{

    ItemNo i;



    LogItemNo = (float *) malloc((MaxItem+100) * sizeof(float));

    LogFact = (double *) malloc((MaxItem+100) * sizeof(double));



    LogItemNo[0] = -1E38;

    LogItemNo[1] = 0;

    LogFact[0] = LogFact[1] = 0;



    ForEach(i, 2, MaxItem+99)

    {

	LogItemNo[i] = log((float) i) / Log2;

	LogFact[i] = LogFact[i-1] + LogItemNo[i];

    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -