Skip to content

Commit 306f099

Browse files
committed
Support for DoubleUnaryOperator
1 parent 3df95ff commit 306f099

10 files changed

+17
-0
lines changed

bin/jama2/CholeskyDecomposition.class

689 Bytes
Binary file not shown.
4.36 KB
Binary file not shown.

bin/jama2/LUDecomposition.class

1.19 KB
Binary file not shown.

bin/jama2/Matrix.class

6.9 KB
Binary file not shown.

bin/jama2/QRDecomposition.class

1.08 KB
Binary file not shown.
2.84 KB
Binary file not shown.
1.33 KB
Binary file not shown.

bin/jama2/test/TestMatrix.class

6.27 KB
Binary file not shown.

bin/jama2/util/Maths.class

355 Bytes
Binary file not shown.

src/jama2/Matrix.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.Locale;
1313
import java.util.Random;
1414
import java.util.Vector;
15+
import java.util.function.DoubleUnaryOperator;
1516

1617
import static jama2.util.Maths.hypot;
1718
import static java.lang.Math.abs;
@@ -1514,6 +1515,22 @@ public double trace()
15141515
}
15151516
return t;
15161517
}
1518+
1519+
/**
1520+
* Applys the given operator to all elements, modifying this Matrix.
1521+
* @param operator Operator to be applied
1522+
* @throws NullPointerException iff operator == null
1523+
*/
1524+
public void transform(final DoubleUnaryOperator operator)
1525+
{
1526+
for (int i = 0; i < this.m; i++)
1527+
{
1528+
for (int j = 0; j < this.n; j++)
1529+
{
1530+
this.A[i][j] = operator.applyAsDouble(this.A[i][j]);
1531+
}
1532+
}
1533+
}
15171534

15181535
/**
15191536
* Matrix transpose.

0 commit comments

Comments
 (0)