Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
	- RQ Graham Schmidt Orthogonalization (95, 96, 97)
	- QR Graham Schmidt Orthogonalization #1 (98, 99)
	- QR Graham Schmidt Orthogonalization #2 (100, 101)
	- QR Graham Schmidt Orthogonalization #3 (106, 107)
	- QR Graham Schmidt Orthogonalization #4 (109, 110, 111)
	- QR Graham Schmidt Orthogonalization #5 (113)
	- Unsafe RQ Graham Schmidt Orthogonalization (114, 115, 116)
	- RQ Graham Schmidt Orthogonalization Revamp (118)


Bug Fixes/Re-organization:

Samples:

	- Gram-Schmidt Process Test #1 (102, 103)
	- Gram-Schmidt Process Test #2 (104, 105)
	- Gram-Schmidt Process Test #3 (108)
	- Gram-Schmidt Process Test #4 (112)
	- Gram-Schmidt Process Test #5 (117)
	- Gram-Schmidt Process Test #6 (119, 120)


IdeaDRIP:

	- Computing the QR Decomposition (1-2)
	- Computing the QR Decomposition using Gram-Schmidt Process (3-10)
	- Computing the QR Decomposition using Gram-Schmidt Process – Relation to RQ (11-14)
	- Computing the QR Decomposition using Gram-Schmidt Process – Advantages and Disadvantages (15-18)
	- Computing the QR Decomposition using Householder Reflections (19-34)
	- Computing the QR Decomposition using Householder Reflections – Advantages and Disadvantages (35-34)
	- Computing the QR Decomposition using Givens' Rotations (39-46)
	- Computing the QR Decomposition using Givens' Rotations – Advantages and Disadvantages (47-52)
	- QR Decomposition Connection to a Determinant or a Product of Eigenvalues (53-68)
	- QR Decomposition Column Pivoting (69-76)
	- QR Decomposition Use for Solution to Linear Inverse Problems (77-92)
	- QR Decomposition Generalization (93-94)
  • Loading branch information
Lakshmik committed Jul 20, 2024
1 parent 40bd1d4 commit 169df7c
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 34 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 23 additions & 1 deletion NumericalAnalysisLibrary.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Numerical Analysis Library contains the supporting Functionality for Numerical M

