Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
	- Successive Over Relaxation Standard #1 (1, 2)
	- Successive Over Relaxation Standard #2 (3, 4)
	- Linear Algebra Matrix Square Check (5, 6, 7)
	- Linear Algebra Matrix Diagonal #1 (8, 9)
	- Linear Algebra Matrix Diagonal #2 (10, 11)
	- Linear Algebra Strictly Lower Triangular (12, 13, 14)
	- Linear Algebra Strictly Upper Triangular (15, 16, 17)
	- Successive Over Relaxation Lower Triangular (18)
	- Successive Over Relaxation Upper Triangular (19)
	- Successive Over Relaxation Diagonal Matrix (20)
	- Successive Over Relaxation Sample Run (21, 22)
	- Successive Over Relaxation Constructor Checks (23, 24)
	- Linear Algebra Jacobi Iteration #1 (25, 26)
	- Linear Algebra Jacobi Iteration #2 (27, 28)
	- SOR Convergence Check Square Matrix (29, 30)
	- SOR Convergence Check Relaxation Parameter (31, 32)
	- Jacobi Iteration Matrix Spectral Radius (33, 34)
	- SOR Convergence Check Shell Annotation (35, 36, 37)
	- SOR Convergence Check Constructor Annotation (38, 39, 40)
	- SOR Convergence Jacobi Iteration Matrix (41, 42)
	- Jacobi Iteration Matrix Real Eigenvalues #1 (43, 44, 45)
	- SOR Jacobi Spectral Radius Verification #1 (46, 47, 48)
	- SOR Relaxation Parameter Range Verification #1 (49, 50, 51)
	- Successive Over Relaxation Convergence Analyzer #1 (52, 53)
	- Successive Over Relaxation Convergence Check #1 (54, 55)
	- Jacobi Iteration Matrix Real Eigenvalues #2 (56, 57)
	- SOR Jacobi Spectral Radius Verification #2 (58, 59)
	- SOR Relaxation Parameter Range Verification #2 (60, 61)
	- SOR Convergence Check Status - Constructor (62, 63, 64)
	- SOR Convergence Check Status Satisfied (65, 66)
	- SOR Convergence Analyzer Criteria Check (67, 68, 69)
	- SOR Relaxation Parameter Gauss Seidel (70)
	- Gauss Seidel SOR Solve Setting (71, 72)
	- SOR Optimal Relaxation Parameter Estimate (73, 74, 75)
	- SOR Convergence Analytizer Rate #1 (76, 77)
	- SOR Convergence Analytizer Rate #2 (78, 79)
	- SOR Gauss Seidel Solver Setting (80, 81)
	- SOR Convergence Analytizer Rate #3 (82, 83)
	- Optimal Relaxation Parameter Convergence Rate (84, 85, 86)
	- Linear System Iterative Solver Schemes (87, 88)
	- Linear System Iterative Solver Settings (89, 90)
	- Successive Over Relaxation Iterator Setting (91, 92)
	- Successive Over Relaxation Iterator #1 (99, 100)
	- Successive Over Relaxation Iterator #2 (101, 102)
	- Is Matrix Square Symmetric #1 (103, 104)
	- Is Matrix Square Symmetric #2 (105, 106)
	- Linear Algebra Matrix Square Check (107, 108)
	- Symmetric Successive Over Relaxation Shell (109, 110)
	- Symmetric Successive Over Relaxation - Constructor (111, 112, 113)
	- SSOR Pre-Conditioner Iteration Matrix #1 (114, 115)
	- SSOR Pre-Conditioner Iteration Matrix #2 (116, 117, 118)
	- SSOR Pre-Conditioned Iterative Linear Solution (119, 120)


Bug Fixes/Re-organization:

	- Successive Over Relaxation Convergence Check #2 (93, 94)
	- Successive Over Relaxation Convergence Analyzer #2 (95, 96)
	- Successive Over Relaxation Package Move (97, 98)


Samples:

IdeaDRIP:
  • Loading branch information
Lakshmik committed Jun 17, 2024
1 parent 0d4dc75 commit 6f7d2d6
Show file tree
Hide file tree
Showing 9 changed files with 1,022 additions and 64 deletions.
67 changes: 67 additions & 0 deletions ReleaseNotes/01_08_2024.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

Features:

