Skip to content

Commit a8e0adc

Browse files
committed
Remove stubborn spectral_radius_bound
Supposed to be removed in 6d431aa
1 parent 99a040c commit a8e0adc

File tree

1 file changed

+2
-35
lines changed

1 file changed

+2
-35
lines changed

pytensor/tensor/rewriting/linalg.py

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
from pytensor.tensor import basic as at
55
from pytensor.tensor.blas import Dot22
66
from pytensor.tensor.elemwise import DimShuffle
7-
from pytensor.tensor.math import Dot, Prod, dot, log
8-
from pytensor.tensor.math import pow as at_pow
9-
from pytensor.tensor.math import prod
10-
from pytensor.tensor.nlinalg import Det, MatrixInverse, trace
7+
from pytensor.tensor.math import Dot, Prod, log, prod
8+
from pytensor.tensor.nlinalg import Det, MatrixInverse
119
from pytensor.tensor.rewriting.basic import (
1210
register_canonicalize,
1311
register_specialize,
@@ -191,34 +189,3 @@ def local_log_prod_sqr(fgraph, node):
191189

192190
# TODO: have a reduction like prod and sum that simply
193191
# returns the sign of the prod multiplication.
194-
195-
196-
def spectral_radius_bound(X, log2_exponent):
197-
"""
198-
Returns upper bound on the largest eigenvalue of square symmetric matrix X.
199-
200-
log2_exponent must be a positive-valued integer. The larger it is, the
201-
slower and tighter the bound. Values up to 5 should usually suffice. The
202-
algorithm works by multiplying X by itself this many times.
203-
204-
From V.Pan, 1990. "Estimating the Extremal Eigenvalues of a Symmetric
205-
Matrix", Computers Math Applic. Vol 20 n. 2 pp 17-22.
206-
Rq: an efficient algorithm, not used here, is defined in this paper.
207-
208-
"""
209-
if X.type.ndim != 2:
210-
raise TypeError("spectral_radius_bound requires a matrix argument", X)
211-
if not isinstance(log2_exponent, int):
212-
raise TypeError(
213-
"spectral_radius_bound requires an integer exponent", log2_exponent
214-
)
215-
if log2_exponent <= 0:
216-
raise ValueError(
217-
"spectral_radius_bound requires a strictly positive exponent",
218-
log2_exponent,
219-
)
220-
221-
XX = X
222-
for i in range(log2_exponent):
223-
XX = dot(XX, XX)
224-
return at_pow(trace(XX), 2 ** (-log2_exponent))

0 commit comments

Comments
 (0)