Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
362d4ab8
提交
362d4ab8
authored
6月 12, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix compilation on the GPU.
上级
1f3ace65
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
13 行删除
+12
-13
basic_scipy.py
theano/scalar/basic_scipy.py
+12
-13
没有找到文件。
theano/scalar/basic_scipy.py
浏览文件 @
362d4ab8
...
@@ -353,15 +353,15 @@ class Chi2SF(BinaryScalarOp):
...
@@ -353,15 +353,15 @@ class Chi2SF(BinaryScalarOp):
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
Table of Factorials/Gamma Values
Table of Factorials/Gamma Values
----------------------------------------------------------------------*/
----------------------------------------------------------------------*/
static double _facts[MAXFACT+1] = { 0 };
DEVICE
static double _facts[MAXFACT+1] = { 0 };
static double _logfs[MAXFACT+1];
DEVICE
static double _logfs[MAXFACT+1];
static double _halfs[MAXFACT+1];
DEVICE
static double _halfs[MAXFACT+1];
static double _loghs[MAXFACT+1];
DEVICE
static double _loghs[MAXFACT+1];
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
Functions
Functions
----------------------------------------------------------------------*/
----------------------------------------------------------------------*/
static void _init (void)
DEVICE
static void _init (void)
{ /* --- init. factorial tables */
{ /* --- init. factorial tables */
int i; /* loop variable */
int i; /* loop variable */
double x = 1; /* factorial */
double x = 1; /* factorial */
...
@@ -407,7 +407,7 @@ class Chi2SF(BinaryScalarOp):
...
@@ -407,7 +407,7 @@ class Chi2SF(BinaryScalarOp):
#else /*--------------------------------------------------------------*/
#else /*--------------------------------------------------------------*/
double logGamma (double n)
DEVICE
double logGamma (double n)
{ /* --- compute ln(Gamma(n)) */
{ /* --- compute ln(Gamma(n)) */
double s; /* = ln((n-1)!), n
\
in IN */
double s; /* = ln((n-1)!), n
\
in IN */
...
@@ -453,7 +453,7 @@ class Chi2SF(BinaryScalarOp):
...
@@ -453,7 +453,7 @@ class Chi2SF(BinaryScalarOp):
in the second version, the value is slightly more accurate.
in the second version, the value is slightly more accurate.
----------------------------------------------------------------------*/
----------------------------------------------------------------------*/
double Gamma (double n)
DEVICE
double Gamma (double n)
{ /* --- compute Gamma(n) = (n-1)! */
{ /* --- compute Gamma(n) = (n-1)! */
assert(n > 0); /* check the function argument */
assert(n > 0); /* check the function argument */
if (_facts[0] <= 0) _init(); /* initialize the tables */
if (_facts[0] <= 0) _init(); /* initialize the tables */
...
@@ -468,7 +468,7 @@ class Chi2SF(BinaryScalarOp):
...
@@ -468,7 +468,7 @@ class Chi2SF(BinaryScalarOp):
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static double _series (double n, double x)
DEVICE
static double _series (double n, double x)
{ /* --- series approximation */
{ /* --- series approximation */
int i; /* loop variable */
int i; /* loop variable */
double t, sum; /* buffers */
double t, sum; /* buffers */
...
@@ -494,7 +494,7 @@ class Chi2SF(BinaryScalarOp):
...
@@ -494,7 +494,7 @@ class Chi2SF(BinaryScalarOp):
The factor exp(n *log(x) -x) is added in the functions below.
The factor exp(n *log(x) -x) is added in the functions below.
----------------------------------------------------------------------*/
----------------------------------------------------------------------*/
static double _cfrac (double n, double x)
DEVICE
static double _cfrac (double n, double x)
{ /* --- continued fraction approx. */
{ /* --- continued fraction approx. */
int i; /* loop variable */
int i; /* loop variable */
double a, b, c, d, e, f; /* buffers */
double a, b, c, d, e, f; /* buffers */
...
@@ -526,7 +526,7 @@ class Chi2SF(BinaryScalarOp):
...
@@ -526,7 +526,7 @@ class Chi2SF(BinaryScalarOp):
The factor exp(n *log(x) -x) is added in the functions below.
The factor exp(n *log(x) -x) is added in the functions below.
----------------------------------------------------------------------*/
----------------------------------------------------------------------*/
double lowerGamma (double n, double x)
DEVICE
double lowerGamma (double n, double x)
{ /* --- lower incomplete Gamma fn. */
{ /* --- lower incomplete Gamma fn. */
assert((n > 0) && (x > 0)); /* check the function arguments */
assert((n > 0) && (x > 0)); /* check the function arguments */
return _series(n, x) *exp(n *log(x) -x);
return _series(n, x) *exp(n *log(x) -x);
...
@@ -534,7 +534,7 @@ class Chi2SF(BinaryScalarOp):
...
@@ -534,7 +534,7 @@ class Chi2SF(BinaryScalarOp):
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
double upperGamma (double n, double x)
DEVICE
double upperGamma (double n, double x)
{ /* --- upper incomplete Gamma fn. */
{ /* --- upper incomplete Gamma fn. */
assert((n > 0) && (x > 0)); /* check the function arguments */
assert((n > 0) && (x > 0)); /* check the function arguments */
return _cfrac(n, x) *exp(n *log(x) -x);
return _cfrac(n, x) *exp(n *log(x) -x);
...
@@ -542,8 +542,7 @@ class Chi2SF(BinaryScalarOp):
...
@@ -542,8 +542,7 @@ class Chi2SF(BinaryScalarOp):
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
DEVICE double GammaP (double n, double x)
double GammaP (double n, double x)
{ /* --- regularized Gamma function P */
{ /* --- regularized Gamma function P */
assert((n > 0) && (x >= 0)); /* check the function arguments */
assert((n > 0) && (x >= 0)); /* check the function arguments */
if (x <= 0) return 0; /* treat x = 0 as a special case */
if (x <= 0) return 0; /* treat x = 0 as a special case */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论