- Successive Over Relaxation Standard #1 (1, 2)
- Successive Over Relaxation Standard #2 (3, 4)
- Linear Algebra Matrix Square Check (5, 6, 7)
- Linear Algebra Matrix Diagonal #1 (8, 9)
- Linear Algebra Matrix Diagonal #2 (10, 11)
- Linear Algebra Strictly Lower Triangular (12, 13, 14)
- Linear Algebra Strictly Upper Triangular (15, 16, 17)
- Successive Over Relaxation Lower Triangular (18)
- Successive Over Relaxation Upper Triangular (19)
- Successive Over Relaxation Diagonal Matrix (20)
- Successive Over Relaxation Sample Run (21, 22)
- Successive Over Relaxation Constructor Checks (23, 24)
- Linear Algebra Jacobi Iteration #1 (25, 26)
- Linear Algebra Jacobi Iteration #2 (27, 28)
- SOR Convergence Check Square Matrix (29, 30)
- SOR Convergence Check Relaxation Parameter (31, 32)
- Jacobi Iteration Matrix Spectral Radius (33, 34)
- SOR Convergence Check Shell Annotation (35, 36, 37)
- SOR Convergence Check Constructor Annotation (38, 39, 40)
- SOR Convergence Jacobi Iteration Matrix (41, 42)
- Jacobi Iteration Matrix Real Eigenvalues #1 (43, 44, 45)
- SOR Jacobi Spectral Radius Verification #1 (46, 47, 48)
- SOR Relaxation Parameter Range Verification #1 (49, 50, 51)
- Successive Over Relaxation Convergence Analyzer #1 (52, 53)
- Successive Over Relaxation Convergence Check #1 (54, 55)
- Jacobi Iteration Matrix Real Eigenvalues #2 (56, 57)
- SOR Jacobi Spectral Radius Verification #2 (58, 59)
- SOR Relaxation Parameter Range Verification #2 (60, 61)
- SOR Convergence Check Status - Constructor (62, 63, 64)
- SOR Convergence Check Status Satisfied (65, 66)
- SOR Convergence Analyzer Criteria Check (67, 68, 69)
- SOR Relaxation Parameter Gauss Seidel (70)
- Gauss Seidel SOR Solve Setting (71, 72)
- SOR Optimal Relaxation Parameter Estimate (73, 74, 75)
- SOR Convergence Analytizer Rate #1 (76, 77)
- SOR Convergence Analytizer Rate #2 (78, 79)
- SOR Gauss Seidel Solver Setting (80, 81)
- SOR Convergence Analytizer Rate #3 (82, 83)
- Optimal Relaxation Parameter Convergence Rate (84, 85, 86)
- Linear System Iterative Solver Schemes (87, 88)
- Linear System Iterative Solver Settings (89, 90)
- Successive Over Relaxation Iterator Setting (91, 92)
- Successive Over Relaxation Iterator #1 (99, 100)
- Successive Over Relaxation Iterator #2 (101, 102)
- Is Matrix Square Symmetric #1 (103, 104)
- Is Matrix Square Symmetric #2 (105, 106)
- Linear Algebra Matrix Square Check (107, 108)
- Symmetric Successive Over Relaxation Shell (109, 110)
- Symmetric Successive Over Relaxation - Constructor (111, 112, 113)
- SSOR Pre-Conditioner Iteration Matrix #1 (114, 115)
- SSOR Pre-Conditioner Iteration Matrix #2 (116, 117, 118)
- SSOR Pre-Conditioned Iterative Linear Solution (119, 120)


Bug Fixes/Re-organization:

- Successive Over Relaxation Convergence Check #2 (93, 94)
- Successive Over Relaxation Convergence Analyzer #2 (95, 96)
- Successive Over Relaxation Package Move (97, 98)


Samples:

IdeaDRIP:
Binary file modified ScheduleSheet.xlsx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

package org.drip.numerical.linearalgebra;
package org.drip.numerical.iterativesolver;

import org.drip.numerical.common.NumberUtil;
import org.drip.numerical.linearalgebra.Matrix;

/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
Expand Down Expand Up @@ -76,7 +77,7 @@
*/

/**
* <i>SuccessiveOverRelaxation</i> implements the SOR and the SSOR schemes. The References are:
* <i>SuccessiveOverRelaxation</i> implements the SOR Linear Solution schemes. The References are:
*
* <br><br>
* <ul>
Expand Down Expand Up @@ -113,7 +114,7 @@
* <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
* <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/NumericalAnalysisLibrary.md">Numerical Analysis Library</a></li>
* <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/numerical/README.md">Numerical Quadrature, Differentiation, Eigenization, Linear Algebra, and Utilities</a></li>
* <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/numerical/linearalgebra/README.md">Linear Algebra Matrix Transform Library</a></li>
* <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/numerical/iterativesolver/README.md">Linear System Iterative Solver Schemes</a></li>
* </ul>
* <br><br>
*
Expand All @@ -124,7 +125,33 @@ public class SuccessiveOverRelaxation
{
private double[] _rhsArray = null;
private double[][] _squareMatrix = null;
private SuccessiveOverRelaxationSolverSetting _solverSetting = null;
private SuccessiveOverRelaxationIteratorSetting _iteratorSetting = null;

/**
* Construct an Instance of <i>SuccessiveOverRelaxation</i> using the Standard Solver Settings
*
* @param squareMatrix Square Matrix
* @param rhsArray RHS Array
*
* @return Instance of <i>SuccessiveOverRelaxation</i>
*/

public static final SuccessiveOverRelaxation Standard (
final double[][] squareMatrix,
final double[] rhsArray)
{
try {
return new SuccessiveOverRelaxation (
SuccessiveOverRelaxationIteratorSetting.Standard(),
squareMatrix,
rhsArray
);
} catch (Exception e) {
e.printStackTrace();
}

return null;
}

