Skip to content

Commit 27745b4

Browse files
authored
Normalize x values in test_b_jax.py
1 parent e01375a commit 27745b4

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

test/b/test_b_jax.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ def test_from_lookup_table(self):
196196
d = tuple([k_ + 1 for k_ in k])
197197
c = np.arange(np.prod(np.asarray(d))).reshape(d) + 1.0
198198
x = (
199-
np.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00]),
200-
np.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00]),
201-
np.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00]),
199+
np.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0]),
200+
np.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0]),
201+
np.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0]),
202202
)
203203
y = BernsteinGrid(x).eval(c)
204204

@@ -217,7 +217,7 @@ class BSolveTest(unittest.TestCase):
217217
def test_b_solve_0_2(self):
218218
r"""Fit :math:`B_{0,2}(x)`."""
219219
k = 2
220-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
220+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
221221
y = jnp.square(1.0 - x)
222222

223223
c = b_solve((k,), (x,), y, non_negative=True)
@@ -230,7 +230,7 @@ def test_b_solve_0_2(self):
230230
def test_b_solve_1_2(self):
231231
r"""Fit :math:`B_{1,2}(x)`."""
232232
k = 2
233-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
233+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
234234
y = 2.0 * x * (1.0 - x)
235235

236236
c = b_solve((k,), (x,), y, non_negative=True)
@@ -243,7 +243,7 @@ def test_b_solve_1_2(self):
243243
def test_b_solve_2_2(self):
244244
r"""Fit :math:`B_{2,2}(x)`."""
245245
k = 2
246-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
246+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
247247
y = jnp.square(x)
248248

249249
c = b_solve((k,), (x,), y, non_negative=True)
@@ -256,7 +256,7 @@ def test_b_solve_2_2(self):
256256
def test_b_solve_0_0_2_2(self):
257257
r"""Fit :math:`B_{(0,0),(2,2)}(x_0, x_1)`."""
258258
k = 2
259-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
259+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
260260
y = jnp.square(1.0 - x[jnp.newaxis, :]) * jnp.square(
261261
1.0 - x[:, jnp.newaxis]
262262
)
@@ -277,7 +277,7 @@ def test_b_solve_0_0_2_2(self):
277277
def test_b_solve_1_0_2_2(self):
278278
r"""Fit :math:`B_{(1,0),(2,2)}(x_0, x_1)`."""
279279
k = 2
280-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
280+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
281281
y = (
282282
2.0
283283
* x[:, jnp.newaxis]
@@ -301,7 +301,7 @@ def test_b_solve_1_0_2_2(self):
301301
def test_b_solve_2_0_2_2(self):
302302
r"""Fit :math:`B_{(2,0),(2,2)}(x_0, x_1)`."""
303303
k = 2
304-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
304+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
305305
y = jnp.square(x[:, jnp.newaxis]) * jnp.square(
306306
1.0 - x[jnp.newaxis, :]
307307
)
@@ -322,7 +322,7 @@ def test_b_solve_2_0_2_2(self):
322322
def test_b_solve_0_1_2_2(self):
323323
r"""Fit :math:`B_{(0,1),(2,2)}(x_0, x_1)`."""
324324
k = 2
325-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
325+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
326326
y = (
327327
2.0
328328
* jnp.square(1.0 - x[:, jnp.newaxis])
@@ -346,7 +346,7 @@ def test_b_solve_0_1_2_2(self):
346346
def test_b_solve_1_1_2_2(self):
347347
r"""Fit :math:`B_{(1,1),(2,2)}(x_0, x_1)`."""
348348
k = 2
349-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
349+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
350350
y = (
351351
4.0
352352
* x[:, jnp.newaxis]
@@ -371,7 +371,7 @@ def test_b_solve_1_1_2_2(self):
371371
def test_b_solve_2_1_2_2(self):
372372
r"""Fit :math:`B_{(2,1),(2,2)}(x_0, x_1)`."""
373373
k = 2
374-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
374+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
375375
y = (
376376
2.0
377377
* jnp.square(x[:, jnp.newaxis])
@@ -395,7 +395,7 @@ def test_b_solve_2_1_2_2(self):
395395
def test_b_solve_0_2_2_2(self):
396396
r"""Fit :math:`B_{(0,2),(2,2)}(x_0, x_1)`."""
397397
k = 2
398-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
398+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
399399
y = jnp.square(1.0 - x[:, jnp.newaxis]) * jnp.square(
400400
x[jnp.newaxis, :]
401401
)
@@ -416,7 +416,7 @@ def test_b_solve_0_2_2_2(self):
416416
def test_b_solve_1_2_2_2(self):
417417
r"""Fit :math:`B_{(1,2),(2,2)}(x_0, x_1)`."""
418418
k = 2
419-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
419+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
420420
y = (
421421
2.0
422422
* x[:, jnp.newaxis]
@@ -440,7 +440,7 @@ def test_b_solve_1_2_2_2(self):
440440
def test_b_solve_2_2_2_2(self):
441441
r"""Fit :math:`B_{(2,2),(2,2)}(x_0, x_1)`."""
442442
k = 2
443-
x = jnp.asarray([0.00, 0.20, 0.40, 0.60, 0.80, 1.00])
443+
x = jnp.asarray([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
444444
y = jnp.square(x[:, jnp.newaxis]) * jnp.square(x[jnp.newaxis, :])
445445

446446
c = b_solve((k, k), (x, x), y, non_negative=True)

0 commit comments

Comments
 (0)