From 040b204c0467b3f81058c27c1547791dba53061c Mon Sep 17 00:00:00 2001 From: Samuel Burbulla Date: Thu, 22 Jun 2023 15:36:25 +0200 Subject: [PATCH] Remove astype. --- deepxde/data/function_spaces.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/deepxde/data/function_spaces.py b/deepxde/data/function_spaces.py index e9c9c8b2b..a86863216 100644 --- a/deepxde/data/function_spaces.py +++ b/deepxde/data/function_spaces.py @@ -85,13 +85,13 @@ def __init__(self, N=100, M=1): self.M = M def random(self, size): - return 2 * self.M * np.random.rand(size, self.N).astype(config.real(np)) - self.M + return 2 * self.M * np.random.rand(size, self.N) - self.M def eval_one(self, feature, x): - return np.dot(feature, x ** np.arange(self.N, dtype=config.real(np))) + return np.dot(feature, x ** np.arange(self.N)) def eval_batch(self, features, xs): - mat = np.ones((self.N, len(xs)), dtype=config.real(np)) + mat = np.ones((self.N, len(xs))) for i in range(1, self.N): mat[i] = np.ravel(xs**i) return np.dot(features, mat) @@ -114,7 +114,7 @@ def __init__(self, N=100, M=1): self.M = M def random(self, size): - return 2 * self.M * np.random.rand(size, self.N).astype(config.real(np)) - self.M + return 2 * self.M * np.random.rand(size, self.N) - self.M def eval_one(self, feature, x): return np.polynomial.chebyshev.chebval(2 * x - 1, feature) @@ -218,15 +218,15 @@ def bases(self, sensors): return np.array([np.ravel(f(sensors)) for f in self.eigfun]) def random(self, size): - return np.random.randn(size, self.num_eig).astype(config.real(np)) + return np.random.randn(size, self.num_eig) def eval_one(self, feature, x): eigfun = [f(x) for f in self.eigfun] - return np.sum(eigfun * feature).astype(config.real(np)) + return np.sum(eigfun * feature) def eval_batch(self, features, xs): eigfun = np.array([np.ravel(f(xs)) for f in self.eigfun]) - return np.dot(features, eigfun).astype(config.real(np)) + return np.dot(features, eigfun) class GRF2D(FunctionSpace):