private final boolean VectorsMatch (
final double[] array1,
Expand All @@ -136,12 +163,12 @@ private final boolean VectorsMatch (

double absoluteDifference = Math.abs (array1[i] - array2[i]);

if (mid <= _solverSetting.absoluteLevelThreshold()) {
if (_solverSetting.absoluteTolerance() < absoluteDifference) {
if (mid <= _iteratorSetting.absoluteLevelThreshold()) {
if (_iteratorSetting.absoluteTolerance() < absoluteDifference) {
return false;
}
} else {
if (_solverSetting.relativeTolerance() * mid < absoluteDifference) {
if (_iteratorSetting.relativeTolerance() * mid < absoluteDifference) {
return false;
}
}
Expand All @@ -153,25 +180,29 @@ private final boolean VectorsMatch (
/**
* <i>SuccessiveOverRelaxation</i> Constructor
*
* @param solverSetting Successive Over-Relaxation Solver Setting
* @param iteratorSetting Successive Over-Relaxation Iterator Setting
* @param squareMatrix Square Matrix
* @param rhsArray RHS Array
*
* @throws Exception Thrown if the Inputs are Invalid
*/

public SuccessiveOverRelaxation (
final SuccessiveOverRelaxationSolverSetting solverSetting,
final SuccessiveOverRelaxationIteratorSetting iteratorSetting,
final double[][] squareMatrix,
final double[] rhsArray)
throws Exception
{
if (null == (_solverSetting = solverSetting) ||
null == (_squareMatrix = squareMatrix) ||
if (null == (_iteratorSetting = iteratorSetting) ||
!Matrix.IsSquare (_squareMatrix) ||
null == (_rhsArray = rhsArray))
{
throw new Exception ("SuccessiveOverRelaxation Construction => Invalid Inputs");
}

if (_squareMatrix.length != _rhsArray.length) {
throw new Exception ("SuccessiveOverRelaxation Construction => Invalid Inputs");
}
}

/**
Expand All @@ -193,16 +224,7 @@ public double[][] squareMatrix()

public double[][] diagonalMatrix()
{
int size = _squareMatrix.length;
double[][] diagonalMatrix = new double[size][size];

for (int i = 0; i < size; ++i) {
for (int j = 0; j < size; ++j) {
diagonalMatrix[i][j] = i == j ? _squareMatrix[i][j] : 0.;
}
}

return diagonalMatrix;
return Matrix.Diagonal (_squareMatrix);
}

/**
Expand All @@ -213,16 +235,7 @@ public double[][] diagonalMatrix()

public double[][] strictlyLowerTriangularMatrix()
{
int size = _squareMatrix.length;
double[][] strictlyLowerTriangularMatrix = new double[size][size];

for (int i = 0; i < size; ++i) {
for (int j = 0; j < size; ++j) {
strictlyLowerTriangularMatrix[i][j] = i > j ? _squareMatrix[i][j] : 0.;
}
}

return strictlyLowerTriangularMatrix;
return Matrix.StrictlyLowerTriangular (_squareMatrix);
}

/**
Expand All @@ -233,16 +246,7 @@ public double[][] strictlyLowerTriangularMatrix()

public double[][] strictlyUpperTriangularMatrix()
{
int size = _squareMatrix.length;
double[][] strictlyUpperTriangularMatrix = new double[size][size];

for (int i = 0; i < size; ++i) {
for (int j = 0; j < size; ++j) {
strictlyUpperTriangularMatrix[i][j] = i < j ? _squareMatrix[i][j] : 0.;
}
}

return strictlyUpperTriangularMatrix;
return Matrix.StrictlyUpperTriangular (_squareMatrix);
}

/**
Expand All @@ -257,14 +261,14 @@ public double[] rhsArray()
}

/**
* Retrieve the Successive Over Relaxation Solver Setting
* Retrieve the Successive Over Relaxation Iterator Setting
*
* @return Successive Over Relaxation Solver Setting
* @return Successive Over Relaxation Iterator Setting
*/

public SuccessiveOverRelaxationSolverSetting solverSetting()
public SuccessiveOverRelaxationIteratorSetting iteratorSetting()
{
return _solverSetting;
return _iteratorSetting;
}

/**
Expand All @@ -282,7 +286,7 @@ public double[] forwardSubstitution()
updatedUnknownArray[i] = Math.random();
}

double relaxationParameter = _solverSetting.relaxationParameter();
double relaxationParameter = _iteratorSetting.relaxationParameter();

try {
while (!VectorsMatch (previousUnknownArray, updatedUnknownArray)) {
Expand Down Expand Up @@ -335,11 +339,7 @@ public static final void main (

NumberUtil.Print1DArray (
"\tResult",
new SuccessiveOverRelaxation (
SuccessiveOverRelaxationSolverSetting.Standard(),
squareMatrix,
rhsArray
).forwardSubstitution(),
SuccessiveOverRelaxation.Standard (squareMatrix, rhsArray).forwardSubstitution(),
4,
false
);
Expand Down
Loading

0 comments on commit 6f7d2d6

Please sign in to comment.