提交 a8e0adcb authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Ricardo Vieira

Remove stubborn spectral_radius_bound

Supposed to be removed in 6d431aa6
上级 99a040cc
...@@ -4,10 +4,8 @@ from pytensor.graph.rewriting.basic import node_rewriter ...@@ -4,10 +4,8 @@ from pytensor.graph.rewriting.basic import node_rewriter
from pytensor.tensor import basic as at from pytensor.tensor import basic as at
from pytensor.tensor.blas import Dot22 from pytensor.tensor.blas import Dot22
from pytensor.tensor.elemwise import DimShuffle from pytensor.tensor.elemwise import DimShuffle
from pytensor.tensor.math import Dot, Prod, dot, log from pytensor.tensor.math import Dot, Prod, log, prod
from pytensor.tensor.math import pow as at_pow from pytensor.tensor.nlinalg import Det, MatrixInverse
from pytensor.tensor.math import prod
from pytensor.tensor.nlinalg import Det, MatrixInverse, trace
from pytensor.tensor.rewriting.basic import ( from pytensor.tensor.rewriting.basic import (
register_canonicalize, register_canonicalize,
register_specialize, register_specialize,
...@@ -191,34 +189,3 @@ def local_log_prod_sqr(fgraph, node): ...@@ -191,34 +189,3 @@ def local_log_prod_sqr(fgraph, node):
# TODO: have a reduction like prod and sum that simply # TODO: have a reduction like prod and sum that simply
# returns the sign of the prod multiplication. # 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论