diff --git a/ReleaseNotes/02_20_2024.txt b/ReleaseNotes/02_20_2024.txt new file mode 100644 index 00000000000..39da48897f4 --- /dev/null +++ b/ReleaseNotes/02_20_2024.txt @@ -0,0 +1,29 @@ + +Features: + + - Matrix Util Unsafe Dot Product (68, 69) + - Unsafe Project V On U (70, 71, 72) + - Matrix Util Unsafe Modulus Calculation (73, 74) + - Matrix Util Unsafe Product Calculation (75, 76) + + +Bug Fixes/Re-organization: + +Samples: + +IdeaDRIP: + + - QR Decomposition Using Givens Rotations - Example (1-15) + - QR Decomposition Using Givens Rotations - Advantages and Disadvantages (16-18) + - QR Decomposition Connection to a Determinant or Product of Eigenvalues (19-39) + - QR Decomposition Column Pivoting (40-47) + - QR Decomposition Using for Solution to Linear Inverse Problems (48-66) + - QR Decomposition Generalization (67) + - QR Decomposition Introduction (77-80) + - QR Decomposition Cases and Definition - Square Matrix (81-90) + - QR Decomposition Cases and Definition - Rectangular Matrix (91-98) + - QR Decomposition Cases and Definition - QL, RQ, LQ (99-100) + - Computing the QR Decomposition (101-102) + - Computing the QR Decomposition using Gram–Schmidt Process (103-110) + - Computing the QR Decomposition using Gram–Schmidt Process - Relation to RQ (111-114) + - Computing the QR Decomposition using Gram–Schmidt Process - Advantages and Disadvantages (115-120) diff --git a/src/main/java/org/drip/numerical/linearalgebra/MatrixUtil.java b/src/main/java/org/drip/numerical/linearalgebra/MatrixUtil.java index fc6f99a5765..03cc98c3763 100644 --- a/src/main/java/org/drip/numerical/linearalgebra/MatrixUtil.java +++ b/src/main/java/org/drip/numerical/linearalgebra/MatrixUtil.java @@ -114,9 +114,20 @@ * @author Lakshmi Krishnamurthy */ -public class MatrixUtil { +public class MatrixUtil +{ - private static final double DotProductInternal ( + /** + * Dot Product of Vectors A and E. Unsafe Methods do not validate the Input Arguments, so + * use caution in applying these Methods + * + * @param a Vector A + * @param e Vector E + * + * @return The Dot Product + */ + + public static final double UnsafeDotProduct ( final double[] a, final double[] e) { @@ -128,11 +139,21 @@ private static final double DotProductInternal ( return dotProductInternal; } - private static final double[] ProjectVOnUInternal ( + /** + * Compute the Projection Vector on V induced by U. Unsafe Methods do not validate the Input Arguments, + * so use caution in applying these Methods + * + * @param u Vector U + * @param v Vector V + * + * @return The Projection Vector + */ + + public static final double[] UnsafeProjectVOnU ( final double[] u, final double[] v) { - double vDotUOverUDotU = DotProductInternal (u, v) / DotProductInternal (u, u); + double vDotUOverUDotU = UnsafeDotProduct (u, v) / UnsafeDotProduct (u, u); double[] projectVOnU = new double[u.length]; @@ -143,7 +164,16 @@ private static final double[] ProjectVOnUInternal ( return projectVOnU; } - private static final double ModulusInternal ( + /** + * Compute the Modulus of the Vector. Unsafe Methods do not validate the Input Arguments, so + * use caution in applying these Methods + * + * @param v Vector V + * + * @return Modulus of the Vector + */ + + public static final double UnsafeModulus ( final double[] v) { double modulus = 0.; @@ -155,7 +185,17 @@ private static final double ModulusInternal ( return Math.sqrt (modulus); } - private static final double[][] ProductInternal ( + /** + * Compute the Product of the Input Matrices. Unsafe Methods do not validate the Input Arguments, so + * use caution in applying these Methods + * + * @param a Vector A + * @param b Vector B + * + * @return The Product Matrix + */ + + private static final double[][] UnsafeProduct ( final double[][] a, final double[][] b) { @@ -332,7 +372,7 @@ public static final double[][] Product ( { return null == a || 0 == a.length || 0 == a[0].length || null == b || a[0].length != b.length || 0 == b[0].length ? - null : ProductInternal (a, b); + null : UnsafeProduct (a, b); } /** @@ -805,7 +845,7 @@ public static final double DotProduct ( throw new Exception ("MatrixUtil::DotProduct => Invalid Inputs!"); } - return DotProductInternal (adblA, adblE); + return UnsafeDotProduct (adblA, adblE); } /** @@ -927,7 +967,7 @@ public static final double Modulus ( throw new Exception ("MatrixUtil::Modulus => Invalid Inputs"); } - return ModulusInternal (v); + return UnsafeModulus (v); } /** @@ -1062,7 +1102,7 @@ public static final double[][] GrahamSchmidtOrthogonalization ( for (int i = 1; i < aUsingVectorsInRows.length; ++i) { for (int j = 0; j < i; ++j) { - double[] projectionTrimOff = ProjectVOnUInternal (u[j], aUsingVectorsInRows[i]); + double[] projectionTrimOff = UnsafeProjectVOnU (u[j], aUsingVectorsInRows[i]); for (int k = 0; k < projectionTrimOff.length; ++k) { u[i][k] -= projectionTrimOff[k]; @@ -1095,7 +1135,7 @@ public static final double[][] GrahamSchmidtOrthonormalization ( double[][] u = vectorsInColumns ? Transpose (uOrthogonal) : uOrthogonal; for (int i = 0; i < u.length; ++i) { - double modulusReciprocal = 1. / ModulusInternal (u[i]); + double modulusReciprocal = 1. / UnsafeModulus (u[i]); for (int j = 0; j < u.length; ++j) { u[i][j] *= modulusReciprocal;