|
23 | 23 | import logging |
24 | 24 | import warnings |
25 | 25 | from dataclasses import dataclass |
26 | | -from typing import Any, List, Mapping, Optional, Sequence, Text, Tuple, Union |
| 26 | +from typing import Any, List, Mapping, Optional, Sequence, Tuple, Union |
27 | 27 |
|
28 | 28 | import numpy as np |
29 | 29 | import pymbolic |
@@ -131,7 +131,7 @@ def map_int_g(self, expr): |
131 | 131 |
|
132 | 132 |
|
133 | 133 | def _get_sympy_kernel_expression(expr: ExpressionT, |
134 | | - kernel_arguments: Mapping[Text, Any]) -> sym.Basic: |
| 134 | + kernel_arguments: Mapping[str, Any]) -> sym.Basic: |
135 | 135 | """Convert a :mod:`pymbolic` expression to :mod:`sympy` expression |
136 | 136 | after substituting kernel arguments. |
137 | 137 |
|
@@ -399,7 +399,7 @@ class DerivRelation: |
399 | 399 |
|
400 | 400 | def get_deriv_relation(kernels: Sequence[ExpressionKernel], |
401 | 401 | base_kernel: ExpressionKernel, |
402 | | - kernel_arguments: Mapping[Text, Any], |
| 402 | + kernel_arguments: Mapping[str, Any], |
403 | 403 | tol: float = 1e-10, |
404 | 404 | order: Optional[int] = None) \ |
405 | 405 | -> List[DerivRelation]: |
@@ -436,7 +436,7 @@ def get_deriv_relation(kernels: Sequence[ExpressionKernel], |
436 | 436 | @memoize_on_first_arg |
437 | 437 | def get_deriv_relation_kernel(kernel: ExpressionKernel, |
438 | 438 | base_kernel: ExpressionKernel, |
439 | | - hashable_kernel_arguments: Tuple[Tuple[Text, Any], ...], |
| 439 | + hashable_kernel_arguments: Tuple[Tuple[str, Any], ...], |
440 | 440 | tol: float = 1e-10, |
441 | 441 | order: Optional[int] = None) \ |
442 | 442 | -> DerivRelation: |
@@ -495,7 +495,7 @@ class LUFactorization: |
495 | 495 |
|
496 | 496 | @memoize_on_first_arg |
497 | 497 | def _get_base_kernel_matrix_lu_factorization(base_kernel: ExpressionKernel, |
498 | | - hashable_kernel_arguments: Tuple[Tuple[Text, Any], ...], |
| 498 | + hashable_kernel_arguments: Tuple[Tuple[str, Any], ...], |
499 | 499 | order: Optional[int] = None, retries: int = 3) \ |
500 | 500 | -> Tuple[LUFactorization, np.ndarray, List[Tuple[int, ...]]]: |
501 | 501 | """ |
@@ -525,11 +525,11 @@ def _get_base_kernel_matrix_lu_factorization(base_kernel: ExpressionKernel, |
525 | 525 | if order == pde.order: |
526 | 526 | pde_mis = [ident.mi for eq in pde.eqs for ident in eq.keys()] |
527 | 527 | pde_mis = [mi for mi in pde_mis if sum(mi) == order] |
528 | | - logger.debug(f"Removing {pde_mis[-1]} to avoid linear dependent mis") |
| 528 | + logger.debug("Removing %s to avoid linear dependent mis", pde_mis[-1]) |
529 | 529 | mis.remove(pde_mis[-1]) |
530 | 530 |
|
531 | | - rand = np.random.randint(1, 10**15, (dim, len(mis))) |
532 | | - rand = rand.astype(object) |
| 531 | + rng = np.random.default_rng() |
| 532 | + rand: np.ndarray = rng.integers(1, 10**15, size=(dim, len(mis))).astype(object) |
533 | 533 | for i in range(rand.shape[0]): |
534 | 534 | for j in range(rand.shape[1]): |
535 | 535 | rand[i, j] = sym.sympify(rand[i, j])/10**15 |
|
0 commit comments