# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.operation.positivedefinite

## Class MatthewsDavies

• All Implemented Interfaces:
Matrix, MatrixAccess, MatrixRing, MatrixTable, Densifiable, AbelianGroup<Matrix>, Monoid<Matrix>, Ring<Matrix>, Table, DeepCopyable

public class MatthewsDavies
extends DenseMatrix
Matthews and Davies propose the following way to coerce a non-positive definite Hessian matrix to become symmetric, positive definite. An LDL decomposition is performed on the non-positive definite matrix. The zero and negative entries are then replaced by the smallest positive entry in the diagonal matrix.
"Andreas Antoniou and Wu-Sheng Lu, "Algorithm 5.4," Practical Optimization: Algorithms and Engineering Applications."
• ### Constructor Summary

Constructors
Constructor and Description
MatthewsDavies(Matrix H)
Constructs a symmetric, positive definite matrix using the Matthews-Davies algorithm.
• ### Method Summary

All Methods
Modifier and Type Method and Description
DiagonalMatrix D()
Gets the diagonal matrix D in the LDL decomposition.
DiagonalMatrix Dhat()
Gets the modified diagonal matrix which is positive definite.
LowerTriangularMatrix L()
Gets the lower triangular matrix L in the LDL decomposition.
UpperTriangularMatrix Lt()
Gets the transpose of the lower triangular matrix L in the LDL decomposition.
• ### Methods inherited from class com.numericalmethod.suanshu.algebra.linear.matrix.doubles.matrixtype.dense.DenseMatrix

add, deepCopy, equals, get, getColumn, getColumn, getRow, getRow, hashCode, minus, multiply, multiply, nCols, nRows, ONE, opposite, scaled, set, setColumn, setRow, t, toDense, toString, ZERO
• ### Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

• #### MatthewsDavies

public MatthewsDavies(Matrix H)
Constructs a symmetric, positive definite matrix using the Matthews-Davies algorithm. This implementation replaces all zero or negative entries on the diagonal by the smallest positive entry on the diagonal. If all entries in the diagonal are negative, D becomes an identity matrix.
Parameters:
H - a non-positive definite matrix
• ### Method Detail

• #### L

public LowerTriangularMatrix L()
Gets the lower triangular matrix L in the LDL decomposition.
Returns:
L
• #### Lt

public UpperTriangularMatrix Lt()
Gets the transpose of the lower triangular matrix L in the LDL decomposition. The transpose is upper triangular.
Returns:
Lt
• #### D

public DiagonalMatrix D()
Gets the diagonal matrix D in the LDL decomposition.
Returns:
D
• #### Dhat

public DiagonalMatrix Dhat()
Gets the modified diagonal matrix which is positive definite.
Returns:
D^