Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
	- Random Matrix Generator Atomic Lower Triangular (10, 11, 12)
	- Random Matrix Generator Atomic Upper Triangular (46, 47, 48)
	- Linear Algebra Tridiagonal Matrix Shell (81, 82)
	- Linear Algebra Tridiagonal Matrix Constructor (83, 84)
	- Non-Periodic Tridiagonal Matrix Shell (85, 86, 87)
	- Non-Periodic Tridiagonal Matrix Constructor (88, 89, 90)
	- Non-Periodic Tridiagonal Matrix Solver (91, 92, 93)
	- Linear Algebra TridiagonalMatrix Shell (94, 95, 96)
	- Non-Periodic Tridiagonal Matrix Shell (97, 98)
	- Periodic Tridiagonal Matrix Shell (99, 100)
	- Non-Periodic Tridiagonal Matrix #1 (101, 102, 103)
	- Non-Periodic Tridiagonal Matrix #2 (104, 105)


Bug Fixes/Re-organization:

	- Atomic Lower Triangular Fix #1 (13, 14, 15)
	- Atomic Lower Triangular Fix #2 (16, 17, 18)
	- Atomic Lower Triangular Fix #3 (19, 20, 21)
	- Atomic Lower Triangular Fix #4 (22, 23, 24)
	- Atomic Lower Triangular Fix #5 (25, 26, 27)
	- Atomic Lower Triangular Fix #6 (28, 29, 30)
	- Atomic Lower Triangular Fix #7 (31, 32, 33)
	- Atomic Lower Triangular Fix #8 (34, 35, 36)
	- Solvers of Linear Systems of Equations (64, 65)
	- Numerical Linear System Solver Migration (66, 67, 68)
	- Numerical Ryabenkii Tsynkov System Solver (69, 70, 71)
	- Numerical Tridiagonal System Solver Migration (72, 73, 74)
	- Numerical Strictly Tridiagonal System Solver (75, 76, 77)
	- Numerical Sherman Morrison System Solver (78, 79, 80)
	- Non-Periodic Tridiagonal Matrix Revamp (106, 107, 108)
	- Numerical Linear Solver Tridiagonal Revamp (109, 110, 111)
	- Non-Periodic Tridiagonal Revamp (112)
	- Linear Solver Ryabenkii Tsynkov #1 (113, 114, 115)
	- Linear Solver Ryabenkii Tsynkov #2 (116, 117, 118)
	- Linear Solver Ryabenkii Tsynkov #3 (119, 120)


Samples:

	- Upper Strictly Upper Triangular #1 (1, 2, 3)
	- Upper Strictly Upper Triangular #2 (4, 5, 6)
	- Upper Strictly Upper Triangular #3 (7, 8, 9)
	- Atomic Lower Triangular Matrix #1 (37, 38, 39)
	- Atomic Lower Triangular Matrix #2 (40, 41, 42)
	- Atomic Lower Triangular Matrix #3 (43, 44, 45)
	- Atomic Upper Triangular Matrix #1 (49, 50, 51)
	- Atomic Upper Triangular Matrix #2 (52, 53, 54)
	- Atomic Upper Triangular Matrix #3 (55, 56, 57)
	- Atomic Upper Unitriangular Matrix Run (58, 59, 60)
	- Atomic Lower Unitriangular Matrix Run (61, 62, 63)
	- Non-periodic Tridiagonal Solver #1 (113, 114)
	- Non-periodic Tridiagonal Solver #2 (115, 116)


IdeaDRIP:
  • Loading branch information
Lakshmik committed Jul 7, 2024
1 parent ff01597 commit b477735
Show file tree
Hide file tree
Showing 28 changed files with 1,998 additions and 188 deletions.
59 changes: 59 additions & 0 deletions ReleaseNotes/02_08_2024.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

Features:

- Random Matrix Generator Atomic Lower Triangular (10, 11, 12)
- Random Matrix Generator Atomic Upper Triangular (46, 47, 48)
- Linear Algebra Tridiagonal Matrix Shell (81, 82)
- Linear Algebra Tridiagonal Matrix Constructor (83, 84)
- Non-Periodic Tridiagonal Matrix Shell (85, 86, 87)
- Non-Periodic Tridiagonal Matrix Constructor (88, 89, 90)
- Non-Periodic Tridiagonal Matrix Solver (91, 92, 93)
- Linear Algebra TridiagonalMatrix Shell (94, 95, 96)
- Non-Periodic Tridiagonal Matrix Shell (97, 98)
- Periodic Tridiagonal Matrix Shell (99, 100)
- Non-Periodic Tridiagonal Matrix #1 (101, 102, 103)
- Non-Periodic Tridiagonal Matrix #2 (104, 105)


Bug Fixes/Re-organization:

