Skip to content

Commit a2f27b2

Browse files
committed
Update MPIBlockVector testing
1 parent 2f6e7d6 commit a2f27b2

File tree

1 file changed

+18
-61
lines changed

1 file changed

+18
-61
lines changed

pyomo/contrib/pynumero/sparse/tests/test_mpi_block_vector.py

Lines changed: 18 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,48 +1403,13 @@ def test_unary_ufuncs(self):
14031403
bv.set_block(0, a)
14041404
bv.set_block(1, b)
14051405

1406-
unary_funcs = [
1407-
np.log10,
1408-
np.sin,
1409-
np.cos,
1410-
np.exp,
1411-
np.ceil,
1412-
np.floor,
1413-
np.tan,
1414-
np.arctan,
1415-
np.arcsin,
1416-
np.arccos,
1417-
np.sinh,
1418-
np.cosh,
1419-
np.abs,
1420-
np.tanh,
1421-
np.arcsinh,
1422-
np.arctanh,
1423-
np.fabs,
1424-
np.sqrt,
1425-
np.log,
1426-
np.log2,
1427-
np.absolute,
1428-
np.isfinite,
1429-
np.isinf,
1430-
np.isnan,
1431-
np.log1p,
1432-
np.logical_not,
1433-
np.exp2,
1434-
np.expm1,
1435-
np.sign,
1436-
np.rint,
1437-
np.square,
1438-
np.positive,
1439-
np.negative,
1440-
np.rad2deg,
1441-
np.deg2rad,
1442-
np.conjugate,
1443-
np.reciprocal,
1444-
]
1406+
_int_ufuncs = {np.invert, np.arccosh}
14451407

14461408
bv2 = BlockVector(2)
14471409
for fun in unary_funcs:
1410+
if fun in _int_ufuncs:
1411+
continue
1412+
14481413
bv2.set_block(0, fun(bv.get_block(0)))
14491414
bv2.set_block(1, fun(bv.get_block(1)))
14501415
res = fun(v)
@@ -1454,7 +1419,7 @@ def test_unary_ufuncs(self):
14541419
self.assertTrue(np.allclose(res.get_block(i), bv2.get_block(i)))
14551420

14561421
with self.assertRaises(Exception) as context:
1457-
np.cbrt(v)
1422+
np.modf(v)
14581423

14591424
with self.assertRaises(Exception) as context:
14601425
np.cumsum(v)
@@ -1504,29 +1469,21 @@ def test_binary_ufuncs(self):
15041469
bv2.set_block(0, np.ones(3) * 3.0)
15051470
bv2.set_block(1, np.ones(2) * 2.8)
15061471

1507-
binary_ufuncs = [
1508-
np.add,
1509-
np.multiply,
1510-
np.divide,
1511-
np.subtract,
1512-
np.greater,
1513-
np.greater_equal,
1514-
np.less,
1515-
np.less_equal,
1516-
np.not_equal,
1517-
np.maximum,
1518-
np.minimum,
1519-
np.fmax,
1520-
np.fmin,
1521-
np.equal,
1522-
np.logaddexp,
1523-
np.logaddexp2,
1524-
np.remainder,
1525-
np.heaviside,
1526-
np.hypot,
1527-
]
1472+
_int_ufuncs = {
1473+
np.gcd,
1474+
np.lcm,
1475+
np.ldexp,
1476+
np.left_shift,
1477+
np.right_shift,
1478+
np.bitwise_and,
1479+
np.bitwise_or,
1480+
np.bitwise_xor,
1481+
}
15281482

15291483
for fun in binary_ufuncs:
1484+
if fun in _int_ufuncs:
1485+
continue
1486+
15301487
serial_res = fun(bv, bv2)
15311488
res = fun(v, v2)
15321489

0 commit comments

Comments
 (0)