| Document | Link |
|-------------------------|------|
| Technical Specification | [*Latest*](https://github.com/lakshmiDRIP/DROP/blob/master/Docs/Internal/NumericalAnalysis/NumericalAnalysis_v6.41.pdf) [*Previous*](https://github.com/lakshmiDRIP/DROP/blob/master/Docs/Internal/NumericalAnalysis) |
| Technical Specification | [*Latest*](https://github.com/lakshmiDRIP/DROP/blob/master/Docs/Internal/NumericalAnalysis/NumericalAnalysis_v6.43.pdf) [*Previous*](https://github.com/lakshmiDRIP/DROP/blob/master/Docs/Internal/NumericalAnalysis) |
| User Guide | |
| API | [*Javadoc*](https://lakshmidrip.github.io/DROP/Javadoc/index.html)|

Expand Down Expand Up @@ -378,6 +378,28 @@ Numerical Analysis Library contains the supporting Functionality for Numerical M
* Borel Subgroups and Borel Subalgebras
* Examples
* References
* QR Decomposition
* Introduction
* Cases and Definitions
* Square Matrix
* Rectangular Matrix
* QL, RQ and LQ Decompositions
* Computing the QR Decomposition
* Using the Gram–Schmidt Process
* Example
* Relation to RQ decomposition
* Advantages and Disadvantages
* Using Householder Reflections
* Example
* Advantages and Disadvantages
* Using Givens Rotations
* Example
* Advantages and Disadvantages
* Connection to a Determinant or Product of Eigenvalues
* Column Pivoting
* Using for Solution to Linear Inverse Problems
* Generalizations
* References


## DROP Specifications
Expand Down
39 changes: 39 additions & 0 deletions ReleaseNotes/02_22_2024.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Features:

- RQ Graham Schmidt Orthogonalization (95, 96, 97)
- QR Graham Schmidt Orthogonalization #1 (98, 99)
- QR Graham Schmidt Orthogonalization #2 (100, 101)
- QR Graham Schmidt Orthogonalization #3 (106, 107)
- QR Graham Schmidt Orthogonalization #4 (109, 110, 111)
- QR Graham Schmidt Orthogonalization #5 (113)
- Unsafe RQ Graham Schmidt Orthogonalization (114, 115, 116)
- RQ Graham Schmidt Orthogonalization Revamp (118)


Bug Fixes/Re-organization:

Samples:

- Gram-Schmidt Process Test #1 (102, 103)
- Gram-Schmidt Process Test #2 (104, 105)
- Gram-Schmidt Process Test #3 (108)
- Gram-Schmidt Process Test #4 (112)
- Gram-Schmidt Process Test #5 (117)
- Gram-Schmidt Process Test #6 (119, 120)


IdeaDRIP:

- Computing the QR Decomposition (1-2)
- Computing the QR Decomposition using Gram-Schmidt Process (3-10)
- Computing the QR Decomposition using Gram-Schmidt Process – Relation to RQ (11-14)
- Computing the QR Decomposition using Gram-Schmidt Process – Advantages and Disadvantages (15-18)
- Computing the QR Decomposition using Householder Reflections (19-34)
- Computing the QR Decomposition using Householder Reflections – Advantages and Disadvantages (35-34)
- Computing the QR Decomposition using Givens' Rotations (39-46)
- Computing the QR Decomposition using Givens' Rotations – Advantages and Disadvantages (47-52)
- QR Decomposition Connection to a Determinant or a Product of Eigenvalues (53-68)
- QR Decomposition Column Pivoting (69-76)
- QR Decomposition Use for Solution to Linear Inverse Problems (77-92)
- QR Decomposition Generalization (93-94)
87 changes: 55 additions & 32 deletions src/main/java/org/drip/numerical/linearalgebra/MatrixUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,39 @@ private static final double[][] UnsafeProduct (
return product;
}

/**
* Orthogonalize the Specified Matrix Using the RQ Graham-Schmidt Method. Unsafe Methods do not validate
* the Input Arguments, so <b>use caution</b> in applying these Methods
*
* @param a The Input Matrix
*
* @return The RQ Orthogonalized Matrix
*/

public static final double[][] UnsafeRQGrahamSchmidtOrthogonalization (
final double[][] a)
{
double[][] u = new double[a.length][a.length];

for (int i = 0; i < a.length; ++i) {
for (int j = 0; j < a.length; ++j) {
u[i][j] = a[i][j];
}
}

for (int i = 1; i < a.length; ++i) {
for (int j = 0; j < i; ++j) {
double[] projectionTrimOff = UnsafeProjectVOnU (u[j], a[i]);

for (int k = 0; k < projectionTrimOff.length; ++k) {
u[i][k] -= projectionTrimOff[k];
}
}
}

return u;
}

/**
* Indicate if the Cell corresponds to Bottom Left Location in the Matrix
*
Expand Down Expand Up @@ -1074,59 +1107,49 @@ public static final double[] Normalize (
}

/**
* Orthogonalize the Specified Matrix Using the Graham-Schmidt Method
* Orthogonalize the Specified Matrix Using the RQ Graham-Schmidt Method
*
* @param a The Input Matrix
* @param vectorsInColumns TRUE - Vectors in Columns
*
* @return The Orthogonalized Matrix
* @return The RQ Orthogonalized Matrix
*/

public static final double[][] GrahamSchmidtOrthogonalization (
final double[][] a,
final boolean vectorsInColumns)
public static final double[][] RQGrahamSchmidtOrthogonalization (
final double[][] a)
{
if (null == a || 0 == a.length || a.length != a[0].length) {
return null;
}

double[][] aUsingVectorsInRows = vectorsInColumns ? Transpose (a) : a;

double[][] u = new double[aUsingVectorsInRows.length][aUsingVectorsInRows.length];

for (int i = 0; i < aUsingVectorsInRows.length; ++i) {
for (int j = 0; j < aUsingVectorsInRows.length; ++j) {
u[i][j] = aUsingVectorsInRows[i][j];
}
}

for (int i = 1; i < aUsingVectorsInRows.length; ++i) {
for (int j = 0; j < i; ++j) {
double[] projectionTrimOff = UnsafeProjectVOnU (u[j], aUsingVectorsInRows[i]);
return null == a || 0 == a.length || a.length != a[0].length ?
null : UnsafeRQGrahamSchmidtOrthogonalization (a);
}

for (int k = 0; k < projectionTrimOff.length; ++k) {
u[i][k] -= projectionTrimOff[k];
}
}
}
/**
* Orthogonalize the Specified Matrix Using the QR Graham-Schmidt Method
*
* @param a The Input Matrix
*
* @return The QR Orthogonalized Matrix
*/

return vectorsInColumns ? Transpose (u) : u;
public static final double[][] QRGrahamSchmidtOrthogonalization (
final double[][] a)
{
return Transpose (RQGrahamSchmidtOrthogonalization (Transpose (a)));
}

/**
* Orthonormalize the Specified Matrix Using the Graham-Schmidt Method
* Orthonormalize the Specified Matrix Using the QR Graham-Schmidt Method
*
* @param a The Input Matrix
* @param vectorsInColumns TRUE - Vectors in Columns
*
* @return The Orthonormalized Matrix
* @return The QR Orthonormalized Matrix
*/

public static final double[][] GrahamSchmidtOrthonormalization (
final double[][] a,
final boolean vectorsInColumns)
{
double[][] uOrthogonal = GrahamSchmidtOrthogonalization (a, vectorsInColumns);
double[][] uOrthogonal = vectorsInColumns ? QRGrahamSchmidtOrthogonalization (a) :
RQGrahamSchmidtOrthogonalization (a);

if (null == uOrthogonal) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static final void main (
{-4, 24, -41}
};

double[][] u = MatrixUtil.GrahamSchmidtOrthogonalization (a, true);
double[][] u = MatrixUtil.QRGrahamSchmidtOrthogonalization (a);

NumberUtil.PrintMatrix ("ORTHOGONAL", u);

Expand Down

0 comments on commit 169df7c

Please sign in to comment.