- Atomic Lower Triangular Fix #1 (13, 14, 15)
- Atomic Lower Triangular Fix #2 (16, 17, 18)
- Atomic Lower Triangular Fix #3 (19, 20, 21)
- Atomic Lower Triangular Fix #4 (22, 23, 24)
- Atomic Lower Triangular Fix #5 (25, 26, 27)
- Atomic Lower Triangular Fix #6 (28, 29, 30)
- Atomic Lower Triangular Fix #7 (31, 32, 33)
- Atomic Lower Triangular Fix #8 (34, 35, 36)
- Solvers of Linear Systems of Equations (64, 65)
- Numerical Linear System Solver Migration (66, 67, 68)
- Numerical Ryabenkii Tsynkov System Solver (69, 70, 71)
- Numerical Tridiagonal System Solver Migration (72, 73, 74)
- Numerical Strictly Tridiagonal System Solver (75, 76, 77)
- Numerical Sherman Morrison System Solver (78, 79, 80)
- Non-Periodic Tridiagonal Matrix Revamp (106, 107, 108)
- Numerical Linear Solver Tridiagonal Revamp (109, 110, 111)
- Non-Periodic Tridiagonal Revamp (112)
- Linear Solver Ryabenkii Tsynkov #1 (113, 114, 115)
- Linear Solver Ryabenkii Tsynkov #2 (116, 117, 118)
- Linear Solver Ryabenkii Tsynkov #3 (119, 120)


Samples:

- Upper Strictly Upper Triangular #1 (1, 2, 3)
- Upper Strictly Upper Triangular #2 (4, 5, 6)
- Upper Strictly Upper Triangular #3 (7, 8, 9)
- Atomic Lower Triangular Matrix #1 (37, 38, 39)
- Atomic Lower Triangular Matrix #2 (40, 41, 42)
- Atomic Lower Triangular Matrix #3 (43, 44, 45)
- Atomic Upper Triangular Matrix #1 (49, 50, 51)
- Atomic Upper Triangular Matrix #2 (52, 53, 54)
- Atomic Upper Triangular Matrix #3 (55, 56, 57)
- Atomic Upper Unitriangular Matrix Run (58, 59, 60)
- Atomic Lower Unitriangular Matrix Run (61, 62, 63)
- Non-periodic Tridiagonal Solver #1 (113, 114)
- Non-periodic Tridiagonal Solver #2 (115, 116)


IdeaDRIP:
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.drip.fdm.definition.R1EvolutionSnapshot;
import org.drip.function.definition.RdToR1;
import org.drip.numerical.common.NumberUtil;
import org.drip.numerical.linearalgebra.StrictlyTridiagonalSolver;
import org.drip.numerical.linearsolver.NonPeriodicTridiagonalScheme;

