|
4 | 4 | from pytensor.tensor import basic as at
|
5 | 5 | from pytensor.tensor.blas import Dot22
|
6 | 6 | 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 |
11 | 9 | from pytensor.tensor.rewriting.basic import (
|
12 | 10 | register_canonicalize,
|
13 | 11 | register_specialize,
|
@@ -191,34 +189,3 @@ def local_log_prod_sqr(fgraph, node):
|
191 | 189 |
|
192 | 190 | # TODO: have a reduction like prod and sum that simply
|
193 | 191 | # 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