Skip to content

Commit

Permalink
Remove astype.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelburbulla committed Jun 22, 2023
1 parent 3f5966a commit 040b204
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions deepxde/data/function_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 040b204

Please sign in to comment.