/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
Expand Down Expand Up @@ -379,7 +379,7 @@ public R1EvolutionSnapshot evolve (

try {
if (null == (
stateResponseArray = new StrictlyTridiagonalSolver (
stateResponseArray = NonPeriodicTridiagonalScheme.Standard (
stateResponseTransitionMatrix,
rhsArray
).forwardSweepBackSubstitution()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier inc
}

org.drip.numerical.linearalgebra.LinearizationOutput linearizationOutput =
org.drip.numerical.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion (
org.drip.numerical.linearsolver.LinearSystem.SolveUsingMatrixInversion (
constrainedObjectiveFunctionJacobianArray,
constrainedObjectiveFunctionRHSArray
);
Expand Down
88 changes: 88 additions & 0 deletions src/main/java/org/drip/measure/crng/RandomMatrixGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,92 @@ public static final TriangularMatrix StrictlyUpperTriangular (

return TriangularMatrix.Standard (r2Array);
}

/**
* Construct an Atomic Lower Triangular Matrix of Random Elements up to the Maximum Value
*
* @param elementCount Number of Elements in the Array
* @param maximumElement Maximum Element
* @param isEntryInteger TRUE - Entry is an Integer
*
* @return Atomic Lower Triangular Matrix of Random Elements up to the Maximum Value
*/

public static final TriangularMatrix AtomicLowerTriangular (
final int elementCount,
final double maximumElement,
final boolean isEntryInteger)
{
double[][] r2Array = RdRandomSequence.TwoD (elementCount, maximumElement, isEntryInteger);

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

for (int i = 0; i < r2Array.length; ++i) {
r2Array[i][i] = 1.;
}

int columnIndex = (int) (Math.random() * elementCount);

if (((int) maximumElement) - 1 == columnIndex) {
columnIndex = ((int) maximumElement) - 2;
} else if (0 == columnIndex) {
columnIndex = 1;
}

for (int i = 0; i < r2Array.length; ++i) {
if (columnIndex < i) {
r2Array[i][columnIndex] = 1.;
}
}

return TriangularMatrix.Standard (r2Array);
}

/**
* Construct an Atomic Upper Triangular Matrix of Random Elements up to the Maximum Value
*
* @param elementCount Number of Elements in the Array
* @param maximumElement Maximum Element
* @param isEntryInteger TRUE - Entry is an Integer
*
* @return Atomic Upper Triangular Matrix of Random Elements up to the Maximum Value
*/

public static final TriangularMatrix AtomicUpperTriangular (
final int elementCount,
final double maximumElement,
final boolean isEntryInteger)
{
double[][] r2Array = RdRandomSequence.TwoD (elementCount, maximumElement, isEntryInteger);

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

for (int i = 0; i < r2Array.length; ++i) {
r2Array[i][i] = 1.;
}

int columnIndex = (int) (Math.random() * elementCount);

if (((int) maximumElement) - 1 == columnIndex) {
columnIndex = ((int) maximumElement) - 2;
} else if (0 == columnIndex) {
columnIndex = 1;
}

for (int i = 0; i < r2Array.length; ++i) {
if (columnIndex > i) {
r2Array[i][columnIndex] = 1.;
}
}

return TriangularMatrix.Standard (r2Array);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static final R1PiecewiseDisplaced Standard (
}

org.drip.numerical.linearalgebra.LinearizationOutput lo =
org.drip.numerical.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion (aadblM, adblY);
org.drip.numerical.linearsolver.LinearSystem.SolveUsingMatrixInversion (aadblM, adblY);

if (null == lo) return null;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@

package org.drip.numerical.linearalgebra;

/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*/

/*!
* Copyright (C) 2025 Lakshmi Krishnamurthy
*
* This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
* asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
* analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
* equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
* numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
* graph builder/navigator, and computational support.
*
* https://lakshmidrip.github.io/DROP/
*
* DROP is composed of three modules:
*
* - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
* - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
* - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
*
* DROP Product Core implements libraries for the following:
* - Fixed Income Analytics
* - Loan Analytics
* - Transaction Cost Analytics
*
* DROP Portfolio Core implements libraries for the following:
* - Asset Allocation Analytics
* - Asset Liability Management Analytics
* - Capital Estimation Analytics
* - Exposure Analytics
* - Margin Analytics
* - XVA Analytics
*
* DROP Computational Core implements libraries for the following:
* - Algorithm Support
* - Computation Support
* - Function Analysis
* - Graph Algorithm
* - Model Validation
* - Numerical Analysis
* - Numerical Optimizer
* - Spline Builder
* - Statistical Learning
*
* Documentation for DROP is Spread Over:
*
* - Main => https://lakshmidrip.github.io/DROP/
* - Wiki => https://github.com/lakshmiDRIP/DROP/wiki
* - GitHub => https://github.com/lakshmiDRIP/DROP
* - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
* - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html
* - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
* - Release Versions => https://lakshmidrip.github.io/DROP/version.html
* - Community Credits => https://lakshmidrip.github.io/DROP/credits.html
* - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* <i>NonPeriodicTridiagonalMatrix</i> implements a banded Non-periodic Tridiagonal Matrix. The References
* are:
*
* <br><br>
* <ul>
* <li>
* Batista, M., and A. R. A. Ibrahim-Karawia (2009): The use of Sherman-Morrison-Woodbury formula
* to solve cyclic block tridiagonal and cyclic block penta-diagonal linear systems of equations
* <i>Applied Mathematics of Computation</i> <b>210 (2)</b> 558-563
* </li>
* <li>
* Datta, B. N. (2010): <i>Numerical Linear Algebra and Applications 2<sup>nd</sup> Edition</i>
* <b>SIAM</b> Philadelphia, PA
* </li>
* <li>
* Gallopoulos, E., B. Phillippe, and A. H. Sameh (2016): <i>Parallelism in Matrix Computations</i>
* <b>Spring</b> Berlin, Germany
* </li>
* <li>
* Niyogi, P. (2006): <i>Introduction to Computational Fluid Dynamics</i> <b>Pearson</b> London, UK
* </li>
* <li>
* Wikipedia (2024): Tridiagonal Matrix Algorithm
* https://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
* </li>
* </ul>
*
* <br><br>
* <ul>
* <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>
* </ul>
* <br><br>
*
* @author Lakshmi Krishnamurthy
*/

public class NonPeriodicTridiagonalMatrix extends TridiagonalMatrix
{

/**
* Construct an Instance of Non-periodic Tridiagonal Matrix
*
* @param r2Array R<sup>2</sup> Array
*
* @return Instance of Non-periodic Tridiagonal Matrix
*/

public static NonPeriodicTridiagonalMatrix Standard (
final double[][] r2Array)
{
return MatrixUtil.IsTridiagonal (r2Array) ? new NonPeriodicTridiagonalMatrix (r2Array) : null;
}

protected NonPeriodicTridiagonalMatrix (
final double[][] r2Array)
{
super (r2Array);
}
}
Loading

0 comments on commit b477735

Please sign in to comment.