File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 12
12
import java .util .Locale ;
13
13
import java .util .Random ;
14
14
import java .util .Vector ;
15
+ import java .util .function .DoubleBinaryOperator ;
15
16
import java .util .function .DoubleUnaryOperator ;
16
17
17
18
import static jama2 .util .Maths .hypot ;
@@ -1550,6 +1551,23 @@ public Matrix transformEquals(final DoubleUnaryOperator operator)
1550
1551
}
1551
1552
return M ;
1552
1553
}
1554
+
1555
+ /**
1556
+ * Applys the given operator to all elements, modifying this Matrix.
1557
+ * @param B another Matrix
1558
+ * @param operator Operator to be applied
1559
+ * @throws NullPointerException iff operator == null
1560
+ */
1561
+ public void transform (final Matrix B , final DoubleBinaryOperator operator )
1562
+ {
1563
+ for (int i = 0 ; i < this .m ; i ++)
1564
+ {
1565
+ for (int j = 0 ; j < this .n ; j ++)
1566
+ {
1567
+ this .A [i ][j ] = operator .applyAsDouble (this .A [i ][j ], B .A [i ][j ]);
1568
+ }
1569
+ }
1570
+ }
1553
1571
1554
1572
/**
1555
1573
* Matrix transpose.
You can’t perform that action at this time.
0 commit comments