File tree Expand file tree Collapse file tree 1 file changed +18
-61
lines changed
pyomo/contrib/pynumero/sparse/tests Expand file tree Collapse file tree 1 file changed +18
-61
lines changed Original file line number Diff line number Diff line change @@ -1403,48 +1403,13 @@ def test_unary_ufuncs(self):
1403
1403
bv .set_block (0 , a )
1404
1404
bv .set_block (1 , b )
1405
1405
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 }
1445
1407
1446
1408
bv2 = BlockVector (2 )
1447
1409
for fun in unary_funcs :
1410
+ if fun in _int_ufuncs :
1411
+ continue
1412
+
1448
1413
bv2 .set_block (0 , fun (bv .get_block (0 )))
1449
1414
bv2 .set_block (1 , fun (bv .get_block (1 )))
1450
1415
res = fun (v )
@@ -1454,7 +1419,7 @@ def test_unary_ufuncs(self):
1454
1419
self .assertTrue (np .allclose (res .get_block (i ), bv2 .get_block (i )))
1455
1420
1456
1421
with self .assertRaises (Exception ) as context :
1457
- np .cbrt (v )
1422
+ np .modf (v )
1458
1423
1459
1424
with self .assertRaises (Exception ) as context :
1460
1425
np .cumsum (v )
@@ -1504,29 +1469,21 @@ def test_binary_ufuncs(self):
1504
1469
bv2 .set_block (0 , np .ones (3 ) * 3.0 )
1505
1470
bv2 .set_block (1 , np .ones (2 ) * 2.8 )
1506
1471
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
+ }
1528
1482
1529
1483
for fun in binary_ufuncs :
1484
+ if fun in _int_ufuncs :
1485
+ continue
1486
+
1530
1487
serial_res = fun (bv , bv2 )
1531
1488
res = fun (v , v2 )
1532
1489
You can’t perform that action at this time.
0 commit comments