Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a8e0adcb
提交
a8e0adcb
authored
5月 25, 2023
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
5月 25, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove stubborn spectral_radius_bound
Supposed to be removed in
6d431aa6
上级
99a040cc
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
2 行增加
和
35 行删除
+2
-35
linalg.py
pytensor/tensor/rewriting/linalg.py
+2
-35
没有找到文件。
pytensor/tensor/rewriting/linalg.py
浏览文件 @
a8e0adcb
...
...
@@ -4,10 +4,8 @@ from pytensor.graph.rewriting.basic import node_rewriter
from
pytensor.tensor
import
basic
as
at
from
pytensor.tensor.blas
import
Dot22
from
pytensor.tensor.elemwise
import
DimShuffle
from
pytensor.tensor.math
import
Dot
,
Prod
,
dot
,
log
from
pytensor.tensor.math
import
pow
as
at_pow
from
pytensor.tensor.math
import
prod
from
pytensor.tensor.nlinalg
import
Det
,
MatrixInverse
,
trace
from
pytensor.tensor.math
import
Dot
,
Prod
,
log
,
prod
from
pytensor.tensor.nlinalg
import
Det
,
MatrixInverse
from
pytensor.tensor.rewriting.basic
import
(
register_canonicalize
,
register_specialize
,
...
...
@@ -191,34 +189,3 @@ def local_log_prod_sqr(fgraph, node):
# TODO: have a reduction like prod and sum that simply
# returns the sign of the prod multiplication.
def
spectral_radius_bound
(
X
,
log2_exponent
):
"""
Returns upper bound on the largest eigenvalue of square symmetric matrix X.
log2_exponent must be a positive-valued integer. The larger it is, the
slower and tighter the bound. Values up to 5 should usually suffice. The
algorithm works by multiplying X by itself this many times.
From V.Pan, 1990. "Estimating the Extremal Eigenvalues of a Symmetric
Matrix", Computers Math Applic. Vol 20 n. 2 pp 17-22.
Rq: an efficient algorithm, not used here, is defined in this paper.
"""
if
X
.
type
.
ndim
!=
2
:
raise
TypeError
(
"spectral_radius_bound requires a matrix argument"
,
X
)
if
not
isinstance
(
log2_exponent
,
int
):
raise
TypeError
(
"spectral_radius_bound requires an integer exponent"
,
log2_exponent
)
if
log2_exponent
<=
0
:
raise
ValueError
(
"spectral_radius_bound requires a strictly positive exponent"
,
log2_exponent
,
)
XX
=
X
for
i
in
range
(
log2_exponent
):
XX
=
dot
(
XX
,
XX
)
return
at_pow
(
trace
(
XX
),
2
**
(
-
log2_exponent
))
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论